| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 void addStyleRule(StyleRule*, AddRuleFlags); | 89 void addStyleRule(StyleRule*, AddRuleFlags); |
| 90 void addRule(StyleRule*, unsigned selectorIndex, AddRuleFlags); | 90 void addRule(StyleRule*, unsigned selectorIndex, AddRuleFlags); |
| 91 | 91 |
| 92 const RuleFeatureSet& features() const { return m_features; } | 92 const RuleFeatureSet& features() const { return m_features; } |
| 93 | 93 |
| 94 const WillBeHeapTerminatedArray<RuleData>* idRules(const AtomicString& key)
const { ASSERT(!m_pendingRules); return m_idRules.get(key); } | 94 const WillBeHeapTerminatedArray<RuleData>* idRules(const AtomicString& key)
const { ASSERT(!m_pendingRules); return m_idRules.get(key); } |
| 95 const WillBeHeapTerminatedArray<RuleData>* classRules(const AtomicString& ke
y) const { ASSERT(!m_pendingRules); return m_classRules.get(key); } | 95 const WillBeHeapTerminatedArray<RuleData>* classRules(const AtomicString& ke
y) const { ASSERT(!m_pendingRules); return m_classRules.get(key); } |
| 96 const WillBeHeapTerminatedArray<RuleData>* tagRules(const AtomicString& key)
const { ASSERT(!m_pendingRules); return m_tagRules.get(key); } | 96 const WillBeHeapTerminatedArray<RuleData>* tagRules(const AtomicString& key)
const { ASSERT(!m_pendingRules); return m_tagRules.get(key); } |
| 97 const WillBeHeapTerminatedArray<RuleData>* shadowPseudoElementRules(const At
omicString& key) const { ASSERT(!m_pendingRules); return m_shadowPseudoElementRu
les.get(key); } | 97 const WillBeHeapTerminatedArray<RuleData>* shadowPseudoElementRules(const At
omicString& key) const { ASSERT(!m_pendingRules); return m_shadowPseudoElementRu
les.get(key); } |
| 98 const WillBeHeapVector<RuleData>* universalRules() const { ASSERT(!m_pending
Rules); return &m_universalRules; } | 98 const WillBeHeapVector<RuleData>* universalRules() const { ASSERT(!m_pending
Rules); return &m_universalRules; } |
| 99 const WillBeHeapVector<RawPtrWillBeMember<StyleRuleViewport> >& viewportRule
s() const { ASSERT(!m_pendingRules); return m_viewportRules; } | |
| 100 const WillBeHeapVector<RawPtrWillBeMember<StyleRuleFontFace> >& fontFaceRule
s() const { return m_fontFaceRules; } | 99 const WillBeHeapVector<RawPtrWillBeMember<StyleRuleFontFace> >& fontFaceRule
s() const { return m_fontFaceRules; } |
| 101 const WillBeHeapVector<RawPtrWillBeMember<StyleRuleKeyframes> >& keyframesRu
les() const { return m_keyframesRules; } | 100 const WillBeHeapVector<RawPtrWillBeMember<StyleRuleKeyframes> >& keyframesRu
les() const { return m_keyframesRules; } |
| 102 const MediaQueryResultList& viewportDependentMediaQueryResults() const { ret
urn m_viewportDependentMediaQueryResults; } | 101 const MediaQueryResultList& viewportDependentMediaQueryResults() const { ret
urn m_viewportDependentMediaQueryResults; } |
| 103 | 102 |
| 104 unsigned ruleCount() const { return m_ruleCount; } | 103 unsigned ruleCount() const { return m_ruleCount; } |
| 105 | 104 |
| 106 void compactRulesIfNeeded() | 105 void compactRulesIfNeeded() |
| 107 { | 106 { |
| 108 if (!m_pendingRules) | 107 if (!m_pendingRules) |
| 109 return; | 108 return; |
| 110 compactRules(); | 109 compactRules(); |
| 111 } | 110 } |
| 112 | 111 |
| 113 #ifndef NDEBUG | 112 #ifndef NDEBUG |
| 114 void show(); | 113 void show(); |
| 115 #endif | 114 #endif |
| 116 | 115 |
| 117 void trace(Visitor*); | 116 void trace(Visitor*); |
| 118 | 117 |
| 119 private: | 118 private: |
| 120 typedef WillBeHeapHashMap<AtomicString, OwnPtrWillBeMember<WillBeHeapLinkedS
tack<RuleData> > > PendingRuleMap; | 119 typedef WillBeHeapHashMap<AtomicString, OwnPtrWillBeMember<WillBeHeapLinkedS
tack<RuleData> > > PendingRuleMap; |
| 121 typedef WillBeHeapHashMap<AtomicString, OwnPtrWillBeMember<WillBeHeapTermina
tedArray<RuleData> > > CompactRuleMap; | 120 typedef WillBeHeapHashMap<AtomicString, OwnPtrWillBeMember<WillBeHeapTermina
tedArray<RuleData> > > CompactRuleMap; |
| 122 | 121 |
| 123 RuleSet() | 122 RuleSet() |
| 124 : m_ruleCount(0) | 123 : m_ruleCount(0) |
| 125 { | 124 { |
| 126 } | 125 } |
| 127 | 126 |
| 128 void addToRuleSet(const AtomicString& key, PendingRuleMap&, const RuleData&)
; | 127 void addToRuleSet(const AtomicString& key, PendingRuleMap&, const RuleData&)
; |
| 129 void addViewportRule(StyleRuleViewport*); | |
| 130 void addFontFaceRule(StyleRuleFontFace*); | 128 void addFontFaceRule(StyleRuleFontFace*); |
| 131 void addKeyframesRule(StyleRuleKeyframes*); | 129 void addKeyframesRule(StyleRuleKeyframes*); |
| 132 | 130 |
| 133 void addChildRules(const WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>
>&, const MediaQueryEvaluator& medium, AddRuleFlags); | 131 void addChildRules(const WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>
>&, const MediaQueryEvaluator& medium, AddRuleFlags); |
| 134 bool findBestRuleSetAndAdd(const CSSSelector&, RuleData&); | 132 bool findBestRuleSetAndAdd(const CSSSelector&, RuleData&); |
| 135 | 133 |
| 136 void compactRules(); | 134 void compactRules(); |
| 137 static void compactPendingRules(PendingRuleMap&, CompactRuleMap&); | 135 static void compactPendingRules(PendingRuleMap&, CompactRuleMap&); |
| 138 | 136 |
| 139 class PendingRuleMaps : public NoBaseWillBeGarbageCollected<PendingRuleMaps>
{ | 137 class PendingRuleMaps : public NoBaseWillBeGarbageCollected<PendingRuleMaps>
{ |
| (...skipping 17 matching lines...) Expand all Loading... |
| 157 m_pendingRules = PendingRuleMaps::create(); | 155 m_pendingRules = PendingRuleMaps::create(); |
| 158 return m_pendingRules.get(); | 156 return m_pendingRules.get(); |
| 159 } | 157 } |
| 160 | 158 |
| 161 CompactRuleMap m_idRules; | 159 CompactRuleMap m_idRules; |
| 162 CompactRuleMap m_classRules; | 160 CompactRuleMap m_classRules; |
| 163 CompactRuleMap m_tagRules; | 161 CompactRuleMap m_tagRules; |
| 164 CompactRuleMap m_shadowPseudoElementRules; | 162 CompactRuleMap m_shadowPseudoElementRules; |
| 165 WillBeHeapVector<RuleData> m_universalRules; | 163 WillBeHeapVector<RuleData> m_universalRules; |
| 166 RuleFeatureSet m_features; | 164 RuleFeatureSet m_features; |
| 167 WillBeHeapVector<RawPtrWillBeMember<StyleRuleViewport> > m_viewportRules; | |
| 168 WillBeHeapVector<RawPtrWillBeMember<StyleRuleFontFace> > m_fontFaceRules; | 165 WillBeHeapVector<RawPtrWillBeMember<StyleRuleFontFace> > m_fontFaceRules; |
| 169 WillBeHeapVector<RawPtrWillBeMember<StyleRuleKeyframes> > m_keyframesRules; | 166 WillBeHeapVector<RawPtrWillBeMember<StyleRuleKeyframes> > m_keyframesRules; |
| 170 | 167 |
| 171 MediaQueryResultList m_viewportDependentMediaQueryResults; | 168 MediaQueryResultList m_viewportDependentMediaQueryResults; |
| 172 | 169 |
| 173 unsigned m_ruleCount; | 170 unsigned m_ruleCount; |
| 174 OwnPtrWillBeMember<PendingRuleMaps> m_pendingRules; | 171 OwnPtrWillBeMember<PendingRuleMaps> m_pendingRules; |
| 175 | 172 |
| 176 #ifndef NDEBUG | 173 #ifndef NDEBUG |
| 177 WillBeHeapVector<RuleData> m_allRules; | 174 WillBeHeapVector<RuleData> m_allRules; |
| 178 #endif | 175 #endif |
| 179 }; | 176 }; |
| 180 | 177 |
| 181 } // namespace blink | 178 } // namespace blink |
| 182 | 179 |
| 183 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::RuleData); | 180 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::RuleData); |
| 184 | 181 |
| 185 #endif // RuleSet_h | 182 #endif // RuleSet_h |
| OLD | NEW |