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.cpp

Issue 2306903002: Fix the wrong usages of CSSSelectorList::selectorUsesXXX() functions (Closed)
Patch Set: Add a test 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 unsigned index = 0;
kochi 2016/09/02 06:52:52 You no longer need this index.
hayato 2016/09/02 07:11:29 Done
117 for (const CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(*selector), ++index) { 117 for (const CSSSelector* selector = selectorList.first(); selector; selector = CSSSelectorList::next(*selector), ++index) {
kochi 2016/09/02 06:52:52 Remove '++index'
hayato 2016/09/02 07:11:29 Done
118 if (selector->matchesPseudoElement()) 118 if (selector->matchesPseudoElement())
119 continue; 119 continue;
120 m_selectors.uncheckedAppend(selector); 120 m_selectors.uncheckedAppend(selector);
121 m_usesDeepCombinatorOrShadowPseudo |= selectorList.selectorUsesDeepCombi natorOrShadowPseudo(index); 121 m_usesDeepCombinatorOrShadowPseudo |= selector->hasDeepCombinatorOrShado wPseudo();
122 m_needsUpdatedDistribution |= selectorList.selectorNeedsUpdatedDistribut ion(index); 122 m_needsUpdatedDistribution |= selector->needsUpdatedDistribution();
123 } 123 }
124 } 124 }
125 125
126 inline bool SelectorDataList::selectorMatches(const CSSSelector& selector, Eleme nt& element, const ContainerNode& rootNode) const 126 inline bool SelectorDataList::selectorMatches(const CSSSelector& selector, Eleme nt& element, const ContainerNode& rootNode) const
127 { 127 {
128 SelectorChecker::Init init; 128 SelectorChecker::Init init;
129 init.mode = SelectorChecker::QueryingRules; 129 init.mode = SelectorChecker::QueryingRules;
130 init.isQuerySelector = true; 130 init.isQuerySelector = true;
131 SelectorChecker checker(init); 131 SelectorChecker checker(init);
132 SelectorChecker::SelectorCheckingContext context(&element, SelectorChecker:: VisitedMatchDisabled); 132 SelectorChecker::SelectorCheckingContext context(&element, SelectorChecker:: VisitedMatchDisabled);
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 587
588 return m_entries.add(selectors, SelectorQuery::adopt(std::move(selectorList) )).storedValue->value.get(); 588 return m_entries.add(selectors, SelectorQuery::adopt(std::move(selectorList) )).storedValue->value.get();
589 } 589 }
590 590
591 void SelectorQueryCache::invalidate() 591 void SelectorQueryCache::invalidate()
592 { 592 {
593 m_entries.clear(); 593 m_entries.clear();
594 } 594 }
595 595
596 } // namespace blink 596 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698