Index: third_party/WebKit/Source/core/dom/SelectorQuery.cpp |
diff --git a/third_party/WebKit/Source/core/dom/SelectorQuery.cpp b/third_party/WebKit/Source/core/dom/SelectorQuery.cpp |
index c3b21eaf16a107279503dd0a3b05dbbb413c683b..a8c7576e7cdbe12a64df19e8cb4137cfea5b436f 100644 |
--- a/third_party/WebKit/Source/core/dom/SelectorQuery.cpp |
+++ b/third_party/WebKit/Source/core/dom/SelectorQuery.cpp |
@@ -250,8 +250,7 @@ void SelectorQuery::findTraverseRootsAndExecute( |
Element* element = |
rootNode.containingTreeScope().getElementById(selector->value()); |
ContainerNode* adjustedNode = &rootNode; |
- if (element && |
- (isTreeScopeRoot(rootNode) || element->isDescendantOf(&rootNode))) |
+ if (element && element->isDescendantOf(&rootNode)) |
adjustedNode = element; |
else if (!element || isRightmostSelector) |
adjustedNode = nullptr; |
@@ -509,7 +508,7 @@ void SelectorQuery::execute( |
const HeapVector<Member<Element>>& elements = |
rootNode.treeScope().getAllElementsById(idToMatch); |
for (const auto& element : elements) { |
- if (!(isTreeScopeRoot(rootNode) || element->isDescendantOf(&rootNode))) |
+ if (!element->isDescendantOf(&rootNode)) |
continue; |
if (selectorMatches(selector, *element, rootNode)) { |
SelectorQueryTrait::appendElement(output, *element); |
@@ -520,8 +519,9 @@ void SelectorQuery::execute( |
return; |
} |
Element* element = rootNode.treeScope().getElementById(idToMatch); |
- if (!element || |
- !(isTreeScopeRoot(rootNode) || element->isDescendantOf(&rootNode))) |
+ if (!element) |
+ return; |
+ if (!element->isDescendantOf(&rootNode)) |
return; |
if (selectorMatches(selector, *element, rootNode)) |
SelectorQueryTrait::appendElement(output, *element); |