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

Make SetSelectionToDragCaret() not to use...

Make SetSelectionToDragCaret() not to use FrameSelection::ComputeVisibileSelectionInDOMTreeDeprecated()

This patch changes |SetSelectionToDragCaret()| to use
|FrameSelection::ComputeVisibileSelectionInDOMTree| instead of deprecated
version for improving code health.

This is 2/3 of series of patches:
 1. http://crrev.com/c/This patch
 2. This patch
 3. http://crrev.com/c/1153071

Bug: 698633
Change-Id: Ie51e4b8524c4429fb04a065cb13264e7277d2697
Reviewed-on: https://chromium-review.googlesource.com/1153070
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#579296}
parent dee1b590
...@@ -474,29 +474,28 @@ static bool SetSelectionToDragCaret(LocalFrame* frame, ...@@ -474,29 +474,28 @@ static bool SetSelectionToDragCaret(LocalFrame* frame,
Range*& range, Range*& range,
const LayoutPoint& point) { const LayoutPoint& point) {
frame->Selection().SetSelectionAndEndTyping(drag_caret); frame->Selection().SetSelectionAndEndTyping(drag_caret);
if (frame->Selection() // TODO(editing-dev): The use of
.ComputeVisibleSelectionInDOMTreeDeprecated() // UpdateStyleAndLayoutIgnorePendingStylesheets
.IsNone()) { // needs to be audited. See http://crbug.com/590369 for more details.
// TODO(editing-dev): The use of frame->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
// updateStyleAndLayoutIgnorePendingStylesheets if (frame->Selection().ComputeVisibleSelectionInDOMTree().IsNone()) {
// needs to be audited. See http://crbug.com/590369 for more details.
// |LocalFrame::positinForPoint()| requires clean layout.
frame->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
const PositionWithAffinity& position = frame->PositionForPoint(point); const PositionWithAffinity& position = frame->PositionForPoint(point);
if (!position.IsConnected()) if (!position.IsConnected())
return false; return false;
frame->Selection().SetSelectionAndEndTyping( frame->Selection().SetSelectionAndEndTyping(
SelectionInDOMTree::Builder().Collapse(position).Build()); SelectionInDOMTree::Builder().Collapse(position).Build());
// TODO(editing-dev): The use of
// UpdateStyleAndLayoutIgnorePendingStylesheets
// needs to be audited. See http://crbug.com/590369 for more details.
frame->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets();
const VisibleSelection& drag_caret = const VisibleSelection& drag_caret =
frame->Selection().ComputeVisibleSelectionInDOMTreeDeprecated(); frame->Selection().ComputeVisibleSelectionInDOMTree();
range = CreateRange(drag_caret.ToNormalizedEphemeralRange()); range = CreateRange(drag_caret.ToNormalizedEphemeralRange());
} }
return !frame->Selection() return !frame->Selection().ComputeVisibleSelectionInDOMTree().IsNone() &&
.ComputeVisibleSelectionInDOMTreeDeprecated()
.IsNone() &&
frame->Selection() frame->Selection()
.ComputeVisibleSelectionInDOMTreeDeprecated() .ComputeVisibleSelectionInDOMTree()
.IsContentEditable(); .IsContentEditable();
} }
......
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