Chromium Code Reviews| Index: Source/core/dom/SelectorQuery.cpp |
| diff --git a/Source/core/dom/SelectorQuery.cpp b/Source/core/dom/SelectorQuery.cpp |
| index d75fe0b6fc7db09c3bdd3e0cfdcdfb55fd5bad93..4da61ad1c1afe89c1c0c404513fdb25c6e3be127 100644 |
| --- a/Source/core/dom/SelectorQuery.cpp |
| +++ b/Source/core/dom/SelectorQuery.cpp |
| @@ -179,6 +179,8 @@ PassRefPtr<Element> SelectorDataList::queryFirst(Node& rootNode) const |
| return executeQueryFirst(rootNode); |
| } |
| +// FIXME: StyleSheetScopingNodeList also has isTreeScopeRoot. |
| +// Need to move TreeScope.h to remove duplicate functions. |
|
Hajime Morrita
2013/11/18 05:02:52
Let's do this in this change.
tasak
2013/11/18 05:45:56
Done.
|
| static inline bool isTreeScopeRoot(Node* node) |
| { |
| ASSERT(node); |
| @@ -333,7 +335,7 @@ void SelectorDataList::executeQueryAll(Node& rootNode, Vector<RefPtr<Node> >& ma |
| // Just the same as getElementById. |
| Element* element = rootNode.treeScope().getElementById(firstSelector->value()); |
| - if (element && (isTreeScopeRoot(rootNode) || element->isDescendantOf(&rootNode))) |
| + if (element && (isTreeScopeRoot(&rootNode) || element->isDescendantOf(&rootNode))) |
| matchedElements.append(element); |
| return; |
| } |
| @@ -392,7 +394,7 @@ Node* SelectorDataList::findTraverseRoot(Node& rootNode, bool& matchTraverseRoot |
| if (selector->m_match == CSSSelector::Id && !rootNode.document().containsMultipleElementsWithId(selector->value())) { |
| Element* element = rootNode.treeScope().getElementById(selector->value()); |
| Node* adjustedRootNode = &rootNode; |
| - if (element && (isTreeScopeRoot(rootNode) || element->isDescendantOf(&rootNode))) |
| + if (element && (isTreeScopeRoot(&rootNode) || element->isDescendantOf(&rootNode))) |
| adjustedRootNode = element; |
| else if (!element || matchSingleNode) |
| adjustedRootNode = 0; |
| @@ -446,7 +448,7 @@ Element* SelectorDataList::executeQueryFirst(Node& rootNode) const |
| if (rootNode.document().containsMultipleElementsWithId(selector->value())) |
| break; |
| Element* element = rootNode.treeScope().getElementById(selector->value()); |
| - return element && (isTreeScopeRoot(rootNode) || element->isDescendantOf(&rootNode)) ? element : 0; |
| + return element && (isTreeScopeRoot(&rootNode) || element->isDescendantOf(&rootNode)) ? element : 0; |
| } |
| case CSSSelector::Class: |
| return findElementByClassName(rootNode, selector->value()); |