diff --git a/Userland/Libraries/LibWeb/CSS/CSSRule.h b/Userland/Libraries/LibWeb/CSS/CSSRule.h index ec7f9f29d9..ece51f8f14 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSRule.h +++ b/Userland/Libraries/LibWeb/CSS/CSSRule.h @@ -24,13 +24,13 @@ public: virtual ~CSSRule() = default; - enum class Type : u32 { - Style, - Import, - Media, - Supports, - FontFace, - __Count, + // https://drafts.csswg.org/cssom/#dom-cssrule-type + enum class Type : u16 { + Style = 1, + Import = 3, + Media = 4, + FontFace = 5, + Supports = 12, }; virtual StringView class_name() const = 0; diff --git a/Userland/Libraries/LibWeb/CSS/CSSRule.idl b/Userland/Libraries/LibWeb/CSS/CSSRule.idl index 03c5a6d01a..b2d416c6f8 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSRule.idl +++ b/Userland/Libraries/LibWeb/CSS/CSSRule.idl @@ -2,4 +2,16 @@ interface CSSRule { attribute CSSOMString cssText; + readonly attribute unsigned short type; + + const unsigned short STYLE_RULE = 1; + const unsigned short CHARSET_RULE = 2; + const unsigned short IMPORT_RULE = 3; + const unsigned short MEDIA_RULE = 4; + const unsigned short FONT_FACE_RULE = 5; + const unsigned short PAGE_RULE = 6; + const unsigned short MARGIN_RULE = 9; + const unsigned short NAMESPACE_RULE = 10; + const unsigned short SUPPORTS_RULE = 12; + }; diff --git a/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp b/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp index 650dac3765..dbd55a1fdd 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp +++ b/Userland/Libraries/LibWeb/CSS/CSSRuleList.cpp @@ -95,8 +95,6 @@ void CSSRuleList::for_each_effective_style_rule(Function(rule).for_each_effective_style_rule(callback); break; - case CSSRule::Type::__Count: - VERIFY_NOT_REACHED(); } } } @@ -133,8 +131,6 @@ bool CSSRuleList::evaluate_media_queries(HTML::Window const& window) any_media_queries_changed_match_state = true; break; } - case CSSRule::Type::__Count: - VERIFY_NOT_REACHED(); } } diff --git a/Userland/Libraries/LibWeb/Dump.cpp b/Userland/Libraries/LibWeb/Dump.cpp index c08352f876..e0d625b4c0 100644 --- a/Userland/Libraries/LibWeb/Dump.cpp +++ b/Userland/Libraries/LibWeb/Dump.cpp @@ -563,8 +563,6 @@ void dump_rule(StringBuilder& builder, CSS::CSSRule const& rule, int indent_leve case CSS::CSSRule::Type::Supports: dump_supports_rule(builder, verify_cast(rule), indent_levels); break; - case CSS::CSSRule::Type::__Count: - VERIFY_NOT_REACHED(); } }