| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 public: | 96 public: |
| 97 ElementRuleCollector(const ElementResolveContext&, RenderStyle* = 0); | 97 ElementRuleCollector(const ElementResolveContext&, RenderStyle* = 0); |
| 98 ~ElementRuleCollector(); | 98 ~ElementRuleCollector(); |
| 99 | 99 |
| 100 void setMode(SelectorChecker::Mode mode) { m_mode = mode; } | 100 void setMode(SelectorChecker::Mode mode) { m_mode = mode; } |
| 101 | 101 |
| 102 void setMatchingUARules(bool matchingUARules) { m_matchingUARules = matching
UARules; } | 102 void setMatchingUARules(bool matchingUARules) { m_matchingUARules = matching
UARules; } |
| 103 | 103 |
| 104 MatchResult& matchedResult(); | 104 MatchResult& matchedResult(); |
| 105 | 105 |
| 106 void collectMatchingRules(const MatchRequest&, RuleRange&, SelectorChecker::
ContextFlags = SelectorChecker::DefaultBehavior, CascadeScope = ignoreCascadeSco
pe, CascadeOrder = ignoreCascadeOrder); | 106 void collectMatchingRules(const MatchRequest&, RuleRange&, CascadeScope = ig
noreCascadeScope, CascadeOrder = ignoreCascadeOrder); |
| 107 void sortAndTransferMatchedRules(); | 107 void sortAndTransferMatchedRules(); |
| 108 void clearMatchedRules(); | 108 void clearMatchedRules(); |
| 109 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t
rue); | 109 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t
rue); |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 void collectRuleIfMatches(const RuleData&, SelectorChecker::ContextFlags, Ca
scadeScope, CascadeOrder, const MatchRequest&, RuleRange&); | 112 void collectRuleIfMatches(const RuleData&, CascadeScope, CascadeOrder, const
MatchRequest&, RuleRange&); |
| 113 | 113 |
| 114 template<typename RuleDataListType> | 114 template<typename RuleDataListType> |
| 115 void collectMatchingRulesForList(const RuleDataListType* rules, SelectorChec
ker::ContextFlags contextFlags, CascadeScope cascadeScope, CascadeOrder cascadeO
rder, const MatchRequest& matchRequest, RuleRange& ruleRange) | 115 void collectMatchingRulesForList(const RuleDataListType* rules, CascadeScope
cascadeScope, CascadeOrder cascadeOrder, const MatchRequest& matchRequest, Rule
Range& ruleRange) |
| 116 { | 116 { |
| 117 if (!rules) | 117 if (!rules) |
| 118 return; | 118 return; |
| 119 | 119 |
| 120 for (typename RuleDataListType::const_iterator it = rules->begin(), end
= rules->end(); it != end; ++it) | 120 for (typename RuleDataListType::const_iterator it = rules->begin(), end
= rules->end(); it != end; ++it) |
| 121 collectRuleIfMatches(*it, contextFlags, cascadeScope, cascadeOrder,
matchRequest, ruleRange); | 121 collectRuleIfMatches(*it, cascadeScope, cascadeOrder, matchRequest,
ruleRange); |
| 122 } | 122 } |
| 123 | 123 |
| 124 bool ruleMatches(const RuleData&, const ContainerNode* scope, SelectorChecke
r::ContextFlags); | 124 bool ruleMatches(const RuleData&, const ContainerNode* scope); |
| 125 | 125 |
| 126 void sortMatchedRules(); | 126 void sortMatchedRules(); |
| 127 void addMatchedRule(const RuleData*, CascadeScope, CascadeOrder, unsigned st
yleSheetIndex, const CSSStyleSheet* parentStyleSheet); | 127 void addMatchedRule(const RuleData*, CascadeScope, CascadeOrder, unsigned st
yleSheetIndex, const CSSStyleSheet* parentStyleSheet); |
| 128 | 128 |
| 129 private: | 129 private: |
| 130 const ElementResolveContext& m_context; | 130 const ElementResolveContext& m_context; |
| 131 RefPtr<RenderStyle> m_style; // FIXME: This can be mutated during matching! | 131 RefPtr<RenderStyle> m_style; // FIXME: This can be mutated during matching! |
| 132 | 132 |
| 133 SelectorChecker::Mode m_mode; | 133 SelectorChecker::Mode m_mode; |
| 134 bool m_matchingUARules; | 134 bool m_matchingUARules; |
| 135 | 135 |
| 136 OwnPtr<Vector<MatchedRule, 32> > m_matchedRules; | 136 OwnPtr<Vector<MatchedRule, 32> > m_matchedRules; |
| 137 | 137 |
| 138 // Output. | 138 // Output. |
| 139 MatchResult m_result; | 139 MatchResult m_result; |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 } // namespace blink | 142 } // namespace blink |
| 143 | 143 |
| 144 #endif // SKY_ENGINE_CORE_CSS_ELEMENTRULECOLLECTOR_H_ | 144 #endif // SKY_ENGINE_CORE_CSS_ELEMENTRULECOLLECTOR_H_ |
| OLD | NEW |