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

Unified Diff: third_party/WebKit/Source/core/dom/SelectorQuery.cpp

Issue 2768263006: Remove isTreeScopeRoot. (Closed)
Patch Set: Created 3 years, 9 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 | « third_party/WebKit/Source/core/dom/Node.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « third_party/WebKit/Source/core/dom/Node.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698