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

Unified Diff: Source/core/dom/SelectorQuery.h

Issue 138743008: Make sure the root node of selector queries is a ContainerNode (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 11 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 | « Source/core/dom/Node.cpp ('k') | Source/core/dom/SelectorQuery.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/SelectorQuery.h
diff --git a/Source/core/dom/SelectorQuery.h b/Source/core/dom/SelectorQuery.h
index db952daec1945f51a7847a41ffa2ad6e32c18e56..a4b06877ae64ed798a249578b35d82ecfdcaec8a 100644
--- a/Source/core/dom/SelectorQuery.h
+++ b/Source/core/dom/SelectorQuery.h
@@ -35,6 +35,7 @@
namespace WebCore {
class CSSSelector;
+class ContainerNode;
class Document;
class Element;
class ExceptionState;
@@ -47,8 +48,8 @@ class SelectorDataList {
public:
void initialize(const CSSSelectorList&);
bool matches(Element&) const;
- PassRefPtr<NodeList> queryAll(Node& rootNode) const;
- PassRefPtr<Element> queryFirst(Node& rootNode) const;
+ PassRefPtr<NodeList> queryAll(ContainerNode& rootNode) const;
+ PassRefPtr<Element> queryFirst(ContainerNode& rootNode) const;
private:
struct SelectorData {
@@ -57,27 +58,27 @@ private:
bool isFastCheckable;
};
- bool canUseFastQuery(const Node& rootNode) const;
- bool selectorMatches(const SelectorData&, Element&, const Node&) const;
+ bool canUseFastQuery(const ContainerNode& rootNode) const;
+ bool selectorMatches(const SelectorData&, Element&, const ContainerNode&) const;
template <typename SelectorQueryTrait>
- void collectElementsByClassName(Node& rootNode, const AtomicString& className, typename SelectorQueryTrait::OutputType&) const;
+ void collectElementsByClassName(ContainerNode& rootNode, const AtomicString& className, typename SelectorQueryTrait::OutputType&) const;
template <typename SelectorQueryTrait>
- void collectElementsByTagName(Node& rootNode, const QualifiedName& tagName, typename SelectorQueryTrait::OutputType&) const;
+ void collectElementsByTagName(ContainerNode& rootNode, const QualifiedName& tagName, typename SelectorQueryTrait::OutputType&) const;
template <typename SelectorQueryTrait>
- void findTraverseRootsAndExecute(Node& rootNode, typename SelectorQueryTrait::OutputType&) const;
+ void findTraverseRootsAndExecute(ContainerNode& rootNode, typename SelectorQueryTrait::OutputType&) const;
enum MatchTraverseRootState { DoesNotMatchTraverseRoots, MatchesTraverseRoots };
template <typename SelectorQueryTrait>
- void executeForTraverseRoot(const SelectorData&, Node* traverseRoot, MatchTraverseRootState, Node& rootNode, typename SelectorQueryTrait::OutputType&) const;
+ void executeForTraverseRoot(const SelectorData&, Node* traverseRoot, MatchTraverseRootState, ContainerNode& rootNode, typename SelectorQueryTrait::OutputType&) const;
template <typename SelectorQueryTrait, typename SimpleNodeListType>
- void executeForTraverseRoots(const SelectorData&, SimpleNodeListType& traverseRoots, MatchTraverseRootState, Node& rootNode, typename SelectorQueryTrait::OutputType&) const;
+ void executeForTraverseRoots(const SelectorData&, SimpleNodeListType& traverseRoots, MatchTraverseRootState, ContainerNode& rootNode, typename SelectorQueryTrait::OutputType&) const;
template <typename SelectorQueryTrait>
- void executeSlow(Node& rootNode, typename SelectorQueryTrait::OutputType&) const;
+ void executeSlow(ContainerNode& rootNode, typename SelectorQueryTrait::OutputType&) const;
template <typename SelectorQueryTrait>
- void execute(Node& rootNode, typename SelectorQueryTrait::OutputType&) const;
+ void execute(ContainerNode& rootNode, typename SelectorQueryTrait::OutputType&) const;
const CSSSelector* selectorForIdLookup(const CSSSelector*) const;
Vector<SelectorData> m_selectors;
@@ -89,8 +90,8 @@ class SelectorQuery {
public:
explicit SelectorQuery(const CSSSelectorList&);
bool matches(Element&) const;
- PassRefPtr<NodeList> queryAll(Node& rootNode) const;
- PassRefPtr<Element> queryFirst(Node& rootNode) const;
+ PassRefPtr<NodeList> queryAll(ContainerNode& rootNode) const;
+ PassRefPtr<Element> queryFirst(ContainerNode& rootNode) const;
private:
SelectorDataList m_selectors;
CSSSelectorList m_selectorList;
« no previous file with comments | « Source/core/dom/Node.cpp ('k') | Source/core/dom/SelectorQuery.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698