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

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

Issue 2306903002: Fix the wrong usages of CSSSelectorList::selectorUsesXXX() functions (Closed)
Patch Set: Fix Created 4 years, 3 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 { 106 {
107 DCHECK(m_selectors.isEmpty()); 107 DCHECK(m_selectors.isEmpty());
108 108
109 unsigned selectorCount = 0; 109 unsigned selectorCount = 0;
110 for (const CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(*selector)) 110 for (const CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(*selector))
111 selectorCount++; 111 selectorCount++;
112 112
113 m_usesDeepCombinatorOrShadowPseudo = false; 113 m_usesDeepCombinatorOrShadowPseudo = false;
114 m_needsUpdatedDistribution = false; 114 m_needsUpdatedDistribution = false;
115 m_selectors.reserveInitialCapacity(selectorCount); 115 m_selectors.reserveInitialCapacity(selectorCount);
116 unsigned index = 0; 116 for (const CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(*selector)) {
117 for (const CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(*selector), ++index) {
118 if (selector->matchesPseudoElement()) 117 if (selector->matchesPseudoElement())
119 continue; 118 continue;
120 m_selectors.uncheckedAppend(selector); 119 m_selectors.uncheckedAppend(selector);
121 m_usesDeepCombinatorOrShadowPseudo |= selectorList.selectorUsesDeepCombi natorOrShadowPseudo(index); 120 m_usesDeepCombinatorOrShadowPseudo |= selector->hasDeepCombinatorOrShado wPseudo();
122 m_needsUpdatedDistribution |= selectorList.selectorNeedsUpdatedDistribut ion(index); 121 m_needsUpdatedDistribution |= selector->needsUpdatedDistribution();
123 } 122 }
124 } 123 }
125 124
126 inline bool SelectorDataList::selectorMatches(const CSSSelector& selector, Eleme nt& element, const ContainerNode& rootNode) const 125 inline bool SelectorDataList::selectorMatches(const CSSSelector& selector, Eleme nt& element, const ContainerNode& rootNode) const
127 { 126 {
128 SelectorChecker::Init init; 127 SelectorChecker::Init init;
129 init.mode = SelectorChecker::QueryingRules; 128 init.mode = SelectorChecker::QueryingRules;
130 init.isQuerySelector = true; 129 init.isQuerySelector = true;
131 SelectorChecker checker(init); 130 SelectorChecker checker(init);
132 SelectorChecker::SelectorCheckingContext context(&element, SelectorChecker:: VisitedMatchDisabled); 131 SelectorChecker::SelectorCheckingContext context(&element, SelectorChecker:: VisitedMatchDisabled);
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 586
588 return m_entries.add(selectors, SelectorQuery::adopt(std::move(selectorList) )).storedValue->value.get(); 587 return m_entries.add(selectors, SelectorQuery::adopt(std::move(selectorList) )).storedValue->value.get();
589 } 588 }
590 589
591 void SelectorQueryCache::invalidate() 590 void SelectorQueryCache::invalidate()
592 { 591 {
593 m_entries.clear(); 592 m_entries.clear();
594 } 593 }
595 594
596 } // namespace blink 595 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698