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) |