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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 const CascadeScope ignoreCascadeScope = 0; | 47 const CascadeScope ignoreCascadeScope = 0; |
48 const CascadeOrder ignoreCascadeOrder = 0; | 48 const CascadeOrder ignoreCascadeOrder = 0; |
49 | 49 |
50 class MatchedRule { | 50 class MatchedRule { |
51 WTF_MAKE_FAST_ALLOCATED; | 51 WTF_MAKE_FAST_ALLOCATED; |
52 public: | 52 public: |
53 explicit MatchedRule(const RuleData* ruleData, unsigned specificity, Cascade
Scope cascadeScope, CascadeOrder cascadeOrder, unsigned styleSheetIndex, const C
SSStyleSheet* parentStyleSheet) | 53 explicit MatchedRule(const RuleData* ruleData, unsigned specificity, Cascade
Scope cascadeScope, CascadeOrder cascadeOrder, unsigned styleSheetIndex, const C
SSStyleSheet* parentStyleSheet) |
54 : m_ruleData(ruleData) | 54 : m_ruleData(ruleData) |
55 , m_specificity(specificity) | 55 , m_specificity(specificity) |
56 , m_cascadeScope(cascadeScope) | 56 , m_cascadeScope(cascadeScope) |
57 , m_styleSheetIndex(styleSheetIndex) | |
58 , m_parentStyleSheet(parentStyleSheet) | 57 , m_parentStyleSheet(parentStyleSheet) |
59 { | 58 { |
60 ASSERT(m_ruleData); | 59 ASSERT(m_ruleData); |
61 static const unsigned BitsForPositionInRuleData = 18; | 60 static const unsigned BitsForPositionInRuleData = 18; |
62 m_position = (cascadeOrder << BitsForPositionInRuleData) + m_ruleData->p
osition(); | 61 static const unsigned BitsForStyleSheetIndexInRuleData = 32; |
| 62 m_position = ((uint64_t)cascadeOrder << (BitsForStyleSheetIndexInRuleDat
a + BitsForPositionInRuleData)) + ((uint64_t)styleSheetIndex << BitsForPositionI
nRuleData) + m_ruleData->position(); |
63 } | 63 } |
64 | 64 |
65 const RuleData* ruleData() const { return m_ruleData; } | 65 const RuleData* ruleData() const { return m_ruleData; } |
66 uint32_t cascadeScope() const { return m_cascadeScope; } | 66 uint32_t cascadeScope() const { return m_cascadeScope; } |
67 uint32_t position() const { return m_position; } | 67 uint32_t position() const { return m_position; } |
68 unsigned specificity() const { return ruleData()->specificity() + m_specific
ity; } | 68 unsigned specificity() const { return ruleData()->specificity() + m_specific
ity; } |
69 uint32_t styleSheetIndex() const { return m_styleSheetIndex; } | |
70 const CSSStyleSheet* parentStyleSheet() const { return m_parentStyleSheet; } | 69 const CSSStyleSheet* parentStyleSheet() const { return m_parentStyleSheet; } |
71 | 70 |
72 private: | 71 private: |
73 const RuleData* m_ruleData; | 72 const RuleData* m_ruleData; |
74 unsigned m_specificity; | 73 unsigned m_specificity; |
75 CascadeScope m_cascadeScope; | 74 CascadeScope m_cascadeScope; |
76 uint32_t m_position; | |
77 uint32_t m_styleSheetIndex; | |
78 const CSSStyleSheet* m_parentStyleSheet; | 75 const CSSStyleSheet* m_parentStyleSheet; |
| 76 uint64_t m_position; |
79 }; | 77 }; |
80 | 78 |
81 class StyleRuleList : public RefCounted<StyleRuleList> { | 79 class StyleRuleList : public RefCounted<StyleRuleList> { |
82 public: | 80 public: |
83 static PassRefPtr<StyleRuleList> create() { return adoptRef(new StyleRuleLis
t()); } | 81 static PassRefPtr<StyleRuleList> create() { return adoptRef(new StyleRuleLis
t()); } |
84 Vector<StyleRule*> m_list; | 82 Vector<StyleRule*> m_list; |
85 }; | 83 }; |
86 | 84 |
87 // ElementRuleCollector is designed to be used as a stack object. | 85 // ElementRuleCollector is designed to be used as a stack object. |
88 // Create one, ask what rules the ElementResolveContext matches | 86 // Create one, ask what rules the ElementResolveContext matches |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 147 |
150 // Output. | 148 // Output. |
151 RefPtr<StaticCSSRuleList> m_cssRuleList; | 149 RefPtr<StaticCSSRuleList> m_cssRuleList; |
152 RefPtr<StyleRuleList> m_styleRuleList; | 150 RefPtr<StyleRuleList> m_styleRuleList; |
153 MatchResult m_result; | 151 MatchResult m_result; |
154 }; | 152 }; |
155 | 153 |
156 } // namespace WebCore | 154 } // namespace WebCore |
157 | 155 |
158 #endif // ElementRuleCollector_h | 156 #endif // ElementRuleCollector_h |
OLD | NEW |