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

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

Issue 1018213004: CSS Parser: Mark on stylesheets whether the first rule was valid (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 21 matching lines...) Expand all
32 class CSSRule; 32 class CSSRule;
33 class CSSStyleSheet; 33 class CSSStyleSheet;
34 class MutableStylePropertySet; 34 class MutableStylePropertySet;
35 class StylePropertySet; 35 class StylePropertySet;
36 36
37 class StyleRuleBase : public RefCountedWillBeGarbageCollectedFinalized<StyleRule Base> { 37 class StyleRuleBase : public RefCountedWillBeGarbageCollectedFinalized<StyleRule Base> {
38 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; 38 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
39 public: 39 public:
40 enum Type { 40 enum Type {
41 Unknown, 41 Unknown,
42 Charset,
42 Style, 43 Style,
43 Import, 44 Import,
44 Media, 45 Media,
45 FontFace, 46 FontFace,
46 Page, 47 Page,
47 Keyframes, 48 Keyframes,
48 Keyframe, 49 Keyframe,
49 Namespace, 50 Namespace,
50 Supports, 51 Supports,
51 Viewport, 52 Viewport,
52 }; 53 };
53 54
54 Type type() const { return static_cast<Type>(m_type); } 55 Type type() const { return static_cast<Type>(m_type); }
55 56
57 bool isCharsetRule() const { return type() == Charset; }
56 bool isFontFaceRule() const { return type() == FontFace; } 58 bool isFontFaceRule() const { return type() == FontFace; }
57 bool isKeyframesRule() const { return type() == Keyframes; } 59 bool isKeyframesRule() const { return type() == Keyframes; }
58 bool isKeyframeRule() const { return type() == Keyframe; } 60 bool isKeyframeRule() const { return type() == Keyframe; }
59 bool isNamespaceRule() const { return type() == Namespace; } 61 bool isNamespaceRule() const { return type() == Namespace; }
60 bool isMediaRule() const { return type() == Media; } 62 bool isMediaRule() const { return type() == Media; }
61 bool isPageRule() const { return type() == Page; } 63 bool isPageRule() const { return type() == Page; }
62 bool isStyleRule() const { return type() == Style; } 64 bool isStyleRule() const { return type() == Style; }
63 bool isSupportsRule() const { return type() == Supports; } 65 bool isSupportsRule() const { return type() == Supports; }
64 bool isViewportRule() const { return type() == Viewport; } 66 bool isViewportRule() const { return type() == Viewport; }
65 bool isImportRule() const { return type() == Import; } 67 bool isImportRule() const { return type() == Import; }
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 248
247 DECLARE_TRACE_AFTER_DISPATCH(); 249 DECLARE_TRACE_AFTER_DISPATCH();
248 250
249 private: 251 private:
250 StyleRuleViewport(); 252 StyleRuleViewport();
251 StyleRuleViewport(const StyleRuleViewport&); 253 StyleRuleViewport(const StyleRuleViewport&);
252 254
253 RefPtrWillBeMember<StylePropertySet> m_properties; // Cannot be null 255 RefPtrWillBeMember<StylePropertySet> m_properties; // Cannot be null
254 }; 256 };
255 257
258 // This should only be used within the CSS Parser
259 class StyleRuleCharset : public StyleRuleBase {
260 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
261 public:
262 static PassRefPtrWillBeRawPtr<StyleRuleCharset> create() { return adoptRefWi llBeNoop(new StyleRuleCharset()); }
263 DEFINE_INLINE_TRACE_AFTER_DISPATCH() { StyleRuleBase::traceAfterDispatch(vis itor); };
264
265 private:
266 StyleRuleCharset() : StyleRuleBase(Charset) { }
267 };
268
269
256 #define DEFINE_STYLE_RULE_TYPE_CASTS(Type) \ 270 #define DEFINE_STYLE_RULE_TYPE_CASTS(Type) \
257 DEFINE_TYPE_CASTS(StyleRule##Type, StyleRuleBase, rule, rule->is##Type##Rule (), rule.is##Type##Rule()) 271 DEFINE_TYPE_CASTS(StyleRule##Type, StyleRuleBase, rule, rule->is##Type##Rule (), rule.is##Type##Rule())
258 272
259 DEFINE_TYPE_CASTS(StyleRule, StyleRuleBase, rule, rule->isStyleRule(), rule.isSt yleRule()); 273 DEFINE_TYPE_CASTS(StyleRule, StyleRuleBase, rule, rule->isStyleRule(), rule.isSt yleRule());
260 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace); 274 DEFINE_STYLE_RULE_TYPE_CASTS(FontFace);
261 DEFINE_STYLE_RULE_TYPE_CASTS(Page); 275 DEFINE_STYLE_RULE_TYPE_CASTS(Page);
262 DEFINE_STYLE_RULE_TYPE_CASTS(Media); 276 DEFINE_STYLE_RULE_TYPE_CASTS(Media);
263 DEFINE_STYLE_RULE_TYPE_CASTS(Supports); 277 DEFINE_STYLE_RULE_TYPE_CASTS(Supports);
264 DEFINE_STYLE_RULE_TYPE_CASTS(Viewport); 278 DEFINE_STYLE_RULE_TYPE_CASTS(Viewport);
279 DEFINE_STYLE_RULE_TYPE_CASTS(Charset);
265 280
266 } // namespace blink 281 } // namespace blink
267 282
268 #endif // StyleRule_h 283 #endif // StyleRule_h
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/security/resources/xorigincss7.html ('k') | Source/core/css/StyleRule.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698