Commit ea2013aa authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Make SelectionController::SelectClosestWordOrLinkFromMouseEvent() not to use VisibleSelection

This patch changes |SelectionControlle::SelectClosestWordOrLinkFromMouseEvent()|
to use |SelectionInFlatTree| instead of |VisibleSelection| since it is
redundant, for improving code health.

This is follow-up of the patch[1].

[1] http://crrev.com/c/595309: Make ExpandSelectionToRespectUserSelectAll() to
take SelectionInFlatTree

Bug: 657237
Change-Id: I4fb3c71c27f3b32322311724a99a44f61376b5ec
Reviewed-on: https://chromium-review.googlesource.com/597091Reviewed-by: default avatarYoichi Osato <yoichio@chromium.org>
Commit-Queue: Yoichi Osato <yoichio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491330}
parent b4a2f773
...@@ -667,18 +667,17 @@ void SelectionController::SelectClosestWordOrLinkFromMouseEvent( ...@@ -667,18 +667,17 @@ void SelectionController::SelectClosestWordOrLinkFromMouseEvent(
Element* url_element = result.GetHitTestResult().URLElement(); Element* url_element = result.GetHitTestResult().URLElement();
const VisiblePositionInFlatTree pos = const VisiblePositionInFlatTree pos =
VisiblePositionOfHitTestResult(result.GetHitTestResult()); VisiblePositionOfHitTestResult(result.GetHitTestResult());
const VisibleSelectionInFlatTree& new_selection = const SelectionInFlatTree& new_selection =
pos.IsNotNull() && pos.IsNotNull() &&
pos.DeepEquivalent().AnchorNode()->IsDescendantOf(url_element) pos.DeepEquivalent().AnchorNode()->IsDescendantOf(url_element)
? CreateVisibleSelection(SelectionInFlatTree::Builder() ? SelectionInFlatTree::Builder()
.SelectAllChildren(*url_element) .SelectAllChildren(*url_element)
.Build()) .Build()
: VisibleSelectionInFlatTree(); : SelectionInFlatTree();
UpdateSelectionForMouseDownDispatchingSelectStart( UpdateSelectionForMouseDownDispatchingSelectStart(
inner_node, inner_node,
ExpandSelectionToRespectUserSelectAll(inner_node, ExpandSelectionToRespectUserSelectAll(inner_node, new_selection),
new_selection.AsSelection()),
TextGranularity::kWord, HandleVisibility::kNotVisible); TextGranularity::kWord, HandleVisibility::kNotVisible);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment