| 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 24 matching lines...) Expand all Loading... |
| 35 #include "core/css/CSSRuleList.h" | 35 #include "core/css/CSSRuleList.h" |
| 36 #include "core/css/CSSSelector.h" | 36 #include "core/css/CSSSelector.h" |
| 37 #include "core/css/CSSStyleRule.h" | 37 #include "core/css/CSSStyleRule.h" |
| 38 #include "core/css/CSSStyleSheet.h" | 38 #include "core/css/CSSStyleSheet.h" |
| 39 #include "core/css/CSSSupportsRule.h" | 39 #include "core/css/CSSSupportsRule.h" |
| 40 #include "core/css/SelectorCheckerFastPath.h" | 40 #include "core/css/SelectorCheckerFastPath.h" |
| 41 #include "core/css/SiblingTraversalStrategies.h" | 41 #include "core/css/SiblingTraversalStrategies.h" |
| 42 #include "core/css/StylePropertySet.h" | 42 #include "core/css/StylePropertySet.h" |
| 43 #include "core/css/resolver/StyleResolver.h" | 43 #include "core/css/resolver/StyleResolver.h" |
| 44 #include "core/dom/shadow/ShadowRoot.h" | 44 #include "core/dom/shadow/ShadowRoot.h" |
| 45 #include "core/rendering/RenderRegion.h" | |
| 46 | 45 |
| 47 namespace WebCore { | 46 namespace WebCore { |
| 48 | 47 |
| 49 ElementRuleCollector::ElementRuleCollector(const ElementResolveContext& context, | 48 ElementRuleCollector::ElementRuleCollector(const ElementResolveContext& context, |
| 50 const SelectorFilter& filter, RenderStyle* style) | 49 const SelectorFilter& filter, RenderStyle* style) |
| 51 : m_context(context) | 50 : m_context(context) |
| 52 , m_selectorFilter(filter) | 51 , m_selectorFilter(filter) |
| 53 , m_style(style) | 52 , m_style(style) |
| 54 , m_regionForStyling(0) | |
| 55 , m_pseudoStyleRequest(NOPSEUDO) | 53 , m_pseudoStyleRequest(NOPSEUDO) |
| 56 , m_mode(SelectorChecker::ResolvingStyle) | 54 , m_mode(SelectorChecker::ResolvingStyle) |
| 57 , m_canUseFastReject(m_selectorFilter.parentStackIsConsistent(context.parent
Node())) | 55 , m_canUseFastReject(m_selectorFilter.parentStackIsConsistent(context.parent
Node())) |
| 58 , m_sameOriginOnly(false) | 56 , m_sameOriginOnly(false) |
| 59 , m_matchingUARules(false) | 57 , m_matchingUARules(false) |
| 60 { } | 58 { } |
| 61 | 59 |
| 62 ElementRuleCollector::~ElementRuleCollector() | 60 ElementRuleCollector::~ElementRuleCollector() |
| 63 { | 61 { |
| 64 } | 62 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 169 } |
| 172 | 170 |
| 173 if (element.isLink()) | 171 if (element.isLink()) |
| 174 collectMatchingRulesForList(matchRequest.ruleSet->linkPseudoClassRules()
, behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange); | 172 collectMatchingRulesForList(matchRequest.ruleSet->linkPseudoClassRules()
, behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange); |
| 175 if (SelectorChecker::matchesFocusPseudoClass(element)) | 173 if (SelectorChecker::matchesFocusPseudoClass(element)) |
| 176 collectMatchingRulesForList(matchRequest.ruleSet->focusPseudoClassRules(
), behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange); | 174 collectMatchingRulesForList(matchRequest.ruleSet->focusPseudoClassRules(
), behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange); |
| 177 collectMatchingRulesForList(matchRequest.ruleSet->tagRules(element.localName
()), behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange); | 175 collectMatchingRulesForList(matchRequest.ruleSet->tagRules(element.localName
()), behaviorAtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange); |
| 178 collectMatchingRulesForList(matchRequest.ruleSet->universalRules(), behavior
AtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange); | 176 collectMatchingRulesForList(matchRequest.ruleSet->universalRules(), behavior
AtBoundary, cascadeScope, cascadeOrder, matchRequest, ruleRange); |
| 179 } | 177 } |
| 180 | 178 |
| 181 void ElementRuleCollector::collectMatchingRulesForRegion(const MatchRequest& mat
chRequest, RuleRange& ruleRange, SelectorChecker::BehaviorAtBoundary behaviorAtB
oundary, CascadeScope cascadeScope, CascadeOrder cascadeOrder) | |
| 182 { | |
| 183 if (!m_regionForStyling) | |
| 184 return; | |
| 185 | |
| 186 unsigned size = matchRequest.ruleSet->m_regionSelectorsAndRuleSets.size(); | |
| 187 for (unsigned i = 0; i < size; ++i) { | |
| 188 const CSSSelector* regionSelector = matchRequest.ruleSet->m_regionSelect
orsAndRuleSets.at(i).selector; | |
| 189 if (checkRegionSelector(regionSelector, toElement(m_regionForStyling->no
deForRegion()))) { | |
| 190 RuleSet* regionRules = matchRequest.ruleSet->m_regionSelectorsAndRul
eSets.at(i).ruleSet.get(); | |
| 191 ASSERT(regionRules); | |
| 192 collectMatchingRules(MatchRequest(regionRules, matchRequest.includeE
mptyRules, matchRequest.scope), ruleRange, behaviorAtBoundary, cascadeScope, cas
cadeOrder); | |
| 193 } | |
| 194 } | |
| 195 } | |
| 196 | |
| 197 CSSRuleList* ElementRuleCollector::nestedRuleList(CSSRule* rule) | 179 CSSRuleList* ElementRuleCollector::nestedRuleList(CSSRule* rule) |
| 198 { | 180 { |
| 199 switch (rule->type()) { | 181 switch (rule->type()) { |
| 200 case CSSRule::MEDIA_RULE: | 182 case CSSRule::MEDIA_RULE: |
| 201 return toCSSMediaRule(rule)->cssRules(); | 183 return toCSSMediaRule(rule)->cssRules(); |
| 202 case CSSRule::KEYFRAMES_RULE: | 184 case CSSRule::KEYFRAMES_RULE: |
| 203 return toCSSKeyframesRule(rule)->cssRules(); | 185 return toCSSKeyframesRule(rule)->cssRules(); |
| 204 case CSSRule::SUPPORTS_RULE: | 186 case CSSRule::SUPPORTS_RULE: |
| 205 return toCSSSupportsRule(rule)->cssRules(); | 187 return toCSSSupportsRule(rule)->cssRules(); |
| 206 default: | 188 default: |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 // information about "scope". | 379 // information about "scope". |
| 398 int firstRuleIndex = -1, lastRuleIndex = -1; | 380 int firstRuleIndex = -1, lastRuleIndex = -1; |
| 399 RuleRange ruleRange(firstRuleIndex, lastRuleIndex); | 381 RuleRange ruleRange(firstRuleIndex, lastRuleIndex); |
| 400 // FIXME: Verify whether it's ok to ignore CascadeScope here. | 382 // FIXME: Verify whether it's ok to ignore CascadeScope here. |
| 401 collectMatchingRules(MatchRequest(ruleSet), ruleRange, SelectorChecker::Stay
sWithinTreeScope); | 383 collectMatchingRules(MatchRequest(ruleSet), ruleRange, SelectorChecker::Stay
sWithinTreeScope); |
| 402 | 384 |
| 403 return m_matchedRules && !m_matchedRules->isEmpty(); | 385 return m_matchedRules && !m_matchedRules->isEmpty(); |
| 404 } | 386 } |
| 405 | 387 |
| 406 } // namespace WebCore | 388 } // namespace WebCore |
| OLD | NEW |