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

Side by Side Diff: Source/core/dom/SelectorQuery.h

Issue 92083002: Add fast path for tag#id selector queries (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move emptyVector Created 7 years 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 unified diff | Download patch
« no previous file with comments | « Source/core/dom/DocumentOrderedMap.cpp ('k') | Source/core/dom/SelectorQuery.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 void collectElementsByClassName(Node& rootNode, const AtomicString& classNam e, Vector<RefPtr<Node> >&) const; 61 void collectElementsByClassName(Node& rootNode, const AtomicString& classNam e, Vector<RefPtr<Node> >&) const;
62 Element* findElementByClassName(Node& rootNode, const AtomicString& classNam e) const; 62 Element* findElementByClassName(Node& rootNode, const AtomicString& classNam e) const;
63 void collectElementsByTagName(Node& rootNode, const QualifiedName& tagName, Vector<RefPtr<Node> >&) const; 63 void collectElementsByTagName(Node& rootNode, const QualifiedName& tagName, Vector<RefPtr<Node> >&) const;
64 Element* findElementByTagName(Node& rootNode, const QualifiedName& tagName) const; 64 Element* findElementByTagName(Node& rootNode, const QualifiedName& tagName) const;
65 PassOwnPtr<SimpleNodeList> findTraverseRoots(Node& rootNode, bool& matchTrav erseRoots) const; 65 PassOwnPtr<SimpleNodeList> findTraverseRoots(Node& rootNode, bool& matchTrav erseRoots) const;
66 void executeSlowQueryAll(Node& rootNode, Vector<RefPtr<Node> >& matchedEleme nts) const; 66 void executeSlowQueryAll(Node& rootNode, Vector<RefPtr<Node> >& matchedEleme nts) const;
67 void executeQueryAll(Node& rootNode, Vector<RefPtr<Node> >& matchedElements) const; 67 void executeQueryAll(Node& rootNode, Vector<RefPtr<Node> >& matchedElements) const;
68 Node* findTraverseRoot(Node& rootNode, bool& matchTraverseRoot) const; 68 Node* findTraverseRoot(Node& rootNode, bool& matchTraverseRoot) const;
69 Element* executeSlowQueryFirst(Node& rootNode) const; 69 Element* executeSlowQueryFirst(Node& rootNode) const;
70 Element* executeQueryFirst(Node& rootNode) const; 70 Element* executeQueryFirst(Node& rootNode) const;
71 const CSSSelector* selectorForIdLookup(const CSSSelector*) const;
71 72
72 Vector<SelectorData> m_selectors; 73 Vector<SelectorData> m_selectors;
73 }; 74 };
74 75
75 class SelectorQuery { 76 class SelectorQuery {
76 WTF_MAKE_NONCOPYABLE(SelectorQuery); 77 WTF_MAKE_NONCOPYABLE(SelectorQuery);
77 WTF_MAKE_FAST_ALLOCATED; 78 WTF_MAKE_FAST_ALLOCATED;
78 public: 79 public:
79 explicit SelectorQuery(const CSSSelectorList&); 80 explicit SelectorQuery(const CSSSelectorList&);
80 bool matches(Element&) const; 81 bool matches(Element&) const;
(...skipping 10 matching lines...) Expand all
91 SelectorQuery* add(const AtomicString&, const Document&, ExceptionState&); 92 SelectorQuery* add(const AtomicString&, const Document&, ExceptionState&);
92 void invalidate(); 93 void invalidate();
93 94
94 private: 95 private:
95 HashMap<AtomicString, OwnPtr<SelectorQuery> > m_entries; 96 HashMap<AtomicString, OwnPtr<SelectorQuery> > m_entries;
96 }; 97 };
97 98
98 } 99 }
99 100
100 #endif 101 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/DocumentOrderedMap.cpp ('k') | Source/core/dom/SelectorQuery.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698