Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Unified Diff: third_party/WebKit/Source/core/editing/DOMSelection.cpp

Issue 2384103002: Prune CreateVisibleSelectionDeprecated from DOMSelection (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/DOMSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/DOMSelection.cpp b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
index 37c666dd79061942417e7bf1cd432cb35ffb4de7..73136ce983b8d43220fa26e51654abc49057bda2 100644
--- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
@@ -209,7 +209,15 @@ void DOMSelection::collapse(Node* node,
Range::checkNodeWOffset(node, offset, exceptionState);
if (exceptionState.hadException())
return;
- frame()->selection().setSelection(createVisibleSelectionDeprecated(
+
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ // In the long term, we should change FrameSelection::setSelection to take a
+ // parameter that does not require clean layout, so that modifying selection
+ // no longer performs synchronous layout by itself.
+ frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
+
+ frame()->selection().setSelection(createVisibleSelection(
Position(node, offset), frame()->selection().isDirectional()));
}
@@ -280,7 +288,15 @@ void DOMSelection::setBaseAndExtent(Node* baseNode,
Position base = createPosition(baseNode, baseOffset);
Position extent = createPosition(extentNode, extentOffset);
const bool selectionHasDirection = true;
- frame()->selection().setSelection(createVisibleSelectionDeprecated(
+
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ // In the long term, we should change FrameSelection::setSelection to take a
+ // parameter that does not require clean layout, so that modifying selection
+ // no longer performs synchronous layout by itself.
+ frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
+
+ frame()->selection().setSelection(createVisibleSelection(
base, extent, SelDefaultAffinity, selectionHasDirection));
}
@@ -361,7 +377,15 @@ void DOMSelection::extend(Node* node,
const Position& base = frame()->selection().base();
const Position& extent = createPosition(node, offset);
const bool selectionHasDirection = true;
- const VisibleSelection newSelection = createVisibleSelectionDeprecated(
+
+ // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
+ // needs to be audited. See http://crbug.com/590369 for more details.
+ // In the long term, we should change FrameSelection::setSelection to take a
+ // parameter that does not require clean layout, so that modifying selection
+ // no longer performs synchronous layout by itself.
+ frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
+
+ const VisibleSelection newSelection = createVisibleSelection(
base, extent, TextAffinity::Downstream, selectionHasDirection);
frame()->selection().setSelection(newSelection);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698