Move SelectionTemplate::is_handle_visible_ to FrameSelection

This patch moves |is_handle_visible_| to |FrameSelection| from |SelectionTemplate|
since handle visibility is used only for setting |FrameSelection|, hence it is
a redundant member variable of |SelectionTemplate|.

Bug: 742093
Change-Id: I3add4da3844fb40be34dcb4d4b46b5fa6fed1d7e
Reviewed-on: https://chromium-review.googlesource.com/595389
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: Xiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491660}
bool SelectionController::UpdateSelectionForMouseDownDispatchingSelectStart(
    Node* target_node,
    const SelectionInFlatTree& selection,
    TextGranularity granularity,
    HandleVisibility handle_visibility) {
  if (target_node && target_node->GetLayoutObject() &&
      !target_node->GetLayoutObject()->IsSelectable())
    return false;

  const VisibleSelectionInFlatTree& visible_selection =
      CreateVisibleSelection(selection);

  if (DispatchSelectStart(target_node) != DispatchEventResult::kNotCanceled)
    return false;

  if (!this->Selection().IsAvailable())
    return false;

  if (!visible_selection.IsValidFor(this->Selection().GetDocument()))
    return false;

  if (visible_selection.IsRange()) {
    selection_state_ = SelectionState::kExtendedSelection;
    SetNonDirectionalSelectionIfNeeded(
        selection, granularity, kDoNotAdjustEndpoints, handle_visibility);

    return true;
  }

  selection_state_ = SelectionState::kPlacedCaret;
  SetNonDirectionalSelectionIfNeeded(selection, TextGranularity::kCharacter,
                                     kDoNotAdjustEndpoints, handle_visibility);
  return true;
}

bool SelectionController::UpdateSelectionForMouseDownDispatchingSelectStart(
    Node* target_node,
    const SelectionInFlatTree& selection,
    TextGranularity granularity,
    HandleVisibility handle_visibility) {
  if (target_node && target_node->GetLayoutObject() &&
      !target_node->GetLayoutObject()->IsSelectable())
    return false;

  const VisibleSelectionInFlatTree& visible_selection =
      CreateVisibleSelection(selection);

  if (DispatchSelectStart(target_node) != DispatchEventResult::kNotCanceled)
    return false;

  if (!this->Selection().IsAvailable())
    return false;

  if (!visible_selection.IsValidFor(this->Selection().GetDocument()))
    return false;

  if (visible_selection.IsRange()) {
    selection_state_ = SelectionState::kExtendedSelection;
    SetNonDirectionalSelectionIfNeeded(
        selection, granularity, kDoNotAdjustEndpoints, handle_visibility);

    return true;
  }

  selection_state_ = SelectionState::kPlacedCaret;
  SetNonDirectionalSelectionIfNeeded(selection, TextGranularity::kCharacter,
                                     kDoNotAdjustEndpoints, handle_visibility);
  return true;
}
