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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/http/tests/security/resources/xorigincss7.html ('k') | Source/core/css/StyleRule.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/StyleRule.h
diff --git a/Source/core/css/StyleRule.h b/Source/core/css/StyleRule.h
index d99f0e192844c795fa595dd5f55b59ef89b09199..5531b8309bb04b265bc50dc64c757bd24892782b 100644
--- a/Source/core/css/StyleRule.h
+++ b/Source/core/css/StyleRule.h
@@ -39,6 +39,7 @@ class StyleRuleBase : public RefCountedWillBeGarbageCollectedFinalized<StyleRule
public:
enum Type {
Unknown,
+ Charset,
Style,
Import,
Media,
@@ -53,6 +54,7 @@ public:
Type type() const { return static_cast<Type>(m_type); }
+ bool isCharsetRule() const { return type() == Charset; }
bool isFontFaceRule() const { return type() == FontFace; }
bool isKeyframesRule() const { return type() == Keyframes; }
bool isKeyframeRule() const { return type() == Keyframe; }
@@ -253,6 +255,18 @@ private:
RefPtrWillBeMember<StylePropertySet> m_properties; // Cannot be null
};
+// This should only be used within the CSS Parser
+class StyleRuleCharset : public StyleRuleBase {
+ WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
+public:
+ static PassRefPtrWillBeRawPtr<StyleRuleCharset> create() { return adoptRefWillBeNoop(new StyleRuleCharset()); }
+ DEFINE_INLINE_TRACE_AFTER_DISPATCH() { StyleRuleBase::traceAfterDispatch(visitor); };
+
+private:
+ StyleRuleCharset() : StyleRuleBase(Charset) { }
+};
+
+
#define DEFINE_STYLE_RULE_TYPE_CASTS(Type) \
DEFINE_TYPE_CASTS(StyleRule##Type, StyleRuleBase, rule, rule->is##Type##Rule(), rule.is##Type##Rule())
@@ -262,6 +276,7 @@ DEFINE_STYLE_RULE_TYPE_CASTS(Page);
DEFINE_STYLE_RULE_TYPE_CASTS(Media);
DEFINE_STYLE_RULE_TYPE_CASTS(Supports);
DEFINE_STYLE_RULE_TYPE_CASTS(Viewport);
+DEFINE_STYLE_RULE_TYPE_CASTS(Charset);
} // namespace blink
« 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