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

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-17T00:37:54 FrameSelection::selectFrameElementInParentIfFullySelected() to use FS::isRange() 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/DOMSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/DOMSelection.cpp b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
index da74aa29d601e9082424cc260e49acffe948b5b7..21700a1b8f2b15717fdbb62f97b21117cdcccf85 100644
--- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
@@ -630,9 +630,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())
+ if (frame()->document() != n->document())
return false;
unsigned nodeIndex = n->nodeIndex();
@@ -642,8 +640,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') | third_party/WebKit/Source/core/editing/Editor.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698