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

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

Issue 2791473002: Reuse selectorListMatches for all loops over the selectors in SelectorQuery. (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/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, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2011, 2013 Apple Inc. All rights reserved.
3 * Copyright (C) 2014 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2014 Samsung Electronics. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 template <typename SelectorQueryTrait> 72 template <typename SelectorQueryTrait>
73 void findTraverseRootsAndExecute( 73 void findTraverseRootsAndExecute(
74 ContainerNode& rootNode, 74 ContainerNode& rootNode,
75 typename SelectorQueryTrait::OutputType&) const; 75 typename SelectorQueryTrait::OutputType&) const;
76 template <typename SelectorQueryTrait> 76 template <typename SelectorQueryTrait>
77 void executeForTraverseRoot(ContainerNode* traverseRoot, 77 void executeForTraverseRoot(ContainerNode* traverseRoot,
78 ContainerNode& rootNode, 78 ContainerNode& rootNode,
79 typename SelectorQueryTrait::OutputType&) const; 79 typename SelectorQueryTrait::OutputType&) const;
80 template <typename SelectorQueryTrait> 80 template <typename SelectorQueryTrait>
81 bool selectorListMatches(ContainerNode& rootNode,
82 Element&,
83 typename SelectorQueryTrait::OutputType&) const;
84 template <typename SelectorQueryTrait>
85 void executeSlow(ContainerNode& rootNode, 81 void executeSlow(ContainerNode& rootNode,
86 typename SelectorQueryTrait::OutputType&) const; 82 typename SelectorQueryTrait::OutputType&) const;
87 template <typename SelectorQueryTrait> 83 template <typename SelectorQueryTrait>
88 void executeSlowTraversingShadowTree( 84 void executeSlowTraversingShadowTree(
89 ContainerNode& rootNode, 85 ContainerNode& rootNode,
90 typename SelectorQueryTrait::OutputType&) const; 86 typename SelectorQueryTrait::OutputType&) const;
91 template <typename SelectorQueryTrait> 87 template <typename SelectorQueryTrait>
92 void execute(ContainerNode& rootNode, 88 void execute(ContainerNode& rootNode,
93 typename SelectorQueryTrait::OutputType&) const; 89 typename SelectorQueryTrait::OutputType&) const;
94 90
91 bool selectorListMatches(ContainerNode& rootNode, Element&) const;
92
95 CSSSelectorList m_selectorList; 93 CSSSelectorList m_selectorList;
96 // Contains the list of CSSSelector's to match, but without ones that could 94 // Contains the list of CSSSelector's to match, but without ones that could
97 // never match like pseudo elements, div::before. This can be empty, while 95 // never match like pseudo elements, div::before. This can be empty, while
98 // m_selectorList will never be empty as SelectorQueryCache::add would have 96 // m_selectorList will never be empty as SelectorQueryCache::add would have
99 // thrown an exception. 97 // thrown an exception.
100 Vector<const CSSSelector*> m_selectors; 98 Vector<const CSSSelector*> m_selectors;
101 bool m_usesDeepCombinatorOrShadowPseudo : 1; 99 bool m_usesDeepCombinatorOrShadowPseudo : 1;
102 bool m_needsUpdatedDistribution : 1; 100 bool m_needsUpdatedDistribution : 1;
103 }; 101 };
104 102
105 class SelectorQueryCache { 103 class SelectorQueryCache {
106 USING_FAST_MALLOC(SelectorQueryCache); 104 USING_FAST_MALLOC(SelectorQueryCache);
107 105
108 public: 106 public:
109 SelectorQuery* add(const AtomicString&, const Document&, ExceptionState&); 107 SelectorQuery* add(const AtomicString&, const Document&, ExceptionState&);
110 void invalidate(); 108 void invalidate();
111 109
112 private: 110 private:
113 HashMap<AtomicString, std::unique_ptr<SelectorQuery>> m_entries; 111 HashMap<AtomicString, std::unique_ptr<SelectorQuery>> m_entries;
114 }; 112 };
115 113
116 } // namespace blink 114 } // namespace blink
117 115
118 #endif 116 #endif
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/dom/SelectorQuery.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698