| 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...) Expand all 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 } | 151 } |
| 155 | 152 |
| 156 struct RuleSetSelectorPair { | 153 struct RuleSetSelectorPair { |
| 157 RuleSetSelectorPair(const CSSSelector* selector, PassOwnPtr<RuleSet> rul
eSet) : selector(selector), ruleSet(ruleSet) { } | 154 RuleSetSelectorPair(const CSSSelector* selector, PassOwnPtr<RuleSet> rul
eSet) : selector(selector), ruleSet(ruleSet) { } |
| 158 RuleSetSelectorPair(const RuleSetSelectorPair& rs) : selector(rs.selecto
r), ruleSet(const_cast<RuleSetSelectorPair*>(&rs)->ruleSet.release()) { } | 155 RuleSetSelectorPair(const RuleSetSelectorPair& rs) : selector(rs.selecto
r), ruleSet(const_cast<RuleSetSelectorPair*>(&rs)->ruleSet.release()) { } |
| 159 | 156 |
| 160 const CSSSelector* selector; | 157 const CSSSelector* selector; |
| 161 OwnPtr<RuleSet> ruleSet; | 158 OwnPtr<RuleSet> ruleSet; |
| 162 }; | 159 }; |
| 163 | 160 |
| 164 Vector<RuleSetSelectorPair> m_regionSelectorsAndRuleSets; | |
| 165 | |
| 166 private: | 161 private: |
| 167 typedef HashMap<AtomicString, OwnPtr<LinkedStack<RuleData> > > PendingRuleMa
p; | 162 typedef HashMap<AtomicString, OwnPtr<LinkedStack<RuleData> > > PendingRuleMa
p; |
| 168 typedef HashMap<AtomicString, OwnPtr<RuleData> > CompactRuleMap; | 163 typedef HashMap<AtomicString, OwnPtr<RuleData> > CompactRuleMap; |
| 169 | 164 |
| 170 RuleSet() | 165 RuleSet() |
| 171 : m_ruleCount(0) | 166 : m_ruleCount(0) |
| 172 { | 167 { |
| 173 } | 168 } |
| 174 | 169 |
| 175 void addToRuleSet(const AtomicString& key, PendingRuleMap&, const RuleData&)
; | 170 void addToRuleSet(const AtomicString& key, PendingRuleMap&, const RuleData&)
; |
| 176 void addPageRule(StyleRulePage*); | 171 void addPageRule(StyleRulePage*); |
| 177 void addViewportRule(StyleRuleViewport*); | 172 void addViewportRule(StyleRuleViewport*); |
| 178 void addFontFaceRule(StyleRuleFontFace*); | 173 void addFontFaceRule(StyleRuleFontFace*); |
| 179 void addKeyframesRule(StyleRuleKeyframes*); | 174 void addKeyframesRule(StyleRuleKeyframes*); |
| 180 void addRegionRule(StyleRuleRegion*, bool hasDocumentSecurityOrigin); | |
| 181 | 175 |
| 182 void addChildRules(const Vector<RefPtr<StyleRuleBase> >&, const MediaQueryEv
aluator& medium, AddRuleFlags); | 176 void addChildRules(const Vector<RefPtr<StyleRuleBase> >&, const MediaQueryEv
aluator& medium, AddRuleFlags); |
| 183 bool findBestRuleSetAndAdd(const CSSSelector&, RuleData&); | 177 bool findBestRuleSetAndAdd(const CSSSelector&, RuleData&); |
| 184 | 178 |
| 185 void compactRules(); | 179 void compactRules(); |
| 186 static void compactPendingRules(PendingRuleMap&, CompactRuleMap&); | 180 static void compactPendingRules(PendingRuleMap&, CompactRuleMap&); |
| 187 | 181 |
| 188 struct PendingRuleMaps { | 182 struct PendingRuleMaps { |
| 189 PendingRuleMap idRules; | 183 PendingRuleMap idRules; |
| 190 PendingRuleMap classRules; | 184 PendingRuleMap classRules; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 217 | 211 |
| 218 MediaQueryResultList m_viewportDependentMediaQueryResults; | 212 MediaQueryResultList m_viewportDependentMediaQueryResults; |
| 219 | 213 |
| 220 unsigned m_ruleCount; | 214 unsigned m_ruleCount; |
| 221 OwnPtr<PendingRuleMaps> m_pendingRules; | 215 OwnPtr<PendingRuleMaps> m_pendingRules; |
| 222 }; | 216 }; |
| 223 | 217 |
| 224 } // namespace WebCore | 218 } // namespace WebCore |
| 225 | 219 |
| 226 #endif // RuleSet_h | 220 #endif // RuleSet_h |
| OLD | NEW |