OLD | NEW |
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 , m_hasDocumentSecurityOrigin(addRuleFlags & RuleHasDocumentSecurityOrigin) | 117 , m_hasDocumentSecurityOrigin(addRuleFlags & RuleHasDocumentSecurityOrigin) |
118 , m_propertyWhitelistType(determinePropertyWhitelistType(addRuleFlags, selec
tor())) | 118 , m_propertyWhitelistType(determinePropertyWhitelistType(addRuleFlags, selec
tor())) |
119 { | 119 { |
120 ASSERT(m_position == position); | 120 ASSERT(m_position == position); |
121 ASSERT(m_selectorIndex == selectorIndex); | 121 ASSERT(m_selectorIndex == selectorIndex); |
122 SelectorFilter::collectIdentifierHashes(selector(), m_descendantSelectorIden
tifierHashes, maximumIdentifierCount); | 122 SelectorFilter::collectIdentifierHashes(selector(), m_descendantSelectorIden
tifierHashes, maximumIdentifierCount); |
123 } | 123 } |
124 | 124 |
125 void RuleSet::addToRuleSet(const AtomicString& key, PendingRuleMap& map, const R
uleData& ruleData) | 125 void RuleSet::addToRuleSet(const AtomicString& key, PendingRuleMap& map, const R
uleData& ruleData) |
126 { | 126 { |
127 OwnPtrWillBeMember<WillBeHeapLinkedStack<RuleData> >& rules = map.add(key, n
ullptr).storedValue->value; | 127 OwnPtrWillBeMember<WillBeHeapLinkedStack<RuleData>>& rules = map.add(key, nu
llptr).storedValue->value; |
128 if (!rules) | 128 if (!rules) |
129 rules = adoptPtrWillBeNoop(new WillBeHeapLinkedStack<RuleData>); | 129 rules = adoptPtrWillBeNoop(new WillBeHeapLinkedStack<RuleData>); |
130 rules->push(ruleData); | 130 rules->push(ruleData); |
131 } | 131 } |
132 | 132 |
133 static void extractValuesforSelector(const CSSSelector* selector, AtomicString&
id, AtomicString& className, AtomicString& customPseudoElementName, AtomicString
& tagName) | 133 static void extractValuesforSelector(const CSSSelector* selector, AtomicString&
id, AtomicString& className, AtomicString& customPseudoElementName, AtomicString
& tagName) |
134 { | 134 { |
135 switch (selector->match()) { | 135 switch (selector->match()) { |
136 case CSSSelector::Id: | 136 case CSSSelector::Id: |
137 id = selector->value(); | 137 id = selector->value(); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 ensurePendingRules(); // So that m_fontFaceRules.shrinkToFit() gets called. | 246 ensurePendingRules(); // So that m_fontFaceRules.shrinkToFit() gets called. |
247 m_fontFaceRules.append(rule); | 247 m_fontFaceRules.append(rule); |
248 } | 248 } |
249 | 249 |
250 void RuleSet::addKeyframesRule(StyleRuleKeyframes* rule) | 250 void RuleSet::addKeyframesRule(StyleRuleKeyframes* rule) |
251 { | 251 { |
252 ensurePendingRules(); // So that m_keyframesRules.shrinkToFit() gets called. | 252 ensurePendingRules(); // So that m_keyframesRules.shrinkToFit() gets called. |
253 m_keyframesRules.append(rule); | 253 m_keyframesRules.append(rule); |
254 } | 254 } |
255 | 255 |
256 void RuleSet::addChildRules(const WillBeHeapVector<RefPtrWillBeMember<StyleRuleB
ase> >& rules, const MediaQueryEvaluator& medium, AddRuleFlags addRuleFlags) | 256 void RuleSet::addChildRules(const WillBeHeapVector<RefPtrWillBeMember<StyleRuleB
ase>>& rules, const MediaQueryEvaluator& medium, AddRuleFlags addRuleFlags) |
257 { | 257 { |
258 for (unsigned i = 0; i < rules.size(); ++i) { | 258 for (unsigned i = 0; i < rules.size(); ++i) { |
259 StyleRuleBase* rule = rules[i].get(); | 259 StyleRuleBase* rule = rules[i].get(); |
260 | 260 |
261 if (rule->isStyleRule()) { | 261 if (rule->isStyleRule()) { |
262 StyleRule* styleRule = toStyleRule(rule); | 262 StyleRule* styleRule = toStyleRule(rule); |
263 | 263 |
264 const CSSSelectorList& selectorList = styleRule->selectorList(); | 264 const CSSSelectorList& selectorList = styleRule->selectorList(); |
265 for (size_t selectorIndex = 0; selectorIndex != kNotFound; selectorI
ndex = selectorList.indexOfNextSelectorAfter(selectorIndex)) { | 265 for (size_t selectorIndex = 0; selectorIndex != kNotFound; selectorI
ndex = selectorList.indexOfNextSelectorAfter(selectorIndex)) { |
266 if (selectorList.selectorCrossesTreeScopes(selectorIndex)) { | 266 if (selectorList.selectorCrossesTreeScopes(selectorIndex)) { |
(...skipping 21 matching lines...) Expand all Loading... |
288 } | 288 } |
289 } | 289 } |
290 } | 290 } |
291 | 291 |
292 void RuleSet::addRulesFromSheet(StyleSheetContents* sheet, const MediaQueryEvalu
ator& medium, AddRuleFlags addRuleFlags) | 292 void RuleSet::addRulesFromSheet(StyleSheetContents* sheet, const MediaQueryEvalu
ator& medium, AddRuleFlags addRuleFlags) |
293 { | 293 { |
294 TRACE_EVENT0("blink", "RuleSet::addRulesFromSheet"); | 294 TRACE_EVENT0("blink", "RuleSet::addRulesFromSheet"); |
295 | 295 |
296 ASSERT(sheet); | 296 ASSERT(sheet); |
297 | 297 |
298 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleImport> >& importRules =
sheet->importRules(); | 298 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleImport>>& importRules = s
heet->importRules(); |
299 for (unsigned i = 0; i < importRules.size(); ++i) { | 299 for (unsigned i = 0; i < importRules.size(); ++i) { |
300 StyleRuleImport* importRule = importRules[i].get(); | 300 StyleRuleImport* importRule = importRules[i].get(); |
301 if (importRule->styleSheet() && (!importRule->mediaQueries() || medium.e
val(importRule->mediaQueries(), &m_viewportDependentMediaQueryResults))) | 301 if (importRule->styleSheet() && (!importRule->mediaQueries() || medium.e
val(importRule->mediaQueries(), &m_viewportDependentMediaQueryResults))) |
302 addRulesFromSheet(importRule->styleSheet(), medium, addRuleFlags); | 302 addRulesFromSheet(importRule->styleSheet(), medium, addRuleFlags); |
303 } | 303 } |
304 | 304 |
305 addChildRules(sheet->childRules(), medium, addRuleFlags); | 305 addChildRules(sheet->childRules(), medium, addRuleFlags); |
306 } | 306 } |
307 | 307 |
308 void RuleSet::addStyleRule(StyleRule* rule, AddRuleFlags addRuleFlags) | 308 void RuleSet::addStyleRule(StyleRule* rule, AddRuleFlags addRuleFlags) |
309 { | 309 { |
310 for (size_t selectorIndex = 0; selectorIndex != kNotFound; selectorIndex = r
ule->selectorList().indexOfNextSelectorAfter(selectorIndex)) | 310 for (size_t selectorIndex = 0; selectorIndex != kNotFound; selectorIndex = r
ule->selectorList().indexOfNextSelectorAfter(selectorIndex)) |
311 addRule(rule, selectorIndex, addRuleFlags); | 311 addRule(rule, selectorIndex, addRuleFlags); |
312 } | 312 } |
313 | 313 |
314 void RuleSet::compactPendingRules(PendingRuleMap& pendingMap, CompactRuleMap& co
mpactMap) | 314 void RuleSet::compactPendingRules(PendingRuleMap& pendingMap, CompactRuleMap& co
mpactMap) |
315 { | 315 { |
316 for (auto& item : pendingMap) { | 316 for (auto& item : pendingMap) { |
317 OwnPtrWillBeRawPtr<WillBeHeapLinkedStack<RuleData> > pendingRules = item
.value.release(); | 317 OwnPtrWillBeRawPtr<WillBeHeapLinkedStack<RuleData>> pendingRules = item.
value.release(); |
318 CompactRuleMap::ValueType* compactRules = compactMap.add(item.key, nullp
tr).storedValue; | 318 CompactRuleMap::ValueType* compactRules = compactMap.add(item.key, nullp
tr).storedValue; |
319 | 319 |
320 WillBeHeapTerminatedArrayBuilder<RuleData> builder(compactRules->value.r
elease()); | 320 WillBeHeapTerminatedArrayBuilder<RuleData> builder(compactRules->value.r
elease()); |
321 builder.grow(pendingRules->size()); | 321 builder.grow(pendingRules->size()); |
322 while (!pendingRules->isEmpty()) { | 322 while (!pendingRules->isEmpty()) { |
323 builder.append(pendingRules->peek()); | 323 builder.append(pendingRules->peek()); |
324 pendingRules->pop(); | 324 pendingRules->pop(); |
325 } | 325 } |
326 | 326 |
327 compactRules->value = builder.release(); | 327 compactRules->value = builder.release(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 | 398 |
399 #ifndef NDEBUG | 399 #ifndef NDEBUG |
400 void RuleSet::show() | 400 void RuleSet::show() |
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 |
OLD | NEW |