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