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 29 matching lines...) Expand all Loading... | |
40 class SelectorFilter; | 40 class SelectorFilter; |
41 class StaticCSSRuleList; | 41 class StaticCSSRuleList; |
42 | 42 |
43 typedef unsigned CascadeScope; | 43 typedef unsigned CascadeScope; |
44 typedef unsigned CascadeOrder; | 44 typedef unsigned CascadeOrder; |
45 | 45 |
46 const CascadeScope ignoreCascadeScope = 0; | 46 const CascadeScope ignoreCascadeScope = 0; |
47 const CascadeOrder ignoreCascadeOrder = 0; | 47 const CascadeOrder ignoreCascadeOrder = 0; |
48 | 48 |
49 class MatchedRule { | 49 class MatchedRule { |
50 WTF_MAKE_FAST_ALLOCATED; | 50 ALLOW_ONLY_INLINE_ALLOCATION(); |
51 public: | 51 public: |
52 explicit MatchedRule(const RuleData* ruleData, unsigned specificity, Cascade Scope cascadeScope, CascadeOrder cascadeOrder, unsigned styleSheetIndex, const C SSStyleSheet* parentStyleSheet) | 52 MatchedRule(const RuleData* ruleData, unsigned specificity, CascadeScope cas cadeScope, CascadeOrder cascadeOrder, unsigned styleSheetIndex, const CSSStyleSh eet* parentStyleSheet) |
53 : m_ruleData(ruleData) | 53 : m_ruleData(ruleData) |
54 , m_specificity(specificity) | 54 , m_specificity(specificity) |
55 , m_cascadeScope(cascadeScope) | 55 , m_cascadeScope(cascadeScope) |
56 , m_parentStyleSheet(parentStyleSheet) | 56 , m_parentStyleSheet(parentStyleSheet) |
57 { | 57 { |
58 ASSERT(m_ruleData); | 58 ASSERT(m_ruleData); |
59 static const unsigned BitsForPositionInRuleData = 18; | 59 static const unsigned BitsForPositionInRuleData = 18; |
60 static const unsigned BitsForStyleSheetIndex = 32; | 60 static const unsigned BitsForStyleSheetIndex = 32; |
61 m_position = ((uint64_t)cascadeOrder << (BitsForStyleSheetIndex + BitsFo rPositionInRuleData)) + ((uint64_t)styleSheetIndex << BitsForPositionInRuleData) + m_ruleData->position(); | 61 m_position = ((uint64_t)cascadeOrder << (BitsForStyleSheetIndex + BitsFo rPositionInRuleData)) + ((uint64_t)styleSheetIndex << BitsForPositionInRuleData) + m_ruleData->position(); |
62 } | 62 } |
63 | 63 |
64 const RuleData* ruleData() const { return m_ruleData; } | 64 const RuleData* ruleData() const { return m_ruleData; } |
65 uint32_t cascadeScope() const { return m_cascadeScope; } | 65 uint32_t cascadeScope() const { return m_cascadeScope; } |
66 uint64_t position() const { return m_position; } | 66 uint64_t position() const { return m_position; } |
67 unsigned specificity() const { return ruleData()->specificity() + m_specific ity; } | 67 unsigned specificity() const { return ruleData()->specificity() + m_specific ity; } |
68 const CSSStyleSheet* parentStyleSheet() const { return m_parentStyleSheet; } | 68 const CSSStyleSheet* parentStyleSheet() const { return m_parentStyleSheet; } |
69 void trace(Visitor* visitor) | |
70 { | |
71 visitor->trace(m_ruleData); | |
72 visitor->trace(m_parentStyleSheet); | |
73 } | |
69 | 74 |
70 private: | 75 private: |
71 const RuleData* m_ruleData; | 76 RawPtrWillBeMember<const RuleData> m_ruleData; |
Mads Ager (chromium)
2014/03/17 13:57:24
This change should have been caught by the COMPILE
| |
72 unsigned m_specificity; | 77 unsigned m_specificity; |
73 CascadeScope m_cascadeScope; | 78 CascadeScope m_cascadeScope; |
74 uint64_t m_position; | 79 uint64_t m_position; |
75 const CSSStyleSheet* m_parentStyleSheet; | 80 RawPtrWillBeMember<const CSSStyleSheet> m_parentStyleSheet; |
76 }; | 81 }; |
77 | 82 |
83 } // namespace WebCore | |
84 | |
85 | |
86 namespace WTF { | |
87 | |
88 template <> struct VectorTraits<WebCore::MatchedRule> : VectorTraitsBase<WebCore ::MatchedRule> { | |
89 static const bool canInitializeWithMemset = true; | |
90 static const bool canMoveWithMemcpy = true; | |
91 }; | |
92 | |
93 } // namespace WTF | |
94 | |
95 namespace WebCore { | |
96 | |
78 // FIXME: oilpan: when transition types are gone this class can be replaced with HeapVector. | 97 // FIXME: oilpan: when transition types are gone this class can be replaced with HeapVector. |
79 class StyleRuleList : public RefCounted<StyleRuleList> { | 98 class StyleRuleList : public RefCounted<StyleRuleList> { |
80 public: | 99 public: |
81 static PassRefPtr<StyleRuleList> create() { return adoptRef(new StyleRuleLis t()); } | 100 static PassRefPtr<StyleRuleList> create() { return adoptRef(new StyleRuleLis t()); } |
82 WillBePersistentHeapVector<RawPtrWillBeMember<StyleRule> > m_list; | 101 WillBePersistentHeapVector<RawPtrWillBeMember<StyleRule> > m_list; |
83 }; | 102 }; |
84 | 103 |
85 // ElementRuleCollector is designed to be used as a stack object. | 104 // ElementRuleCollector is designed to be used as a stack object. |
86 // Create one, ask what rules the ElementResolveContext matches | 105 // Create one, ask what rules the ElementResolveContext matches |
87 // and then let it go out of scope. | 106 // and then let it go out of scope. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 const ElementResolveContext& m_context; | 162 const ElementResolveContext& m_context; |
144 const SelectorFilter& m_selectorFilter; | 163 const SelectorFilter& m_selectorFilter; |
145 RefPtr<RenderStyle> m_style; // FIXME: This can be mutated during matching! | 164 RefPtr<RenderStyle> m_style; // FIXME: This can be mutated during matching! |
146 | 165 |
147 PseudoStyleRequest m_pseudoStyleRequest; | 166 PseudoStyleRequest m_pseudoStyleRequest; |
148 SelectorChecker::Mode m_mode; | 167 SelectorChecker::Mode m_mode; |
149 bool m_canUseFastReject; | 168 bool m_canUseFastReject; |
150 bool m_sameOriginOnly; | 169 bool m_sameOriginOnly; |
151 bool m_matchingUARules; | 170 bool m_matchingUARules; |
152 | 171 |
153 OwnPtr<Vector<MatchedRule, 32> > m_matchedRules; | 172 OwnPtrWillBeMember<WillBeHeapVector<MatchedRule, 32> > m_matchedRules; |
154 | 173 |
155 // Output. | 174 // Output. |
156 RefPtrWillBeMember<StaticCSSRuleList> m_cssRuleList; | 175 RefPtrWillBeMember<StaticCSSRuleList> m_cssRuleList; |
157 RefPtr<StyleRuleList> m_styleRuleList; | 176 RefPtr<StyleRuleList> m_styleRuleList; |
158 MatchResult m_result; | 177 MatchResult m_result; |
159 }; | 178 }; |
160 | 179 |
161 } // namespace WebCore | 180 } // namespace WebCore |
162 | 181 |
163 #endif // ElementRuleCollector_h | 182 #endif // ElementRuleCollector_h |
OLD | NEW |