| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 visitor->trace(m_list); | 94 visitor->trace(m_list); |
| 95 #endif | 95 #endif |
| 96 } | 96 } |
| 97 | 97 |
| 98 WillBeHeapVector<RawPtrWillBeMember<StyleRule>> m_list; | 98 WillBeHeapVector<RawPtrWillBeMember<StyleRule>> m_list; |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 // ElementRuleCollector is designed to be used as a stack object. | 101 // ElementRuleCollector is designed to be used as a stack object. |
| 102 // Create one, ask what rules the ElementResolveContext matches | 102 // Create one, ask what rules the ElementResolveContext matches |
| 103 // and then let it go out of scope. | 103 // and then let it go out of scope. |
| 104 // FIXME: Currently it modifies the LayoutStyle but should not! | 104 // FIXME: Currently it modifies the ComputedStyle but should not! |
| 105 class ElementRuleCollector { | 105 class ElementRuleCollector { |
| 106 STACK_ALLOCATED(); | 106 STACK_ALLOCATED(); |
| 107 WTF_MAKE_NONCOPYABLE(ElementRuleCollector); | 107 WTF_MAKE_NONCOPYABLE(ElementRuleCollector); |
| 108 public: | 108 public: |
| 109 ElementRuleCollector(const ElementResolveContext&, const SelectorFilter&, La
youtStyle* = 0); | 109 ElementRuleCollector(const ElementResolveContext&, const SelectorFilter&, Co
mputedStyle* = 0); |
| 110 ~ElementRuleCollector(); | 110 ~ElementRuleCollector(); |
| 111 | 111 |
| 112 void setMode(SelectorChecker::Mode mode) { m_mode = mode; } | 112 void setMode(SelectorChecker::Mode mode) { m_mode = mode; } |
| 113 void setPseudoStyleRequest(const PseudoStyleRequest& request) { m_pseudoStyl
eRequest = request; } | 113 void setPseudoStyleRequest(const PseudoStyleRequest& request) { m_pseudoStyl
eRequest = request; } |
| 114 void setSameOriginOnly(bool f) { m_sameOriginOnly = f; } | 114 void setSameOriginOnly(bool f) { m_sameOriginOnly = f; } |
| 115 | 115 |
| 116 void setMatchingUARules(bool matchingUARules) { m_matchingUARules = matching
UARules; } | 116 void setMatchingUARules(bool matchingUARules) { m_matchingUARules = matching
UARules; } |
| 117 void setScopeContainsLastMatchedElement(bool scopeContainsLastMatchedElement
) { m_scopeContainsLastMatchedElement = scopeContainsLastMatchedElement; } | 117 void setScopeContainsLastMatchedElement(bool scopeContainsLastMatchedElement
) { m_scopeContainsLastMatchedElement = scopeContainsLastMatchedElement; } |
| 118 bool scopeContainsLastMatchedElement() const { return m_scopeContainsLastMat
chedElement; } | 118 bool scopeContainsLastMatchedElement() const { return m_scopeContainsLastMat
chedElement; } |
| 119 bool hasAnyMatchingRules(RuleSet*); | 119 bool hasAnyMatchingRules(RuleSet*); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 150 | 150 |
| 151 void sortMatchedRules(); | 151 void sortMatchedRules(); |
| 152 void addMatchedRule(const RuleData*, unsigned specificity, CascadeOrder, uns
igned styleSheetIndex, const CSSStyleSheet* parentStyleSheet); | 152 void addMatchedRule(const RuleData*, unsigned specificity, CascadeOrder, uns
igned styleSheetIndex, const CSSStyleSheet* parentStyleSheet); |
| 153 | 153 |
| 154 StaticCSSRuleList* ensureRuleList(); | 154 StaticCSSRuleList* ensureRuleList(); |
| 155 StyleRuleList* ensureStyleRuleList(); | 155 StyleRuleList* ensureStyleRuleList(); |
| 156 | 156 |
| 157 private: | 157 private: |
| 158 const ElementResolveContext& m_context; | 158 const ElementResolveContext& m_context; |
| 159 const SelectorFilter& m_selectorFilter; | 159 const SelectorFilter& m_selectorFilter; |
| 160 RefPtr<LayoutStyle> m_style; // FIXME: This can be mutated during matching! | 160 RefPtr<ComputedStyle> m_style; // FIXME: This can be mutated during matching
! |
| 161 | 161 |
| 162 PseudoStyleRequest m_pseudoStyleRequest; | 162 PseudoStyleRequest m_pseudoStyleRequest; |
| 163 SelectorChecker::Mode m_mode; | 163 SelectorChecker::Mode m_mode; |
| 164 bool m_canUseFastReject; | 164 bool m_canUseFastReject; |
| 165 bool m_sameOriginOnly; | 165 bool m_sameOriginOnly; |
| 166 bool m_matchingUARules; | 166 bool m_matchingUARules; |
| 167 bool m_scopeContainsLastMatchedElement; | 167 bool m_scopeContainsLastMatchedElement; |
| 168 | 168 |
| 169 WillBeHeapVector<MatchedRule, 32> m_matchedRules; | 169 WillBeHeapVector<MatchedRule, 32> m_matchedRules; |
| 170 | 170 |
| 171 // Output. | 171 // Output. |
| 172 RefPtrWillBeMember<StaticCSSRuleList> m_cssRuleList; | 172 RefPtrWillBeMember<StaticCSSRuleList> m_cssRuleList; |
| 173 RefPtrWillBeMember<StyleRuleList> m_styleRuleList; | 173 RefPtrWillBeMember<StyleRuleList> m_styleRuleList; |
| 174 MatchResult m_result; | 174 MatchResult m_result; |
| 175 }; | 175 }; |
| 176 | 176 |
| 177 } // namespace blink | 177 } // namespace blink |
| 178 | 178 |
| 179 #endif // ElementRuleCollector_h | 179 #endif // ElementRuleCollector_h |
| OLD | NEW |