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

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

Issue 2698793003: Get rid of redundant layout tree update related to selection (Closed)
Patch Set: 2017-02-16T17:15:58 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/Editor.cpp » ('j') | 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 679549835d6f52797f6431e7053480efeaca286a..ae0fe16d111f7515328a25b561f49345225cd5fa 100644
--- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
@@ -607,9 +607,7 @@ bool DOMSelection::containsNode(const Node* n, bool allowPartial) const {
if (!isAvailable())
return false;
- FrameSelection& selection = frame()->selection();
-
- if (frame()->document() != n->document() || selection.isNone())
yosin_UTC9 2017/02/16 09:50:26 FrameSeleciton::isNone() requires clean layout tre
+ if (frame()->document() != n->document())
return false;
unsigned nodeIndex = n->nodeIndex();
@@ -619,8 +617,11 @@ bool DOMSelection::containsNode(const Node* n, bool allowPartial) const {
// |VisibleSelection::toNormalizedEphemeralRange| requires clean layout.
frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
+ FrameSelection& selection = frame()->selection();
const EphemeralRange selectedRange =
selection.selection().toNormalizedEphemeralRange();
+ if (selectedRange.isNull())
+ return false;
ContainerNode* parentNode = n->parentNode();
if (!parentNode)
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/Editor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698