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

Unified Diff: third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp

Issue 2708703003: Expand FrameSeleciton::isRange() to increase chances of hoisting update layout (Closed)
Patch Set: 2017-02-21T23:48:22 rebase Created 3 years, 10 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
Index: third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
index f1c829038055538fe31a41e9edce18811875ce5c..e0cc689747bf617559b2b27bccc78c9632e0fb75 100644
--- a/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/EditorCommand.cpp
@@ -420,7 +420,7 @@ static TriState selectionListState(const FrameSelection& selection,
selection.computeVisibleSelectionInDOMTreeDeprecated().start(),
tagName))
return TrueTriState;
- } else if (selection.isRange()) {
+ } else if (selection.computeVisibleSelectionInDOMTreeDeprecated().isRange()) {
Element* startElement = enclosingElementWithTag(
selection.computeVisibleSelectionInDOMTreeDeprecated().start(),
tagName);
@@ -1939,7 +1939,10 @@ static bool enabledRangeInEditableText(LocalFrame& frame,
// We should update selection to canonicalize with current layout and style,
// before accessing |FrameSelection::selection()|.
frame.selection().updateIfNeeded();
- return frame.selection().isRange() && frame.selection().isContentEditable();
+ return frame.selection()
+ .computeVisibleSelectionInDOMTreeDeprecated()
+ .isRange() &&
+ frame.selection().isContentEditable();
}
static bool enabledRangeInRichlyEditableText(LocalFrame& frame,
@@ -1950,7 +1953,9 @@ static bool enabledRangeInRichlyEditableText(LocalFrame& frame,
// We should update selection to canonicalize with current layout and style,
// before accessing |FrameSelection::selection()|.
frame.selection().updateIfNeeded();
- return frame.selection().isRange() &&
+ return frame.selection()
+ .computeVisibleSelectionInDOMTreeDeprecated()
+ .isRange() &&
frame.selection()
.computeVisibleSelectionInDOMTreeDeprecated()
.isContentRichlyEditable();

Powered by Google App Engine
This is Rietveld 408576698