| 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 16 matching lines...) Expand all Loading... |
| 27 #include "core/css/resolver/ElementResolveContext.h" | 27 #include "core/css/resolver/ElementResolveContext.h" |
| 28 #include "core/css/resolver/MatchRequest.h" | 28 #include "core/css/resolver/MatchRequest.h" |
| 29 #include "core/css/resolver/MatchResult.h" | 29 #include "core/css/resolver/MatchResult.h" |
| 30 #include "wtf/RefPtr.h" | 30 #include "wtf/RefPtr.h" |
| 31 #include "wtf/Vector.h" | 31 #include "wtf/Vector.h" |
| 32 | 32 |
| 33 namespace WebCore { | 33 namespace WebCore { |
| 34 | 34 |
| 35 class CSSStyleSheet; | 35 class CSSStyleSheet; |
| 36 class CSSRuleList; | 36 class CSSRuleList; |
| 37 class RenderRegion; | |
| 38 class RuleData; | 37 class RuleData; |
| 39 class RuleSet; | 38 class RuleSet; |
| 40 class ScopedStyleResolver; | 39 class ScopedStyleResolver; |
| 41 class SelectorFilter; | 40 class SelectorFilter; |
| 42 class StaticCSSRuleList; | 41 class StaticCSSRuleList; |
| 43 | 42 |
| 44 typedef unsigned CascadeScope; | 43 typedef unsigned CascadeScope; |
| 45 typedef unsigned CascadeOrder; | 44 typedef unsigned CascadeOrder; |
| 46 | 45 |
| 47 const CascadeScope ignoreCascadeScope = 0; | 46 const CascadeScope ignoreCascadeScope = 0; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // FIXME: Currently it modifies the RenderStyle but should not! | 89 // FIXME: Currently it modifies the RenderStyle but should not! |
| 91 class ElementRuleCollector { | 90 class ElementRuleCollector { |
| 92 WTF_MAKE_NONCOPYABLE(ElementRuleCollector); | 91 WTF_MAKE_NONCOPYABLE(ElementRuleCollector); |
| 93 public: | 92 public: |
| 94 ElementRuleCollector(const ElementResolveContext&, const SelectorFilter&, Re
nderStyle* = 0); | 93 ElementRuleCollector(const ElementResolveContext&, const SelectorFilter&, Re
nderStyle* = 0); |
| 95 ~ElementRuleCollector(); | 94 ~ElementRuleCollector(); |
| 96 | 95 |
| 97 void setMode(SelectorChecker::Mode mode) { m_mode = mode; } | 96 void setMode(SelectorChecker::Mode mode) { m_mode = mode; } |
| 98 void setPseudoStyleRequest(const PseudoStyleRequest& request) { m_pseudoStyl
eRequest = request; } | 97 void setPseudoStyleRequest(const PseudoStyleRequest& request) { m_pseudoStyl
eRequest = request; } |
| 99 void setSameOriginOnly(bool f) { m_sameOriginOnly = f; } | 98 void setSameOriginOnly(bool f) { m_sameOriginOnly = f; } |
| 100 void setRegionForStyling(const RenderRegion* regionForStyling) { m_regionFor
Styling = regionForStyling; } | |
| 101 | 99 |
| 102 void setMatchingUARules(bool matchingUARules) { m_matchingUARules = matching
UARules; } | 100 void setMatchingUARules(bool matchingUARules) { m_matchingUARules = matching
UARules; } |
| 103 bool hasAnyMatchingRules(RuleSet*); | 101 bool hasAnyMatchingRules(RuleSet*); |
| 104 | 102 |
| 105 MatchResult& matchedResult(); | 103 MatchResult& matchedResult(); |
| 106 PassRefPtr<StyleRuleList> matchedStyleRuleList(); | 104 PassRefPtr<StyleRuleList> matchedStyleRuleList(); |
| 107 PassRefPtr<CSSRuleList> matchedCSSRuleList(); | 105 PassRefPtr<CSSRuleList> matchedCSSRuleList(); |
| 108 | 106 |
| 109 void collectMatchingRules(const MatchRequest&, RuleRange&, SelectorChecker::
BehaviorAtBoundary = SelectorChecker::DoesNotCrossBoundary, CascadeScope = ignor
eCascadeScope, CascadeOrder = ignoreCascadeOrder); | 107 void collectMatchingRules(const MatchRequest&, RuleRange&, SelectorChecker::
BehaviorAtBoundary = SelectorChecker::DoesNotCrossBoundary, CascadeScope = ignor
eCascadeScope, CascadeOrder = ignoreCascadeOrder); |
| 110 void collectMatchingRulesForRegion(const MatchRequest&, RuleRange&, Selector
Checker::BehaviorAtBoundary = SelectorChecker::DoesNotCrossBoundary, CascadeScop
e = ignoreCascadeScope, CascadeOrder = ignoreCascadeOrder); | |
| 111 void sortAndTransferMatchedRules(); | 108 void sortAndTransferMatchedRules(); |
| 112 void clearMatchedRules(); | 109 void clearMatchedRules(); |
| 113 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t
rue); | 110 void addElementStyleProperties(const StylePropertySet*, bool isCacheable = t
rue); |
| 114 | 111 |
| 115 unsigned lastMatchedRulesPosition() const { return m_matchedRules ? m_matche
dRules->size() : 0; } | 112 unsigned lastMatchedRulesPosition() const { return m_matchedRules ? m_matche
dRules->size() : 0; } |
| 116 void sortMatchedRulesFrom(unsigned position); | 113 void sortMatchedRulesFrom(unsigned position); |
| 117 void sortAndTransferMatchedRulesWithOnlySortBySpecificity(); | 114 void sortAndTransferMatchedRulesWithOnlySortBySpecificity(); |
| 118 | 115 |
| 119 private: | 116 private: |
| 120 void collectRuleIfMatches(const RuleData&, SelectorChecker::BehaviorAtBounda
ry, CascadeScope, CascadeOrder, const MatchRequest&, RuleRange&); | 117 void collectRuleIfMatches(const RuleData&, SelectorChecker::BehaviorAtBounda
ry, CascadeScope, CascadeOrder, const MatchRequest&, RuleRange&); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 131 void addMatchedRule(const RuleData*, unsigned specificity, CascadeScope, Cas
cadeOrder, unsigned styleSheetIndex, const CSSStyleSheet* parentStyleSheet); | 128 void addMatchedRule(const RuleData*, unsigned specificity, CascadeScope, Cas
cadeOrder, unsigned styleSheetIndex, const CSSStyleSheet* parentStyleSheet); |
| 132 | 129 |
| 133 StaticCSSRuleList* ensureRuleList(); | 130 StaticCSSRuleList* ensureRuleList(); |
| 134 StyleRuleList* ensureStyleRuleList(); | 131 StyleRuleList* ensureStyleRuleList(); |
| 135 | 132 |
| 136 private: | 133 private: |
| 137 const ElementResolveContext& m_context; | 134 const ElementResolveContext& m_context; |
| 138 const SelectorFilter& m_selectorFilter; | 135 const SelectorFilter& m_selectorFilter; |
| 139 RefPtr<RenderStyle> m_style; // FIXME: This can be mutated during matching! | 136 RefPtr<RenderStyle> m_style; // FIXME: This can be mutated during matching! |
| 140 | 137 |
| 141 const RenderRegion* m_regionForStyling; | |
| 142 PseudoStyleRequest m_pseudoStyleRequest; | 138 PseudoStyleRequest m_pseudoStyleRequest; |
| 143 SelectorChecker::Mode m_mode; | 139 SelectorChecker::Mode m_mode; |
| 144 bool m_canUseFastReject; | 140 bool m_canUseFastReject; |
| 145 bool m_sameOriginOnly; | 141 bool m_sameOriginOnly; |
| 146 bool m_matchingUARules; | 142 bool m_matchingUARules; |
| 147 | 143 |
| 148 OwnPtr<Vector<MatchedRule, 32> > m_matchedRules; | 144 OwnPtr<Vector<MatchedRule, 32> > m_matchedRules; |
| 149 | 145 |
| 150 // Output. | 146 // Output. |
| 151 RefPtr<StaticCSSRuleList> m_cssRuleList; | 147 RefPtr<StaticCSSRuleList> m_cssRuleList; |
| 152 RefPtr<StyleRuleList> m_styleRuleList; | 148 RefPtr<StyleRuleList> m_styleRuleList; |
| 153 MatchResult m_result; | 149 MatchResult m_result; |
| 154 }; | 150 }; |
| 155 | 151 |
| 156 } // namespace WebCore | 152 } // namespace WebCore |
| 157 | 153 |
| 158 #endif // ElementRuleCollector_h | 154 #endif // ElementRuleCollector_h |
| OLD | NEW |