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 12 matching lines...) Expand all Loading... |
23 #define RuleSet_h | 23 #define RuleSet_h |
24 | 24 |
25 #include "core/css/CSSKeyframesRule.h" | 25 #include "core/css/CSSKeyframesRule.h" |
26 #include "core/css/MediaQueryEvaluator.h" | 26 #include "core/css/MediaQueryEvaluator.h" |
27 #include "core/css/RuleFeature.h" | 27 #include "core/css/RuleFeature.h" |
28 #include "core/css/StyleRule.h" | 28 #include "core/css/StyleRule.h" |
29 #include "core/css/resolver/MediaQueryResult.h" | 29 #include "core/css/resolver/MediaQueryResult.h" |
30 #include "wtf/Forward.h" | 30 #include "wtf/Forward.h" |
31 #include "wtf/HashMap.h" | 31 #include "wtf/HashMap.h" |
32 #include "wtf/LinkedStack.h" | 32 #include "wtf/LinkedStack.h" |
| 33 #include "wtf/TerminatedArray.h" |
33 | 34 |
34 namespace WebCore { | 35 namespace WebCore { |
35 | 36 |
36 enum AddRuleFlags { | 37 enum AddRuleFlags { |
37 RuleHasNoSpecialState = 0, | 38 RuleHasNoSpecialState = 0, |
38 RuleHasDocumentSecurityOrigin = 1, | 39 RuleHasDocumentSecurityOrigin = 1, |
39 RuleCanUseFastCheckSelector = 1 << 1, | 40 RuleCanUseFastCheckSelector = 1 << 1, |
40 }; | 41 }; |
41 | 42 |
42 enum PropertyWhitelistType { | 43 enum PropertyWhitelistType { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 WTF_MAKE_NONCOPYABLE(RuleSet); WTF_MAKE_FAST_ALLOCATED; | 119 WTF_MAKE_NONCOPYABLE(RuleSet); WTF_MAKE_FAST_ALLOCATED; |
119 public: | 120 public: |
120 static PassOwnPtr<RuleSet> create() { return adoptPtr(new RuleSet); } | 121 static PassOwnPtr<RuleSet> create() { return adoptPtr(new RuleSet); } |
121 | 122 |
122 void addRulesFromSheet(StyleSheetContents*, const MediaQueryEvaluator&, AddR
uleFlags = RuleHasNoSpecialState); | 123 void addRulesFromSheet(StyleSheetContents*, const MediaQueryEvaluator&, AddR
uleFlags = RuleHasNoSpecialState); |
123 void addStyleRule(StyleRule*, AddRuleFlags); | 124 void addStyleRule(StyleRule*, AddRuleFlags); |
124 void addRule(StyleRule*, unsigned selectorIndex, AddRuleFlags); | 125 void addRule(StyleRule*, unsigned selectorIndex, AddRuleFlags); |
125 | 126 |
126 const RuleFeatureSet& features() const { return m_features; } | 127 const RuleFeatureSet& features() const { return m_features; } |
127 | 128 |
128 const RuleData* idRules(const AtomicString& key) const { ASSERT(!m_pendingRu
les); return m_idRules.get(key); } | 129 const TerminatedArray<RuleData>* idRules(const AtomicString& key) const { AS
SERT(!m_pendingRules); return m_idRules.get(key); } |
129 const RuleData* classRules(const AtomicString& key) const { ASSERT(!m_pendin
gRules); return m_classRules.get(key); } | 130 const TerminatedArray<RuleData>* classRules(const AtomicString& key) const {
ASSERT(!m_pendingRules); return m_classRules.get(key); } |
130 const RuleData* tagRules(const AtomicString& key) const { ASSERT(!m_pendingR
ules); return m_tagRules.get(key); } | 131 const TerminatedArray<RuleData>* tagRules(const AtomicString& key) const { A
SSERT(!m_pendingRules); return m_tagRules.get(key); } |
131 const RuleData* shadowPseudoElementRules(const AtomicString& key) const { AS
SERT(!m_pendingRules); return m_shadowPseudoElementRules.get(key); } | 132 const TerminatedArray<RuleData>* shadowPseudoElementRules(const AtomicString
& key) const { ASSERT(!m_pendingRules); return m_shadowPseudoElementRules.get(ke
y); } |
132 const Vector<RuleData>* linkPseudoClassRules() const { ASSERT(!m_pendingRule
s); return &m_linkPseudoClassRules; } | 133 const Vector<RuleData>* linkPseudoClassRules() const { ASSERT(!m_pendingRule
s); return &m_linkPseudoClassRules; } |
133 const Vector<RuleData>* cuePseudoRules() const { ASSERT(!m_pendingRules); re
turn &m_cuePseudoRules; } | 134 const Vector<RuleData>* cuePseudoRules() const { ASSERT(!m_pendingRules); re
turn &m_cuePseudoRules; } |
134 const Vector<RuleData>* focusPseudoClassRules() const { ASSERT(!m_pendingRul
es); return &m_focusPseudoClassRules; } | 135 const Vector<RuleData>* focusPseudoClassRules() const { ASSERT(!m_pendingRul
es); return &m_focusPseudoClassRules; } |
135 const Vector<RuleData>* universalRules() const { ASSERT(!m_pendingRules); re
turn &m_universalRules; } | 136 const Vector<RuleData>* universalRules() const { ASSERT(!m_pendingRules); re
turn &m_universalRules; } |
136 const WillBeHeapVector<RawPtrWillBeMember<StyleRulePage> >& pageRules() cons
t { ASSERT(!m_pendingRules); return m_pageRules; } | 137 const WillBeHeapVector<RawPtrWillBeMember<StyleRulePage> >& pageRules() cons
t { ASSERT(!m_pendingRules); return m_pageRules; } |
137 const WillBeHeapVector<RawPtrWillBeMember<StyleRuleViewport> >& viewportRule
s() const { ASSERT(!m_pendingRules); return m_viewportRules; } | 138 const WillBeHeapVector<RawPtrWillBeMember<StyleRuleViewport> >& viewportRule
s() const { ASSERT(!m_pendingRules); return m_viewportRules; } |
138 const WillBeHeapVector<RawPtrWillBeMember<StyleRuleFontFace> >& fontFaceRule
s() const { return m_fontFaceRules; } | 139 const WillBeHeapVector<RawPtrWillBeMember<StyleRuleFontFace> >& fontFaceRule
s() const { return m_fontFaceRules; } |
139 const WillBeHeapVector<RawPtrWillBeMember<StyleRuleKeyframes> >& keyframesRu
les() const { return m_keyframesRules; } | 140 const WillBeHeapVector<RawPtrWillBeMember<StyleRuleKeyframes> >& keyframesRu
les() const { return m_keyframesRules; } |
140 const Vector<MinimalRuleData>& treeBoundaryCrossingRules() const { return m_
treeBoundaryCrossingRules; } | 141 const Vector<MinimalRuleData>& treeBoundaryCrossingRules() const { return m_
treeBoundaryCrossingRules; } |
141 const Vector<MinimalRuleData>& shadowDistributedRules() const { return m_sha
dowDistributedRules; } | 142 const Vector<MinimalRuleData>& shadowDistributedRules() const { return m_sha
dowDistributedRules; } |
(...skipping 15 matching lines...) Expand all Loading... |
157 struct RuleSetSelectorPair { | 158 struct RuleSetSelectorPair { |
158 RuleSetSelectorPair(const CSSSelector* selector, PassOwnPtr<RuleSet> rul
eSet) : selector(selector), ruleSet(ruleSet) { } | 159 RuleSetSelectorPair(const CSSSelector* selector, PassOwnPtr<RuleSet> rul
eSet) : selector(selector), ruleSet(ruleSet) { } |
159 RuleSetSelectorPair(const RuleSetSelectorPair& rs) : selector(rs.selecto
r), ruleSet(const_cast<RuleSetSelectorPair*>(&rs)->ruleSet.release()) { } | 160 RuleSetSelectorPair(const RuleSetSelectorPair& rs) : selector(rs.selecto
r), ruleSet(const_cast<RuleSetSelectorPair*>(&rs)->ruleSet.release()) { } |
160 | 161 |
161 const CSSSelector* selector; | 162 const CSSSelector* selector; |
162 OwnPtr<RuleSet> ruleSet; | 163 OwnPtr<RuleSet> ruleSet; |
163 }; | 164 }; |
164 | 165 |
165 private: | 166 private: |
166 typedef HashMap<AtomicString, OwnPtr<LinkedStack<RuleData> > > PendingRuleMa
p; | 167 typedef HashMap<AtomicString, OwnPtr<LinkedStack<RuleData> > > PendingRuleMa
p; |
167 typedef HashMap<AtomicString, OwnPtr<RuleData> > CompactRuleMap; | 168 typedef HashMap<AtomicString, OwnPtr<TerminatedArray<RuleData> > > CompactRu
leMap; |
168 | 169 |
169 RuleSet() | 170 RuleSet() |
170 : m_ruleCount(0) | 171 : m_ruleCount(0) |
171 { | 172 { |
172 } | 173 } |
173 | 174 |
174 void addToRuleSet(const AtomicString& key, PendingRuleMap&, const RuleData&)
; | 175 void addToRuleSet(const AtomicString& key, PendingRuleMap&, const RuleData&)
; |
175 void addPageRule(StyleRulePage*); | 176 void addPageRule(StyleRulePage*); |
176 void addViewportRule(StyleRuleViewport*); | 177 void addViewportRule(StyleRuleViewport*); |
177 void addFontFaceRule(StyleRuleFontFace*); | 178 void addFontFaceRule(StyleRuleFontFace*); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 OwnPtr<PendingRuleMaps> m_pendingRules; | 220 OwnPtr<PendingRuleMaps> m_pendingRules; |
220 | 221 |
221 #ifndef NDEBUG | 222 #ifndef NDEBUG |
222 Vector<RuleData> m_allRules; | 223 Vector<RuleData> m_allRules; |
223 #endif | 224 #endif |
224 }; | 225 }; |
225 | 226 |
226 } // namespace WebCore | 227 } // namespace WebCore |
227 | 228 |
228 #endif // RuleSet_h | 229 #endif // RuleSet_h |
OLD | NEW |