OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 void setPseudoStyleRequest(const PseudoStyleRequest& request) { m_pseudoStyl
eRequest = request; } | 119 void setPseudoStyleRequest(const PseudoStyleRequest& request) { m_pseudoStyl
eRequest = request; } |
120 void setSameOriginOnly(bool f) { m_sameOriginOnly = f; } | 120 void setSameOriginOnly(bool f) { m_sameOriginOnly = f; } |
121 | 121 |
122 void setMatchingUARules(bool matchingUARules) { m_matchingUARules = matching
UARules; } | 122 void setMatchingUARules(bool matchingUARules) { m_matchingUARules = matching
UARules; } |
123 bool hasAnyMatchingRules(RuleSet*); | 123 bool hasAnyMatchingRules(RuleSet*); |
124 | 124 |
125 MatchResult& matchedResult(); | 125 MatchResult& matchedResult(); |
126 PassRefPtrWillBeRawPtr<StyleRuleList> matchedStyleRuleList(); | 126 PassRefPtrWillBeRawPtr<StyleRuleList> matchedStyleRuleList(); |
127 PassRefPtrWillBeRawPtr<CSSRuleList> matchedCSSRuleList(); | 127 PassRefPtrWillBeRawPtr<CSSRuleList> matchedCSSRuleList(); |
128 | 128 |
129 void collectMatchingRules(const MatchRequest&, RuleRange&, SelectorChecker::
BehaviorAtBoundary = SelectorChecker::DoesNotCrossBoundary, CascadeScope = ignor
eCascadeScope, CascadeOrder = ignoreCascadeOrder); | 129 void collectMatchingRules(const MatchRequest&, RuleRange&, SelectorChecker::
ContextFlags = SelectorChecker::DefaultBehavior, CascadeScope = ignoreCascadeSco
pe, CascadeOrder = ignoreCascadeOrder); |
130 void sortAndTransferMatchedRules(); | 130 void sortAndTransferMatchedRules(); |
131 void clearMatchedRules(); | 131 void clearMatchedRules(); |
132 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t
rue); | 132 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t
rue); |
133 | 133 |
134 unsigned lastMatchedRulesPosition() const { return m_matchedRules ? m_matche
dRules->size() : 0; } | 134 unsigned lastMatchedRulesPosition() const { return m_matchedRules ? m_matche
dRules->size() : 0; } |
135 void sortMatchedRulesFrom(unsigned position); | 135 void sortMatchedRulesFrom(unsigned position); |
136 void sortAndTransferMatchedRulesWithOnlySortBySpecificity(); | 136 void sortAndTransferMatchedRulesWithOnlySortBySpecificity(); |
137 | 137 |
138 private: | 138 private: |
139 void collectRuleIfMatches(const RuleData&, SelectorChecker::BehaviorAtBounda
ry, CascadeScope, CascadeOrder, const MatchRequest&, RuleRange&); | 139 void collectRuleIfMatches(const RuleData&, SelectorChecker::ContextFlags, Ca
scadeScope, CascadeOrder, const MatchRequest&, RuleRange&); |
140 | 140 |
141 template<typename RuleDataListType> | 141 template<typename RuleDataListType> |
142 void collectMatchingRulesForList(const RuleDataListType* rules, SelectorChec
ker::BehaviorAtBoundary behaviorAtBoundary, CascadeScope cascadeScope, CascadeOr
der cascadeOrder, const MatchRequest& matchRequest, RuleRange& ruleRange) | 142 void collectMatchingRulesForList(const RuleDataListType* rules, SelectorChec
ker::ContextFlags contextFlags, CascadeScope cascadeScope, CascadeOrder cascadeO
rder, const MatchRequest& matchRequest, RuleRange& ruleRange) |
143 { | 143 { |
144 if (!rules) | 144 if (!rules) |
145 return; | 145 return; |
146 | 146 |
147 for (typename RuleDataListType::const_iterator it = rules->begin(), end
= rules->end(); it != end; ++it) | 147 for (typename RuleDataListType::const_iterator it = rules->begin(), end
= rules->end(); it != end; ++it) |
148 collectRuleIfMatches(*it, behaviorAtBoundary, cascadeScope, cascadeO
rder, matchRequest, ruleRange); | 148 collectRuleIfMatches(*it, contextFlags, cascadeScope, cascadeOrder,
matchRequest, ruleRange); |
149 } | 149 } |
150 | 150 |
151 bool ruleMatches(const RuleData&, const ContainerNode* scope, SelectorChecke
r::BehaviorAtBoundary, SelectorChecker::MatchResult*); | 151 bool ruleMatches(const RuleData&, const ContainerNode* scope, SelectorChecke
r::ContextFlags, SelectorChecker::MatchResult*); |
152 | 152 |
153 CSSRuleList* nestedRuleList(CSSRule*); | 153 CSSRuleList* nestedRuleList(CSSRule*); |
154 template<class CSSRuleCollection> | 154 template<class CSSRuleCollection> |
155 CSSRule* findStyleRule(CSSRuleCollection*, StyleRule*); | 155 CSSRule* findStyleRule(CSSRuleCollection*, StyleRule*); |
156 void appendCSSOMWrapperForRule(CSSStyleSheet*, StyleRule*); | 156 void appendCSSOMWrapperForRule(CSSStyleSheet*, StyleRule*); |
157 | 157 |
158 void sortMatchedRules(); | 158 void sortMatchedRules(); |
159 void addMatchedRule(const RuleData*, unsigned specificity, CascadeScope, Cas
cadeOrder, unsigned styleSheetIndex, const CSSStyleSheet* parentStyleSheet); | 159 void addMatchedRule(const RuleData*, unsigned specificity, CascadeScope, Cas
cadeOrder, unsigned styleSheetIndex, const CSSStyleSheet* parentStyleSheet); |
160 | 160 |
161 StaticCSSRuleList* ensureRuleList(); | 161 StaticCSSRuleList* ensureRuleList(); |
(...skipping 14 matching lines...) Expand all Loading... |
176 | 176 |
177 // Output. | 177 // Output. |
178 RefPtrWillBeMember<StaticCSSRuleList> m_cssRuleList; | 178 RefPtrWillBeMember<StaticCSSRuleList> m_cssRuleList; |
179 RefPtrWillBeMember<StyleRuleList> m_styleRuleList; | 179 RefPtrWillBeMember<StyleRuleList> m_styleRuleList; |
180 MatchResult m_result; | 180 MatchResult m_result; |
181 }; | 181 }; |
182 | 182 |
183 } // namespace WebCore | 183 } // namespace WebCore |
184 | 184 |
185 #endif // ElementRuleCollector_h | 185 #endif // ElementRuleCollector_h |
OLD | NEW |