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

Side by Side Diff: third_party/WebKit/Source/core/css/RuleSet.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r ights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 , m_containsUncommonAttributeSelector(blink::containsUncommonAttributeSelect or(selector())) 113 , m_containsUncommonAttributeSelector(blink::containsUncommonAttributeSelect or(selector()))
114 , m_linkMatchType(selector().computeLinkMatchType()) 114 , m_linkMatchType(selector().computeLinkMatchType())
115 , m_hasDocumentSecurityOrigin(addRuleFlags & RuleHasDocumentSecurityOrigin) 115 , m_hasDocumentSecurityOrigin(addRuleFlags & RuleHasDocumentSecurityOrigin)
116 , m_propertyWhitelistType(determinePropertyWhitelistType(addRuleFlags, selec tor())) 116 , m_propertyWhitelistType(determinePropertyWhitelistType(addRuleFlags, selec tor()))
117 { 117 {
118 SelectorFilter::collectIdentifierHashes(selector(), m_descendantSelectorIden tifierHashes, maximumIdentifierCount); 118 SelectorFilter::collectIdentifierHashes(selector(), m_descendantSelectorIden tifierHashes, maximumIdentifierCount);
119 } 119 }
120 120
121 void RuleSet::addToRuleSet(const AtomicString& key, PendingRuleMap& map, const R uleData& ruleData) 121 void RuleSet::addToRuleSet(const AtomicString& key, PendingRuleMap& map, const R uleData& ruleData)
122 { 122 {
123 OwnPtrWillBeMember<WillBeHeapLinkedStack<RuleData>>& rules = map.add(key, nu llptr).storedValue->value; 123 Member<HeapLinkedStack<RuleData>>& rules = map.add(key, nullptr).storedValue ->value;
124 if (!rules) 124 if (!rules)
125 rules = adoptPtrWillBeNoop(new WillBeHeapLinkedStack<RuleData>); 125 rules = (new HeapLinkedStack<RuleData>);
126 rules->push(ruleData); 126 rules->push(ruleData);
127 } 127 }
128 128
129 static void extractValuesforSelector(const CSSSelector* selector, AtomicString& id, AtomicString& className, AtomicString& customPseudoElementName, AtomicString & tagName) 129 static void extractValuesforSelector(const CSSSelector* selector, AtomicString& id, AtomicString& className, AtomicString& customPseudoElementName, AtomicString & tagName)
130 { 130 {
131 switch (selector->match()) { 131 switch (selector->match()) {
132 case CSSSelector::Id: 132 case CSSSelector::Id:
133 id = selector->value(); 133 id = selector->value();
134 break; 134 break;
135 case CSSSelector::Class: 135 case CSSSelector::Class:
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 ensurePendingRules(); // So that m_fontFaceRules.shrinkToFit() gets called. 241 ensurePendingRules(); // So that m_fontFaceRules.shrinkToFit() gets called.
242 m_fontFaceRules.append(rule); 242 m_fontFaceRules.append(rule);
243 } 243 }
244 244
245 void RuleSet::addKeyframesRule(StyleRuleKeyframes* rule) 245 void RuleSet::addKeyframesRule(StyleRuleKeyframes* rule)
246 { 246 {
247 ensurePendingRules(); // So that m_keyframesRules.shrinkToFit() gets called. 247 ensurePendingRules(); // So that m_keyframesRules.shrinkToFit() gets called.
248 m_keyframesRules.append(rule); 248 m_keyframesRules.append(rule);
249 } 249 }
250 250
251 void RuleSet::addChildRules(const WillBeHeapVector<RefPtrWillBeMember<StyleRuleB ase>>& rules, const MediaQueryEvaluator& medium, AddRuleFlags addRuleFlags) 251 void RuleSet::addChildRules(const HeapVector<Member<StyleRuleBase>>& rules, cons t MediaQueryEvaluator& medium, AddRuleFlags addRuleFlags)
252 { 252 {
253 for (unsigned i = 0; i < rules.size(); ++i) { 253 for (unsigned i = 0; i < rules.size(); ++i) {
254 StyleRuleBase* rule = rules[i].get(); 254 StyleRuleBase* rule = rules[i].get();
255 255
256 if (rule->isStyleRule()) { 256 if (rule->isStyleRule()) {
257 StyleRule* styleRule = toStyleRule(rule); 257 StyleRule* styleRule = toStyleRule(rule);
258 258
259 const CSSSelectorList& selectorList = styleRule->selectorList(); 259 const CSSSelectorList& selectorList = styleRule->selectorList();
260 for (size_t selectorIndex = 0; selectorIndex != kNotFound; selectorI ndex = selectorList.indexOfNextSelectorAfter(selectorIndex)) { 260 for (size_t selectorIndex = 0; selectorIndex != kNotFound; selectorI ndex = selectorList.indexOfNextSelectorAfter(selectorIndex)) {
261 if (selectorList.selectorUsesDeepCombinatorOrShadowPseudo(select orIndex)) { 261 if (selectorList.selectorUsesDeepCombinatorOrShadowPseudo(select orIndex)) {
(...skipping 23 matching lines...) Expand all
285 } 285 }
286 } 286 }
287 } 287 }
288 288
289 void RuleSet::addRulesFromSheet(StyleSheetContents* sheet, const MediaQueryEvalu ator& medium, AddRuleFlags addRuleFlags) 289 void RuleSet::addRulesFromSheet(StyleSheetContents* sheet, const MediaQueryEvalu ator& medium, AddRuleFlags addRuleFlags)
290 { 290 {
291 TRACE_EVENT0("blink", "RuleSet::addRulesFromSheet"); 291 TRACE_EVENT0("blink", "RuleSet::addRulesFromSheet");
292 292
293 ASSERT(sheet); 293 ASSERT(sheet);
294 294
295 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleImport>>& importRules = s heet->importRules(); 295 const HeapVector<Member<StyleRuleImport>>& importRules = sheet->importRules( );
296 for (unsigned i = 0; i < importRules.size(); ++i) { 296 for (unsigned i = 0; i < importRules.size(); ++i) {
297 StyleRuleImport* importRule = importRules[i].get(); 297 StyleRuleImport* importRule = importRules[i].get();
298 if (importRule->styleSheet() && (!importRule->mediaQueries() || medium.e val(importRule->mediaQueries(), &m_viewportDependentMediaQueryResults, &m_device DependentMediaQueryResults))) 298 if (importRule->styleSheet() && (!importRule->mediaQueries() || medium.e val(importRule->mediaQueries(), &m_viewportDependentMediaQueryResults, &m_device DependentMediaQueryResults)))
299 addRulesFromSheet(importRule->styleSheet(), medium, addRuleFlags); 299 addRulesFromSheet(importRule->styleSheet(), medium, addRuleFlags);
300 } 300 }
301 301
302 addChildRules(sheet->childRules(), medium, addRuleFlags); 302 addChildRules(sheet->childRules(), medium, addRuleFlags);
303 } 303 }
304 304
305 void RuleSet::addStyleRule(StyleRule* rule, AddRuleFlags addRuleFlags) 305 void RuleSet::addStyleRule(StyleRule* rule, AddRuleFlags addRuleFlags)
306 { 306 {
307 for (size_t selectorIndex = 0; selectorIndex != kNotFound; selectorIndex = r ule->selectorList().indexOfNextSelectorAfter(selectorIndex)) 307 for (size_t selectorIndex = 0; selectorIndex != kNotFound; selectorIndex = r ule->selectorList().indexOfNextSelectorAfter(selectorIndex))
308 addRule(rule, selectorIndex, addRuleFlags); 308 addRule(rule, selectorIndex, addRuleFlags);
309 } 309 }
310 310
311 void RuleSet::compactPendingRules(PendingRuleMap& pendingMap, CompactRuleMap& co mpactMap) 311 void RuleSet::compactPendingRules(PendingRuleMap& pendingMap, CompactRuleMap& co mpactMap)
312 { 312 {
313 for (auto& item : pendingMap) { 313 for (auto& item : pendingMap) {
314 OwnPtrWillBeRawPtr<WillBeHeapLinkedStack<RuleData>> pendingRules = item. value.release(); 314 RawPtr<HeapLinkedStack<RuleData>> pendingRules = item.value.release();
315 CompactRuleMap::ValueType* compactRules = compactMap.add(item.key, nullp tr).storedValue; 315 CompactRuleMap::ValueType* compactRules = compactMap.add(item.key, nullp tr).storedValue;
316 316
317 WillBeHeapTerminatedArrayBuilder<RuleData> builder(compactRules->value.r elease()); 317 HeapTerminatedArrayBuilder<RuleData> builder(compactRules->value.release ());
318 builder.grow(pendingRules->size()); 318 builder.grow(pendingRules->size());
319 while (!pendingRules->isEmpty()) { 319 while (!pendingRules->isEmpty()) {
320 builder.append(pendingRules->peek()); 320 builder.append(pendingRules->peek());
321 pendingRules->pop(); 321 pendingRules->pop();
322 } 322 }
323 323
324 compactRules->value = builder.release(); 324 compactRules->value = builder.release();
325 } 325 }
326 } 326 }
327 327
328 void RuleSet::compactRules() 328 void RuleSet::compactRules()
329 { 329 {
330 ASSERT(m_pendingRules); 330 ASSERT(m_pendingRules);
331 OwnPtrWillBeRawPtr<PendingRuleMaps> pendingRules = m_pendingRules.release(); 331 RawPtr<PendingRuleMaps> pendingRules = m_pendingRules.release();
332 compactPendingRules(pendingRules->idRules, m_idRules); 332 compactPendingRules(pendingRules->idRules, m_idRules);
333 compactPendingRules(pendingRules->classRules, m_classRules); 333 compactPendingRules(pendingRules->classRules, m_classRules);
334 compactPendingRules(pendingRules->tagRules, m_tagRules); 334 compactPendingRules(pendingRules->tagRules, m_tagRules);
335 compactPendingRules(pendingRules->shadowPseudoElementRules, m_shadowPseudoEl ementRules); 335 compactPendingRules(pendingRules->shadowPseudoElementRules, m_shadowPseudoEl ementRules);
336 m_linkPseudoClassRules.shrinkToFit(); 336 m_linkPseudoClassRules.shrinkToFit();
337 m_cuePseudoRules.shrinkToFit(); 337 m_cuePseudoRules.shrinkToFit();
338 m_focusPseudoClassRules.shrinkToFit(); 338 m_focusPseudoClassRules.shrinkToFit();
339 m_universalRules.shrinkToFit(); 339 m_universalRules.shrinkToFit();
340 m_shadowHostRules.shrinkToFit(); 340 m_shadowHostRules.shrinkToFit();
341 m_pageRules.shrinkToFit(); 341 m_pageRules.shrinkToFit();
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 398
399 #ifndef NDEBUG 399 #ifndef NDEBUG
400 void RuleSet::show() const 400 void RuleSet::show() const
401 { 401 {
402 for (const auto& rule: m_allRules) 402 for (const auto& rule: m_allRules)
403 rule.selector().show(); 403 rule.selector().show();
404 } 404 }
405 #endif 405 #endif
406 406
407 } // namespace blink 407 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698