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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 m_result.ranges.lastAuthorRule = m_result.matchedProperties.size(); | 93 m_result.ranges.lastAuthorRule = m_result.matchedProperties.size(); |
94 if (m_result.ranges.firstAuthorRule == -1) | 94 if (m_result.ranges.firstAuthorRule == -1) |
95 m_result.ranges.firstAuthorRule = m_result.ranges.lastAuthorRule; | 95 m_result.ranges.firstAuthorRule = m_result.ranges.lastAuthorRule; |
96 m_result.addMatchedProperties(propertySet); | 96 m_result.addMatchedProperties(propertySet); |
97 if (!isCacheable) | 97 if (!isCacheable) |
98 m_result.isCacheable = false; | 98 m_result.isCacheable = false; |
99 } | 99 } |
100 | 100 |
101 static bool rulesApplicableInCurrentTreeScope(const Element* element, const Cont
ainerNode* scopingNode, SelectorChecker::BehaviorAtBoundary behaviorAtBoundary,
bool elementApplyAuthorStyles) | 101 static bool rulesApplicableInCurrentTreeScope(const Element* element, const Cont
ainerNode* scopingNode, SelectorChecker::BehaviorAtBoundary behaviorAtBoundary,
bool elementApplyAuthorStyles) |
102 { | 102 { |
103 TreeScope& treeScope = element->treeScope(); | 103 NonNullPtr<TreeScope> treeScope = element->treeScope(); |
104 | 104 |
105 // [skipped, because already checked] a) it's a UA rule | 105 // [skipped, because already checked] a) it's a UA rule |
106 // b) element is allowed to apply author rules | 106 // b) element is allowed to apply author rules |
107 if (elementApplyAuthorStyles) | 107 if (elementApplyAuthorStyles) |
108 return true; | 108 return true; |
109 // c) the rules comes from a scoped style sheet within the same tree scope | 109 // c) the rules comes from a scoped style sheet within the same tree scope |
110 if (!scopingNode || &treeScope == &scopingNode->treeScope()) | 110 if (!scopingNode || treeScope == scopingNode->treeScope()) |
111 return true; | 111 return true; |
112 // d) the rules comes from a scoped style sheet within an active shadow root
whose host is the given element | 112 // d) the rules comes from a scoped style sheet within an active shadow root
whose host is the given element |
113 if (element->isInShadowTree() && (behaviorAtBoundary & SelectorChecker::Scop
eIsShadowHost) && scopingNode == element->containingShadowRoot()->host()) | 113 if (element->isInShadowTree() && (behaviorAtBoundary & SelectorChecker::Scop
eIsShadowHost) && scopingNode == element->containingShadowRoot()->host()) |
114 return true; | 114 return true; |
115 // e) the rules can cross boundaries | 115 // e) the rules can cross boundaries |
116 if ((behaviorAtBoundary & SelectorChecker::BoundaryBehaviorMask) == Selector
Checker::CrossesBoundary) | 116 if ((behaviorAtBoundary & SelectorChecker::BoundaryBehaviorMask) == Selector
Checker::CrossesBoundary) |
117 return true; | 117 return true; |
118 return false; | 118 return false; |
119 } | 119 } |
120 | 120 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 m_behaviorAtBoundary = SelectorChecker::StaysWithinTreeScope; | 317 m_behaviorAtBoundary = SelectorChecker::StaysWithinTreeScope; |
318 int firstRuleIndex = -1, lastRuleIndex = -1; | 318 int firstRuleIndex = -1, lastRuleIndex = -1; |
319 RuleRange ruleRange(firstRuleIndex, lastRuleIndex); | 319 RuleRange ruleRange(firstRuleIndex, lastRuleIndex); |
320 // FIXME: Verify whether it's ok to ignore CascadeScope here. | 320 // FIXME: Verify whether it's ok to ignore CascadeScope here. |
321 collectMatchingRules(MatchRequest(ruleSet), ruleRange); | 321 collectMatchingRules(MatchRequest(ruleSet), ruleRange); |
322 | 322 |
323 return m_matchedRules && !m_matchedRules->isEmpty(); | 323 return m_matchedRules && !m_matchedRules->isEmpty(); |
324 } | 324 } |
325 | 325 |
326 } // namespace WebCore | 326 } // namespace WebCore |
OLD | NEW |