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

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

Issue 953693002: InlinedVisitor: Migrate css to use inlined tracing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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
OLDNEW
1 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2002, 2006, 2008, 2012, 2013 Apple Inc. All rights reserved. 4 * Copyright (C) 2002, 2006, 2008, 2012, 2013 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 { 70 {
71 if (derefBase()) 71 if (derefBase())
72 destroy(); 72 destroy();
73 } 73 }
74 #endif // !ENABLE(OILPAN) 74 #endif // !ENABLE(OILPAN)
75 75
76 // FIXME: There shouldn't be any need for the null parent version. 76 // FIXME: There shouldn't be any need for the null parent version.
77 PassRefPtrWillBeRawPtr<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentShee t = 0) const; 77 PassRefPtrWillBeRawPtr<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentShee t = 0) const;
78 PassRefPtrWillBeRawPtr<CSSRule> createCSSOMWrapper(CSSRule* parentRule) cons t; 78 PassRefPtrWillBeRawPtr<CSSRule> createCSSOMWrapper(CSSRule* parentRule) cons t;
79 79
80 void trace(Visitor*); 80 DECLARE_TRACE();
81 void traceAfterDispatch(Visitor*) { }; 81 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { };
82 void finalizeGarbageCollectedObject(); 82 void finalizeGarbageCollectedObject();
83 83
84 protected: 84 protected:
85 StyleRuleBase(Type type) : m_type(type) { } 85 StyleRuleBase(Type type) : m_type(type) { }
86 StyleRuleBase(const StyleRuleBase& o) : m_type(o.m_type) { } 86 StyleRuleBase(const StyleRuleBase& o) : m_type(o.m_type) { }
87 87
88 ~StyleRuleBase() { } 88 ~StyleRuleBase() { }
89 89
90 private: 90 private:
91 void destroy(); 91 void destroy();
(...skipping 15 matching lines...) Expand all
107 MutableStylePropertySet& mutableProperties(); 107 MutableStylePropertySet& mutableProperties();
108 108
109 void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors ) { m_selectorList.adoptSelectorVector(selectors); } 109 void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors ) { m_selectorList.adoptSelectorVector(selectors); }
110 void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.a dopt(selectors); } 110 void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.a dopt(selectors); }
111 void setProperties(PassRefPtrWillBeRawPtr<StylePropertySet>); 111 void setProperties(PassRefPtrWillBeRawPtr<StylePropertySet>);
112 112
113 PassRefPtrWillBeRawPtr<StyleRule> copy() const { return adoptRefWillBeNoop(n ew StyleRule(*this)); } 113 PassRefPtrWillBeRawPtr<StyleRule> copy() const { return adoptRefWillBeNoop(n ew StyleRule(*this)); }
114 114
115 static unsigned averageSizeInBytes(); 115 static unsigned averageSizeInBytes();
116 116
117 void traceAfterDispatch(Visitor*); 117 DECLARE_TRACE_AFTER_DISPATCH();
118 118
119 private: 119 private:
120 StyleRule(); 120 StyleRule();
121 StyleRule(const StyleRule&); 121 StyleRule(const StyleRule&);
122 122
123 RefPtrWillBeMember<StylePropertySet> m_properties; // Cannot be null. 123 RefPtrWillBeMember<StylePropertySet> m_properties; // Cannot be null.
124 CSSSelectorList m_selectorList; 124 CSSSelectorList m_selectorList;
125 }; 125 };
126 126
127 class StyleRuleFontFace : public StyleRuleBase { 127 class StyleRuleFontFace : public StyleRuleBase {
128 public: 128 public:
129 static PassRefPtrWillBeRawPtr<StyleRuleFontFace> create() { return adoptRefW illBeNoop(new StyleRuleFontFace); } 129 static PassRefPtrWillBeRawPtr<StyleRuleFontFace> create() { return adoptRefW illBeNoop(new StyleRuleFontFace); }
130 130
131 ~StyleRuleFontFace(); 131 ~StyleRuleFontFace();
132 132
133 const StylePropertySet& properties() const { return *m_properties; } 133 const StylePropertySet& properties() const { return *m_properties; }
134 MutableStylePropertySet& mutableProperties(); 134 MutableStylePropertySet& mutableProperties();
135 135
136 void setProperties(PassRefPtrWillBeRawPtr<StylePropertySet>); 136 void setProperties(PassRefPtrWillBeRawPtr<StylePropertySet>);
137 137
138 PassRefPtrWillBeRawPtr<StyleRuleFontFace> copy() const { return adoptRefWill BeNoop(new StyleRuleFontFace(*this)); } 138 PassRefPtrWillBeRawPtr<StyleRuleFontFace> copy() const { return adoptRefWill BeNoop(new StyleRuleFontFace(*this)); }
139 139
140 void traceAfterDispatch(Visitor*); 140 DECLARE_TRACE_AFTER_DISPATCH();
141 141
142 private: 142 private:
143 StyleRuleFontFace(); 143 StyleRuleFontFace();
144 StyleRuleFontFace(const StyleRuleFontFace&); 144 StyleRuleFontFace(const StyleRuleFontFace&);
145 145
146 RefPtrWillBeMember<StylePropertySet> m_properties; // Cannot be null. 146 RefPtrWillBeMember<StylePropertySet> m_properties; // Cannot be null.
147 }; 147 };
148 148
149 class StyleRulePage : public StyleRuleBase { 149 class StyleRulePage : public StyleRuleBase {
150 public: 150 public:
151 static PassRefPtrWillBeRawPtr<StyleRulePage> create() { return adoptRefWillB eNoop(new StyleRulePage); } 151 static PassRefPtrWillBeRawPtr<StyleRulePage> create() { return adoptRefWillB eNoop(new StyleRulePage); }
152 152
153 ~StyleRulePage(); 153 ~StyleRulePage();
154 154
155 const CSSSelector* selector() const { return m_selectorList.first(); } 155 const CSSSelector* selector() const { return m_selectorList.first(); }
156 const StylePropertySet& properties() const { return *m_properties; } 156 const StylePropertySet& properties() const { return *m_properties; }
157 MutableStylePropertySet& mutableProperties(); 157 MutableStylePropertySet& mutableProperties();
158 158
159 void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors ) { m_selectorList.adoptSelectorVector(selectors); } 159 void parserAdoptSelectorVector(Vector<OwnPtr<CSSParserSelector> >& selectors ) { m_selectorList.adoptSelectorVector(selectors); }
160 void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.a dopt(selectors); } 160 void wrapperAdoptSelectorList(CSSSelectorList& selectors) { m_selectorList.a dopt(selectors); }
161 void setProperties(PassRefPtrWillBeRawPtr<StylePropertySet>); 161 void setProperties(PassRefPtrWillBeRawPtr<StylePropertySet>);
162 162
163 PassRefPtrWillBeRawPtr<StyleRulePage> copy() const { return adoptRefWillBeNo op(new StyleRulePage(*this)); } 163 PassRefPtrWillBeRawPtr<StyleRulePage> copy() const { return adoptRefWillBeNo op(new StyleRulePage(*this)); }
164 164
165 void traceAfterDispatch(Visitor*); 165 DECLARE_TRACE_AFTER_DISPATCH();
166 166
167 private: 167 private:
168 StyleRulePage(); 168 StyleRulePage();
169 StyleRulePage(const StyleRulePage&); 169 StyleRulePage(const StyleRulePage&);
170 170
171 RefPtrWillBeMember<StylePropertySet> m_properties; // Cannot be null. 171 RefPtrWillBeMember<StylePropertySet> m_properties; // Cannot be null.
172 CSSSelectorList m_selectorList; 172 CSSSelectorList m_selectorList;
173 }; 173 };
174 174
175 class StyleRuleGroup : public StyleRuleBase { 175 class StyleRuleGroup : public StyleRuleBase {
176 public: 176 public:
177 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase> >& childRules() con st { return m_childRules; } 177 const WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase> >& childRules() con st { return m_childRules; }
178 178
179 void wrapperInsertRule(unsigned, PassRefPtrWillBeRawPtr<StyleRuleBase>); 179 void wrapperInsertRule(unsigned, PassRefPtrWillBeRawPtr<StyleRuleBase>);
180 void wrapperRemoveRule(unsigned); 180 void wrapperRemoveRule(unsigned);
181 181
182 void traceAfterDispatch(Visitor*); 182 DECLARE_TRACE_AFTER_DISPATCH();
183 183
184 protected: 184 protected:
185 StyleRuleGroup(Type, WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase> >& a doptRule); 185 StyleRuleGroup(Type, WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase> >& a doptRule);
186 StyleRuleGroup(const StyleRuleGroup&); 186 StyleRuleGroup(const StyleRuleGroup&);
187 187
188 private: 188 private:
189 WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase> > m_childRules; 189 WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase> > m_childRules;
190 }; 190 };
191 191
192 class StyleRuleMedia : public StyleRuleGroup { 192 class StyleRuleMedia : public StyleRuleGroup {
193 public: 193 public:
194 static PassRefPtrWillBeRawPtr<StyleRuleMedia> create(PassRefPtrWillBeRawPtr< MediaQuerySet> media, WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase> >& adop tRules) 194 static PassRefPtrWillBeRawPtr<StyleRuleMedia> create(PassRefPtrWillBeRawPtr< MediaQuerySet> media, WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase> >& adop tRules)
195 { 195 {
196 return adoptRefWillBeNoop(new StyleRuleMedia(media, adoptRules)); 196 return adoptRefWillBeNoop(new StyleRuleMedia(media, adoptRules));
197 } 197 }
198 198
199 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); } 199 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); }
200 200
201 PassRefPtrWillBeRawPtr<StyleRuleMedia> copy() const { return adoptRefWillBeN oop(new StyleRuleMedia(*this)); } 201 PassRefPtrWillBeRawPtr<StyleRuleMedia> copy() const { return adoptRefWillBeN oop(new StyleRuleMedia(*this)); }
202 202
203 void traceAfterDispatch(Visitor*); 203 DECLARE_TRACE_AFTER_DISPATCH();
204 204
205 private: 205 private:
206 StyleRuleMedia(PassRefPtrWillBeRawPtr<MediaQuerySet>, WillBeHeapVector<RefPt rWillBeMember<StyleRuleBase> >& adoptRules); 206 StyleRuleMedia(PassRefPtrWillBeRawPtr<MediaQuerySet>, WillBeHeapVector<RefPt rWillBeMember<StyleRuleBase> >& adoptRules);
207 StyleRuleMedia(const StyleRuleMedia&); 207 StyleRuleMedia(const StyleRuleMedia&);
208 208
209 RefPtrWillBeMember<MediaQuerySet> m_mediaQueries; 209 RefPtrWillBeMember<MediaQuerySet> m_mediaQueries;
210 }; 210 };
211 211
212 class StyleRuleSupports : public StyleRuleGroup { 212 class StyleRuleSupports : public StyleRuleGroup {
213 public: 213 public:
214 static PassRefPtrWillBeRawPtr<StyleRuleSupports> create(const String& condit ionText, bool conditionIsSupported, WillBeHeapVector<RefPtrWillBeMember<StyleRul eBase> >& adoptRules) 214 static PassRefPtrWillBeRawPtr<StyleRuleSupports> create(const String& condit ionText, bool conditionIsSupported, WillBeHeapVector<RefPtrWillBeMember<StyleRul eBase> >& adoptRules)
215 { 215 {
216 return adoptRefWillBeNoop(new StyleRuleSupports(conditionText, condition IsSupported, adoptRules)); 216 return adoptRefWillBeNoop(new StyleRuleSupports(conditionText, condition IsSupported, adoptRules));
217 } 217 }
218 218
219 String conditionText() const { return m_conditionText; } 219 String conditionText() const { return m_conditionText; }
220 bool conditionIsSupported() const { return m_conditionIsSupported; } 220 bool conditionIsSupported() const { return m_conditionIsSupported; }
221 PassRefPtrWillBeRawPtr<StyleRuleSupports> copy() const { return adoptRefWill BeNoop(new StyleRuleSupports(*this)); } 221 PassRefPtrWillBeRawPtr<StyleRuleSupports> copy() const { return adoptRefWill BeNoop(new StyleRuleSupports(*this)); }
222 222
223 void traceAfterDispatch(Visitor* visitor) { StyleRuleGroup::traceAfterDispat ch(visitor); } 223 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { StyleRuleGroup::traceAfterDispatch(vi sitor); }
224 224
225 private: 225 private:
226 StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Wi llBeHeapVector<RefPtrWillBeMember<StyleRuleBase> >& adoptRules); 226 StyleRuleSupports(const String& conditionText, bool conditionIsSupported, Wi llBeHeapVector<RefPtrWillBeMember<StyleRuleBase> >& adoptRules);
227 StyleRuleSupports(const StyleRuleSupports&); 227 StyleRuleSupports(const StyleRuleSupports&);
228 228
229 String m_conditionText; 229 String m_conditionText;
230 bool m_conditionIsSupported; 230 bool m_conditionIsSupported;
231 }; 231 };
232 232
233 class StyleRuleViewport : public StyleRuleBase { 233 class StyleRuleViewport : public StyleRuleBase {
234 public: 234 public:
235 static PassRefPtrWillBeRawPtr<StyleRuleViewport> create() { return adoptRefW illBeNoop(new StyleRuleViewport); } 235 static PassRefPtrWillBeRawPtr<StyleRuleViewport> create() { return adoptRefW illBeNoop(new StyleRuleViewport); }
236 236
237 ~StyleRuleViewport(); 237 ~StyleRuleViewport();
238 238
239 const StylePropertySet& properties() const { return *m_properties; } 239 const StylePropertySet& properties() const { return *m_properties; }
240 MutableStylePropertySet& mutableProperties(); 240 MutableStylePropertySet& mutableProperties();
241 241
242 void setProperties(PassRefPtrWillBeRawPtr<StylePropertySet>); 242 void setProperties(PassRefPtrWillBeRawPtr<StylePropertySet>);
243 243
244 PassRefPtrWillBeRawPtr<StyleRuleViewport> copy() const { return adoptRefWill BeNoop(new StyleRuleViewport(*this)); } 244 PassRefPtrWillBeRawPtr<StyleRuleViewport> copy() const { return adoptRefWill BeNoop(new StyleRuleViewport(*this)); }
245 245
246 void traceAfterDispatch(Visitor*); 246 DECLARE_TRACE_AFTER_DISPATCH();
247 247
248 private: 248 private:
249 StyleRuleViewport(); 249 StyleRuleViewport();
250 StyleRuleViewport(const StyleRuleViewport&); 250 StyleRuleViewport(const StyleRuleViewport&);
251 251
252 RefPtrWillBeMember<StylePropertySet> m_properties; // Cannot be null 252 RefPtrWillBeMember<StylePropertySet> m_properties; // Cannot be null
253 }; 253 };
254 254
255 #define DEFINE_STYLE_RULE_TYPE_CASTS(Type) \ 255 #define DEFINE_STYLE_RULE_TYPE_CASTS(Type) \
256 DEFINE_TYPE_CASTS(StyleRule##Type, StyleRuleBase, rule, rule->is##Type##Rule (), rule.is##Type##Rule()) 256 DEFINE_TYPE_CASTS(StyleRule##Type, StyleRuleBase, rule, rule->is##Type##Rule (), rule.is##Type##Rule())
257 257
258 DEFINE_TYPE_CASTS(StyleRule, StyleRuleBase, rule, rule->isStyleRule(), rule.isSt yleRule()); 258 DEFINE_TYPE_CASTS(StyleRule, StyleRuleBase, rule, rule->isStyleRule(), rule.isSt yleRule());
259 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace); 259 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace);
260 DEFINE_STYLE_RULE_TYPE_CASTS(Page); 260 DEFINE_STYLE_RULE_TYPE_CASTS(Page);
261 DEFINE_STYLE_RULE_TYPE_CASTS(Media); 261 DEFINE_STYLE_RULE_TYPE_CASTS(Media);
262 DEFINE_STYLE_RULE_TYPE_CASTS(Supports); 262 DEFINE_STYLE_RULE_TYPE_CASTS(Supports);
263 DEFINE_STYLE_RULE_TYPE_CASTS(Viewport); 263 DEFINE_STYLE_RULE_TYPE_CASTS(Viewport);
264 264
265 } // namespace blink 265 } // namespace blink
266 266
267 #endif // StyleRule_h 267 #endif // StyleRule_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698