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

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

Issue 2774663003: Simplify the SelectorQuery constructor and reuse CSSSelectorList::length(). (Closed)
Patch Set: woops 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 unified diff | Download patch
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 typename SelectorQueryTrait::OutputType&) const; 97 typename SelectorQueryTrait::OutputType&) const;
98 template <typename SelectorQueryTrait> 98 template <typename SelectorQueryTrait>
99 void executeSlowTraversingShadowTree( 99 void executeSlowTraversingShadowTree(
100 ContainerNode& rootNode, 100 ContainerNode& rootNode,
101 typename SelectorQueryTrait::OutputType&) const; 101 typename SelectorQueryTrait::OutputType&) const;
102 template <typename SelectorQueryTrait> 102 template <typename SelectorQueryTrait>
103 void execute(ContainerNode& rootNode, 103 void execute(ContainerNode& rootNode,
104 typename SelectorQueryTrait::OutputType&) const; 104 typename SelectorQueryTrait::OutputType&) const;
105 105
106 CSSSelectorList m_selectorList; 106 CSSSelectorList m_selectorList;
107 // Contains the list of CSSSelector's to match, but without ones that could
108 // never match like pseudo elements, div::before. This can be empty, while
109 // m_selectorList will never be empty as SelectorQueryCache::add would have
110 // thrown an exception.
107 Vector<const CSSSelector*> m_selectors; 111 Vector<const CSSSelector*> m_selectors;
108 bool m_usesDeepCombinatorOrShadowPseudo : 1; 112 bool m_usesDeepCombinatorOrShadowPseudo : 1;
109 bool m_needsUpdatedDistribution : 1; 113 bool m_needsUpdatedDistribution : 1;
110 }; 114 };
111 115
112 class SelectorQueryCache { 116 class SelectorQueryCache {
113 USING_FAST_MALLOC(SelectorQueryCache); 117 USING_FAST_MALLOC(SelectorQueryCache);
114 118
115 public: 119 public:
116 SelectorQuery* add(const AtomicString&, const Document&, ExceptionState&); 120 SelectorQuery* add(const AtomicString&, const Document&, ExceptionState&);
117 void invalidate(); 121 void invalidate();
118 122
119 private: 123 private:
120 HashMap<AtomicString, std::unique_ptr<SelectorQuery>> m_entries; 124 HashMap<AtomicString, std::unique_ptr<SelectorQuery>> m_entries;
121 }; 125 };
122 126
123 } // namespace blink 127 } // namespace blink
124 128
125 #endif 129 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSelectorList.cpp ('k') | third_party/WebKit/Source/core/dom/SelectorQuery.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698