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