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, 2013 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc.
All rights 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 m_cssRuleList = StaticCSSRuleList::create(); | 103 m_cssRuleList = StaticCSSRuleList::create(); |
104 return m_cssRuleList.get(); | 104 return m_cssRuleList.get(); |
105 } | 105 } |
106 | 106 |
107 void ElementRuleCollector::addElementStyleProperties(const StylePropertySet* pro
pertySet, bool isCacheable) | 107 void ElementRuleCollector::addElementStyleProperties(const StylePropertySet* pro
pertySet, bool isCacheable) |
108 { | 108 { |
109 if (!propertySet) | 109 if (!propertySet) |
110 return; | 110 return; |
111 m_result.addMatchedProperties(propertySet); | 111 m_result.addMatchedProperties(propertySet); |
112 if (!isCacheable) | 112 if (!isCacheable) |
113 m_result.setIsCacheable(false); | 113 m_result.isCacheable = false; |
114 } | 114 } |
115 | 115 |
116 static bool rulesApplicableInCurrentTreeScope(const Element* element, const Cont
ainerNode* scopingNode, bool matchingTreeBoundaryRules) | 116 static bool rulesApplicableInCurrentTreeScope(const Element* element, const Cont
ainerNode* scopingNode, bool matchingTreeBoundaryRules) |
117 { | 117 { |
118 // [skipped, because already checked] a) it's a UA rule | 118 // [skipped, because already checked] a) it's a UA rule |
119 // b) We're mathcing tree boundary rules. | 119 // b) We're mathcing tree boundary rules. |
120 if (matchingTreeBoundaryRules) | 120 if (matchingTreeBoundaryRules) |
121 return true; | 121 return true; |
122 // c) the rules comes from a scoped style sheet within the same tree scope | 122 // c) the rules comes from a scoped style sheet within the same tree scope |
123 if (!scopingNode || element->treeScope() == scopingNode->treeScope()) | 123 if (!scopingNode || element->treeScope() == scopingNode->treeScope()) |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 for (unsigned i = 0; i < m_matchedRules.size(); ++i) | 286 for (unsigned i = 0; i < m_matchedRules.size(); ++i) |
287 appendCSSOMWrapperForRule(const_cast<CSSStyleSheet*>(m_matchedRules[
i].parentStyleSheet()), m_matchedRules[i].ruleData()->rule()); | 287 appendCSSOMWrapperForRule(const_cast<CSSStyleSheet*>(m_matchedRules[
i].parentStyleSheet()), m_matchedRules[i].ruleData()->rule()); |
288 return; | 288 return; |
289 } | 289 } |
290 | 290 |
291 // Now transfer the set of matched rules over to our list of declarations. | 291 // Now transfer the set of matched rules over to our list of declarations. |
292 for (unsigned i = 0; i < m_matchedRules.size(); i++) { | 292 for (unsigned i = 0; i < m_matchedRules.size(); i++) { |
293 const RuleData* ruleData = m_matchedRules[i].ruleData(); | 293 const RuleData* ruleData = m_matchedRules[i].ruleData(); |
294 m_result.addMatchedProperties(&ruleData->rule()->properties(), ruleData-
>linkMatchType(), ruleData->propertyWhitelistType(m_matchingUARules)); | 294 m_result.addMatchedProperties(&ruleData->rule()->properties(), ruleData-
>linkMatchType(), ruleData->propertyWhitelistType(m_matchingUARules)); |
295 } | 295 } |
| 296 |
| 297 if (m_matchingUARules) |
| 298 m_result.uaEnd = m_result.matchedProperties.size(); |
296 } | 299 } |
297 | 300 |
298 void ElementRuleCollector::didMatchRule(const RuleData& ruleData, const Selector
Checker::MatchResult& result, CascadeOrder cascadeOrder, const MatchRequest& mat
chRequest) | 301 void ElementRuleCollector::didMatchRule(const RuleData& ruleData, const Selector
Checker::MatchResult& result, CascadeOrder cascadeOrder, const MatchRequest& mat
chRequest) |
299 { | 302 { |
300 PseudoId dynamicPseudo = result.dynamicPseudo; | 303 PseudoId dynamicPseudo = result.dynamicPseudo; |
301 // If we're matching normal rules, set a pseudo bit if | 304 // If we're matching normal rules, set a pseudo bit if |
302 // we really just matched a pseudo-element. | 305 // we really just matched a pseudo-element. |
303 if (dynamicPseudo != NOPSEUDO && m_pseudoStyleRequest.pseudoId == NOPSEUDO)
{ | 306 if (dynamicPseudo != NOPSEUDO && m_pseudoStyleRequest.pseudoId == NOPSEUDO)
{ |
304 if (m_mode == SelectorChecker::CollectingCSSRules || m_mode == SelectorC
hecker::CollectingStyleRules) | 307 if (m_mode == SelectorChecker::CollectingCSSRules || m_mode == SelectorC
hecker::CollectingStyleRules) |
305 return; | 308 return; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 // should not see the element's treescope. Because RuleSet has no | 344 // should not see the element's treescope. Because RuleSet has no |
342 // information about "scope". | 345 // information about "scope". |
343 MatchRequest matchRequest(ruleSet); | 346 MatchRequest matchRequest(ruleSet); |
344 collectMatchingRules(matchRequest); | 347 collectMatchingRules(matchRequest); |
345 collectMatchingShadowHostRules(matchRequest); | 348 collectMatchingShadowHostRules(matchRequest); |
346 | 349 |
347 return !m_matchedRules.isEmpty(); | 350 return !m_matchedRules.isEmpty(); |
348 } | 351 } |
349 | 352 |
350 } // namespace blink | 353 } // namespace blink |
OLD | NEW |