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

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

Issue 2416893002: CSSMediaRule and CSSSupportsRule inherit from CSSConditionRule (Closed)
Patch Set: Fix tracing Created 4 years, 2 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
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 DECLARE_TRACE_AFTER_DISPATCH(); 188 DECLARE_TRACE_AFTER_DISPATCH();
189 189
190 protected: 190 protected:
191 StyleRuleGroup(RuleType, HeapVector<Member<StyleRuleBase>>& adoptRule); 191 StyleRuleGroup(RuleType, HeapVector<Member<StyleRuleBase>>& adoptRule);
192 StyleRuleGroup(const StyleRuleGroup&); 192 StyleRuleGroup(const StyleRuleGroup&);
193 193
194 private: 194 private:
195 HeapVector<Member<StyleRuleBase>> m_childRules; 195 HeapVector<Member<StyleRuleBase>> m_childRules;
196 }; 196 };
197 197
198 class CORE_EXPORT StyleRuleMedia : public StyleRuleGroup { 198 class CORE_EXPORT StyleRuleCondition : public StyleRuleGroup {
199 public:
200 String conditionText() const { return m_conditionText; }
201
202 DEFINE_INLINE_TRACE_AFTER_DISPATCH() {
203 StyleRuleGroup::traceAfterDispatch(visitor);
204 }
205
206 protected:
207 StyleRuleCondition(RuleType, HeapVector<Member<StyleRuleBase>>& adoptRule);
208 StyleRuleCondition(RuleType,
209 const String& conditionText,
210 HeapVector<Member<StyleRuleBase>>& adoptRule);
211 StyleRuleCondition(const StyleRuleCondition&);
212 String m_conditionText;
213 };
214
215 class CORE_EXPORT StyleRuleMedia : public StyleRuleCondition {
199 public: 216 public:
200 static StyleRuleMedia* create(MediaQuerySet* media, 217 static StyleRuleMedia* create(MediaQuerySet* media,
201 HeapVector<Member<StyleRuleBase>>& adoptRules) { 218 HeapVector<Member<StyleRuleBase>>& adoptRules) {
202 return new StyleRuleMedia(media, adoptRules); 219 return new StyleRuleMedia(media, adoptRules);
203 } 220 }
204 221
205 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); } 222 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); }
206 223
207 StyleRuleMedia* copy() const { return new StyleRuleMedia(*this); } 224 StyleRuleMedia* copy() const { return new StyleRuleMedia(*this); }
208 225
209 DECLARE_TRACE_AFTER_DISPATCH(); 226 DECLARE_TRACE_AFTER_DISPATCH();
210 227
211 private: 228 private:
212 StyleRuleMedia(MediaQuerySet*, HeapVector<Member<StyleRuleBase>>& adoptRules); 229 StyleRuleMedia(MediaQuerySet*, HeapVector<Member<StyleRuleBase>>& adoptRules);
213 StyleRuleMedia(const StyleRuleMedia&); 230 StyleRuleMedia(const StyleRuleMedia&);
214 231
215 Member<MediaQuerySet> m_mediaQueries; 232 Member<MediaQuerySet> m_mediaQueries;
216 }; 233 };
217 234
218 class StyleRuleSupports : public StyleRuleGroup { 235 class StyleRuleSupports : public StyleRuleCondition {
219 public: 236 public:
220 static StyleRuleSupports* create( 237 static StyleRuleSupports* create(
221 const String& conditionText, 238 const String& conditionText,
222 bool conditionIsSupported, 239 bool conditionIsSupported,
223 HeapVector<Member<StyleRuleBase>>& adoptRules) { 240 HeapVector<Member<StyleRuleBase>>& adoptRules) {
224 return new StyleRuleSupports(conditionText, conditionIsSupported, 241 return new StyleRuleSupports(conditionText, conditionIsSupported,
225 adoptRules); 242 adoptRules);
226 } 243 }
227 244
228 String conditionText() const { return m_conditionText; }
229 bool conditionIsSupported() const { return m_conditionIsSupported; } 245 bool conditionIsSupported() const { return m_conditionIsSupported; }
230 StyleRuleSupports* copy() const { return new StyleRuleSupports(*this); } 246 StyleRuleSupports* copy() const { return new StyleRuleSupports(*this); }
231 247
232 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { 248 DEFINE_INLINE_TRACE_AFTER_DISPATCH() {
233 StyleRuleGroup::traceAfterDispatch(visitor); 249 StyleRuleCondition::traceAfterDispatch(visitor);
234 } 250 }
235 251
236 private: 252 private:
237 StyleRuleSupports(const String& conditionText, 253 StyleRuleSupports(const String& conditionText,
238 bool conditionIsSupported, 254 bool conditionIsSupported,
239 HeapVector<Member<StyleRuleBase>>& adoptRules); 255 HeapVector<Member<StyleRuleBase>>& adoptRules);
240 StyleRuleSupports(const StyleRuleSupports&); 256 StyleRuleSupports(const StyleRuleSupports&);
241 257
242 String m_conditionText; 258 String m_conditionText;
243 bool m_conditionIsSupported; 259 bool m_conditionIsSupported;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace); 305 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace);
290 DEFINE_STYLE_RULE_TYPE_CASTS(Page); 306 DEFINE_STYLE_RULE_TYPE_CASTS(Page);
291 DEFINE_STYLE_RULE_TYPE_CASTS(Media); 307 DEFINE_STYLE_RULE_TYPE_CASTS(Media);
292 DEFINE_STYLE_RULE_TYPE_CASTS(Supports); 308 DEFINE_STYLE_RULE_TYPE_CASTS(Supports);
293 DEFINE_STYLE_RULE_TYPE_CASTS(Viewport); 309 DEFINE_STYLE_RULE_TYPE_CASTS(Viewport);
294 DEFINE_STYLE_RULE_TYPE_CASTS(Charset); 310 DEFINE_STYLE_RULE_TYPE_CASTS(Charset);
295 311
296 } // namespace blink 312 } // namespace blink
297 313
298 #endif // StyleRule_h 314 #endif // StyleRule_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSupportsRule.idl ('k') | third_party/WebKit/Source/core/css/StyleRule.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698