Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Side by Side Diff: Source/core/css/RuleSet.h

Issue 19804005: Remove AtomicStringImpl. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/css/RuleFeature.h ('k') | Source/core/css/RuleSet.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 WTF_MAKE_NONCOPYABLE(RuleSet); WTF_MAKE_FAST_ALLOCATED; 101 WTF_MAKE_NONCOPYABLE(RuleSet); WTF_MAKE_FAST_ALLOCATED;
102 public: 102 public:
103 static PassOwnPtr<RuleSet> create() { return adoptPtr(new RuleSet); } 103 static PassOwnPtr<RuleSet> create() { return adoptPtr(new RuleSet); }
104 104
105 void addRulesFromSheet(StyleSheetContents*, const MediaQueryEvaluator&, Styl eResolver* = 0, const ContainerNode* = 0); 105 void addRulesFromSheet(StyleSheetContents*, const MediaQueryEvaluator&, Styl eResolver* = 0, const ContainerNode* = 0);
106 void addStyleRule(StyleRule*, AddRuleFlags); 106 void addStyleRule(StyleRule*, AddRuleFlags);
107 void addRule(StyleRule*, unsigned selectorIndex, AddRuleFlags); 107 void addRule(StyleRule*, unsigned selectorIndex, AddRuleFlags);
108 108
109 const RuleFeatureSet& features() const { return m_features; } 109 const RuleFeatureSet& features() const { return m_features; }
110 110
111 const RuleData* idRules(AtomicStringImpl* key) const { ASSERT(!m_pendingRule s); return m_idRules.get(key); } 111 const RuleData* idRules(StringImpl* key) const { ASSERT(!m_pendingRules); re turn m_idRules.get(key); }
112 const RuleData* classRules(AtomicStringImpl* key) const { ASSERT(!m_pendingR ules); return m_classRules.get(key); } 112 const RuleData* classRules(StringImpl* key) const { ASSERT(!m_pendingRules); return m_classRules.get(key); }
113 const RuleData* tagRules(AtomicStringImpl* key) const { ASSERT(!m_pendingRul es); return m_tagRules.get(key); } 113 const RuleData* tagRules(StringImpl* key) const { ASSERT(!m_pendingRules); r eturn m_tagRules.get(key); }
114 const RuleData* shadowPseudoElementRules(AtomicStringImpl* key) const { ASSE RT(!m_pendingRules); return m_shadowPseudoElementRules.get(key); } 114 const RuleData* shadowPseudoElementRules(StringImpl* key) const { ASSERT(!m_ pendingRules); return m_shadowPseudoElementRules.get(key); }
115 const Vector<RuleData>* linkPseudoClassRules() const { ASSERT(!m_pendingRule s); return &m_linkPseudoClassRules; } 115 const Vector<RuleData>* linkPseudoClassRules() const { ASSERT(!m_pendingRule s); return &m_linkPseudoClassRules; }
116 const Vector<RuleData>* cuePseudoRules() const { ASSERT(!m_pendingRules); re turn &m_cuePseudoRules; } 116 const Vector<RuleData>* cuePseudoRules() const { ASSERT(!m_pendingRules); re turn &m_cuePseudoRules; }
117 const Vector<RuleData>* focusPseudoClassRules() const { ASSERT(!m_pendingRul es); return &m_focusPseudoClassRules; } 117 const Vector<RuleData>* focusPseudoClassRules() const { ASSERT(!m_pendingRul es); return &m_focusPseudoClassRules; }
118 const Vector<RuleData>* universalRules() const { ASSERT(!m_pendingRules); re turn &m_universalRules; } 118 const Vector<RuleData>* universalRules() const { ASSERT(!m_pendingRules); re turn &m_universalRules; }
119 const Vector<StyleRulePage*>& pageRules() const { ASSERT(!m_pendingRules); r eturn m_pageRules; } 119 const Vector<StyleRulePage*>& pageRules() const { ASSERT(!m_pendingRules); r eturn m_pageRules; }
120 const Vector<StyleRuleViewport*>& viewportRules() const { ASSERT(!m_pendingR ules); return m_viewportRules; } 120 const Vector<StyleRuleViewport*>& viewportRules() const { ASSERT(!m_pendingR ules); return m_viewportRules; }
121 121
122 unsigned ruleCount() const { return m_ruleCount; } 122 unsigned ruleCount() const { return m_ruleCount; }
123 123
124 void compactRulesIfNeeded() 124 void compactRulesIfNeeded()
125 { 125 {
126 if (!m_pendingRules) 126 if (!m_pendingRules)
127 return; 127 return;
128 compactRules(); 128 compactRules();
129 } 129 }
130 130
131 struct RuleSetSelectorPair { 131 struct RuleSetSelectorPair {
132 RuleSetSelectorPair(const CSSSelector* selector, PassOwnPtr<RuleSet> rul eSet) : selector(selector), ruleSet(ruleSet) { } 132 RuleSetSelectorPair(const CSSSelector* selector, PassOwnPtr<RuleSet> rul eSet) : selector(selector), ruleSet(ruleSet) { }
133 RuleSetSelectorPair(const RuleSetSelectorPair& rs) : selector(rs.selecto r), ruleSet(const_cast<RuleSetSelectorPair*>(&rs)->ruleSet.release()) { } 133 RuleSetSelectorPair(const RuleSetSelectorPair& rs) : selector(rs.selecto r), ruleSet(const_cast<RuleSetSelectorPair*>(&rs)->ruleSet.release()) { }
134 134
135 const CSSSelector* selector; 135 const CSSSelector* selector;
136 OwnPtr<RuleSet> ruleSet; 136 OwnPtr<RuleSet> ruleSet;
137 }; 137 };
138 138
139 Vector<RuleSetSelectorPair> m_regionSelectorsAndRuleSets; 139 Vector<RuleSetSelectorPair> m_regionSelectorsAndRuleSets;
140 140
141 private: 141 private:
142 typedef HashMap<AtomicStringImpl*, OwnPtr<LinkedStack<RuleData> > > PendingR uleMap; 142 typedef HashMap<StringImpl*, OwnPtr<LinkedStack<RuleData> > > PendingRuleMap ;
143 typedef HashMap<AtomicStringImpl*, OwnPtr<RuleData> > CompactRuleMap; 143 typedef HashMap<StringImpl*, OwnPtr<RuleData> > CompactRuleMap;
144 144
145 RuleSet() 145 RuleSet()
146 : m_ruleCount(0) 146 : m_ruleCount(0)
147 { 147 {
148 } 148 }
149 149
150 void addToRuleSet(AtomicStringImpl* key, PendingRuleMap&, const RuleData&); 150 void addToRuleSet(StringImpl* key, PendingRuleMap&, const RuleData&);
151 void addPageRule(StyleRulePage*); 151 void addPageRule(StyleRulePage*);
152 void addViewportRule(StyleRuleViewport*); 152 void addViewportRule(StyleRuleViewport*);
153 void addRegionRule(StyleRuleRegion*, bool hasDocumentSecurityOrigin); 153 void addRegionRule(StyleRuleRegion*, bool hasDocumentSecurityOrigin);
154 154
155 void addChildRules(const Vector<RefPtr<StyleRuleBase> >&, const MediaQueryEv aluator& medium, StyleResolver*, const ContainerNode* scope, bool hasDocumentSec urityOrigin, AddRuleFlags); 155 void addChildRules(const Vector<RefPtr<StyleRuleBase> >&, const MediaQueryEv aluator& medium, StyleResolver*, const ContainerNode* scope, bool hasDocumentSec urityOrigin, AddRuleFlags);
156 bool findBestRuleSetAndAdd(const CSSSelector*, RuleData&); 156 bool findBestRuleSetAndAdd(const CSSSelector*, RuleData&);
157 157
158 void compactRules(); 158 void compactRules();
159 static void compactPendingRules(PendingRuleMap&, CompactRuleMap&); 159 static void compactPendingRules(PendingRuleMap&, CompactRuleMap&);
160 160
(...skipping 23 matching lines...) Expand all
184 Vector<StyleRulePage*> m_pageRules; 184 Vector<StyleRulePage*> m_pageRules;
185 Vector<StyleRuleViewport*> m_viewportRules; 185 Vector<StyleRuleViewport*> m_viewportRules;
186 186
187 unsigned m_ruleCount; 187 unsigned m_ruleCount;
188 OwnPtr<PendingRuleMaps> m_pendingRules; 188 OwnPtr<PendingRuleMaps> m_pendingRules;
189 }; 189 };
190 190
191 } // namespace WebCore 191 } // namespace WebCore
192 192
193 #endif // RuleSet_h 193 #endif // RuleSet_h
OLDNEW
« no previous file with comments | « Source/core/css/RuleFeature.h ('k') | Source/core/css/RuleSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698