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

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-17T16:13:56 selectionTypeWithLegacyGranularity() 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 8d1a24704a2080ce07acdbb13d972dded6a10509..31cebb6047f19fdf825bdbf565fb01744276aa94 100644
--- a/third_party/WebKit/Source/core/editing/DOMSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/DOMSelection.cpp
@@ -666,9 +666,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();
@@ -678,8 +676,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