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 19 matching lines...) Loading... |
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 | 33 |
34 namespace WebCore { | 34 namespace WebCore { |
35 | 35 |
36 enum AddRuleFlags { | 36 enum AddRuleFlags { |
37 RuleHasNoSpecialState = 0, | 37 RuleHasNoSpecialState = 0, |
38 RuleHasDocumentSecurityOrigin = 1, | 38 RuleHasDocumentSecurityOrigin = 1, |
39 RuleCanUseFastCheckSelector = 1 << 1, | 39 RuleCanUseFastCheckSelector = 1 << 1, |
40 RuleIsInRegionRule = 1 << 2, | |
41 }; | 40 }; |
42 | 41 |
43 enum PropertyWhitelistType { | 42 enum PropertyWhitelistType { |
44 PropertyWhitelistNone = 0, | 43 PropertyWhitelistNone = 0, |
45 PropertyWhitelistRegion, | |
46 PropertyWhitelistCue | 44 PropertyWhitelistCue |
47 }; | 45 }; |
48 | 46 |
49 class CSSSelector; | 47 class CSSSelector; |
50 class MediaQueryEvaluator; | 48 class MediaQueryEvaluator; |
51 class StyleRuleRegion; | |
52 class StyleSheetContents; | 49 class StyleSheetContents; |
53 | 50 |
54 struct MinimalRuleData { | 51 struct MinimalRuleData { |
55 MinimalRuleData(StyleRule* rule, unsigned selectorIndex, AddRuleFlags flags) | 52 MinimalRuleData(StyleRule* rule, unsigned selectorIndex, AddRuleFlags flags) |
56 : m_rule(rule) | 53 : m_rule(rule) |
57 , m_selectorIndex(selectorIndex) | 54 , m_selectorIndex(selectorIndex) |
58 , m_flags(flags) | 55 , m_flags(flags) |
59 { | 56 { |
60 } | 57 } |
61 | 58 |
(...skipping 96 matching lines...) Loading... |
158 #endif | 155 #endif |
159 | 156 |
160 struct RuleSetSelectorPair { | 157 struct RuleSetSelectorPair { |
161 RuleSetSelectorPair(const CSSSelector* selector, PassOwnPtr<RuleSet> rul
eSet) : selector(selector), ruleSet(ruleSet) { } | 158 RuleSetSelectorPair(const CSSSelector* selector, PassOwnPtr<RuleSet> rul
eSet) : selector(selector), ruleSet(ruleSet) { } |
162 RuleSetSelectorPair(const RuleSetSelectorPair& rs) : selector(rs.selecto
r), ruleSet(const_cast<RuleSetSelectorPair*>(&rs)->ruleSet.release()) { } | 159 RuleSetSelectorPair(const RuleSetSelectorPair& rs) : selector(rs.selecto
r), ruleSet(const_cast<RuleSetSelectorPair*>(&rs)->ruleSet.release()) { } |
163 | 160 |
164 const CSSSelector* selector; | 161 const CSSSelector* selector; |
165 OwnPtr<RuleSet> ruleSet; | 162 OwnPtr<RuleSet> ruleSet; |
166 }; | 163 }; |
167 | 164 |
168 Vector<RuleSetSelectorPair> m_regionSelectorsAndRuleSets; | |
169 | |
170 private: | 165 private: |
171 typedef HashMap<AtomicString, OwnPtr<LinkedStack<RuleData> > > PendingRuleMa
p; | 166 typedef HashMap<AtomicString, OwnPtr<LinkedStack<RuleData> > > PendingRuleMa
p; |
172 typedef HashMap<AtomicString, OwnPtr<RuleData> > CompactRuleMap; | 167 typedef HashMap<AtomicString, OwnPtr<RuleData> > CompactRuleMap; |
173 | 168 |
174 RuleSet() | 169 RuleSet() |
175 : m_ruleCount(0) | 170 : m_ruleCount(0) |
176 { | 171 { |
177 } | 172 } |
178 | 173 |
179 void addToRuleSet(const AtomicString& key, PendingRuleMap&, const RuleData&)
; | 174 void addToRuleSet(const AtomicString& key, PendingRuleMap&, const RuleData&)
; |
180 void addPageRule(StyleRulePage*); | 175 void addPageRule(StyleRulePage*); |
181 void addViewportRule(StyleRuleViewport*); | 176 void addViewportRule(StyleRuleViewport*); |
182 void addFontFaceRule(StyleRuleFontFace*); | 177 void addFontFaceRule(StyleRuleFontFace*); |
183 void addKeyframesRule(StyleRuleKeyframes*); | 178 void addKeyframesRule(StyleRuleKeyframes*); |
184 void addRegionRule(StyleRuleRegion*, bool hasDocumentSecurityOrigin); | |
185 | 179 |
186 void addChildRules(const Vector<RefPtr<StyleRuleBase> >&, const MediaQueryEv
aluator& medium, AddRuleFlags); | 180 void addChildRules(const Vector<RefPtr<StyleRuleBase> >&, const MediaQueryEv
aluator& medium, AddRuleFlags); |
187 bool findBestRuleSetAndAdd(const CSSSelector&, RuleData&); | 181 bool findBestRuleSetAndAdd(const CSSSelector&, RuleData&); |
188 | 182 |
189 void compactRules(); | 183 void compactRules(); |
190 static void compactPendingRules(PendingRuleMap&, CompactRuleMap&); | 184 static void compactPendingRules(PendingRuleMap&, CompactRuleMap&); |
191 | 185 |
192 struct PendingRuleMaps { | 186 struct PendingRuleMaps { |
193 PendingRuleMap idRules; | 187 PendingRuleMap idRules; |
194 PendingRuleMap classRules; | 188 PendingRuleMap classRules; |
(...skipping 30 matching lines...) Loading... |
225 OwnPtr<PendingRuleMaps> m_pendingRules; | 219 OwnPtr<PendingRuleMaps> m_pendingRules; |
226 | 220 |
227 #ifndef NDEBUG | 221 #ifndef NDEBUG |
228 Vector<RuleData> m_allRules; | 222 Vector<RuleData> m_allRules; |
229 #endif | 223 #endif |
230 }; | 224 }; |
231 | 225 |
232 } // namespace WebCore | 226 } // namespace WebCore |
233 | 227 |
234 #endif // RuleSet_h | 228 #endif // RuleSet_h |
OLD | NEW |