<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[286916] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/286916">286916</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2021-12-11 10:28:39 -0800 (Sat, 11 Dec 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove redundant StyleRule::Type enum
https://bugs.webkit.org/show_bug.cgi?id=234156

Reviewed by Alan Bujtas.

Source/WebCore:

Remove redundant CSSRule::STYLE_RULE etc enum values and just use StyleRuleType enum class.

* bindings/js/JSCSSRuleCustom.cpp:
(WebCore::toJSNewlyCreated):
* bindings/scripts/CodeGenerator.pm:
(GenerateCompileTimeCheckForEnumsIfNeeded):

Add 'ConstantsEnum' attribute to generate static_asserts for constants that match an enum class.

* bindings/scripts/IDLAttributes.json:
* css/CSSCounterStyleRule.h:
* css/CSSFontFaceRule.h:
* css/CSSFontPaletteValuesRule.h:
* css/CSSImportRule.h:
* css/CSSKeyframeRule.h:
* css/CSSKeyframesRule.h:
* css/CSSLayerBlockRule.h:
* css/CSSLayerStatementRule.h:
* css/CSSMediaRule.h:
* css/CSSNamespaceRule.h:
* css/CSSPageRule.h:
* css/CSSRule.cpp:
* css/CSSRule.h:
(WebCore::CSSRule::typeForBindings const):
* css/CSSRule.idl:
* css/CSSStyleRule.h:
* css/CSSSupportsRule.h:
* css/CSSUnknownRule.h:
* css/StyleRuleType.h:
* style/InspectorCSSOMWrappers.cpp:
(WebCore::Style::InspectorCSSOMWrappers::collect):

Source/WebKitLegacy/mac:

* DOM/DOMCSS.mm:
(kitClass):
* DOM/DOMCSSRule.mm:
(-[DOMCSSRule type]):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSCSSRuleCustomcpp">trunk/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorpm">trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsIDLAttributesjson">trunk/Source/WebCore/bindings/scripts/IDLAttributes.json</a></li>
<li><a href="#trunkSourceWebCorecssCSSCounterStyleRuleh">trunk/Source/WebCore/css/CSSCounterStyleRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSFontFaceRuleh">trunk/Source/WebCore/css/CSSFontFaceRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSFontPaletteValuesRuleh">trunk/Source/WebCore/css/CSSFontPaletteValuesRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSImportRuleh">trunk/Source/WebCore/css/CSSImportRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSKeyframeRuleh">trunk/Source/WebCore/css/CSSKeyframeRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSKeyframesRuleh">trunk/Source/WebCore/css/CSSKeyframesRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSLayerBlockRuleh">trunk/Source/WebCore/css/CSSLayerBlockRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSLayerStatementRuleh">trunk/Source/WebCore/css/CSSLayerStatementRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSMediaRuleh">trunk/Source/WebCore/css/CSSMediaRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSNamespaceRuleh">trunk/Source/WebCore/css/CSSNamespaceRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSPageRuleh">trunk/Source/WebCore/css/CSSPageRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSRulecpp">trunk/Source/WebCore/css/CSSRule.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSRuleh">trunk/Source/WebCore/css/CSSRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSRuleidl">trunk/Source/WebCore/css/CSSRule.idl</a></li>
<li><a href="#trunkSourceWebCorecssCSSStyleRuleh">trunk/Source/WebCore/css/CSSStyleRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSSupportsRuleh">trunk/Source/WebCore/css/CSSSupportsRule.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSUnknownRuleh">trunk/Source/WebCore/css/CSSUnknownRule.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleRulecpp">trunk/Source/WebCore/css/StyleRule.cpp</a></li>
<li><a href="#trunkSourceWebCorecssStyleRuleTypeh">trunk/Source/WebCore/css/StyleRuleType.h</a></li>
<li><a href="#trunkSourceWebCorecssStyleSheetContentscpp">trunk/Source/WebCore/css/StyleSheetContents.cpp</a></li>
<li><a href="#trunkSourceWebCorestyleInspectorCSSOMWrapperscpp">trunk/Source/WebCore/style/InspectorCSSOMWrappers.cpp</a></li>
<li><a href="#trunkSourceWebKitLegacymacChangeLog">trunk/Source/WebKitLegacy/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitLegacymacDOMDOMCSSmm">trunk/Source/WebKitLegacy/mac/DOM/DOMCSS.mm</a></li>
<li><a href="#trunkSourceWebKitLegacymacDOMDOMCSSRulemm">trunk/Source/WebKitLegacy/mac/DOM/DOMCSSRule.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/ChangeLog      2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -1,3 +1,42 @@
</span><ins>+2021-12-11  Antti Koivisto  <antti@apple.com>
+
+        Remove redundant StyleRule::Type enum
+        https://bugs.webkit.org/show_bug.cgi?id=234156
+
+        Reviewed by Alan Bujtas.
+
+        Remove redundant CSSRule::STYLE_RULE etc enum values and just use StyleRuleType enum class.
+
+        * bindings/js/JSCSSRuleCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        * bindings/scripts/CodeGenerator.pm:
+        (GenerateCompileTimeCheckForEnumsIfNeeded):
+
+        Add 'ConstantsEnum' attribute to generate static_asserts for constants that match an enum class.
+
+        * bindings/scripts/IDLAttributes.json:
+        * css/CSSCounterStyleRule.h:
+        * css/CSSFontFaceRule.h:
+        * css/CSSFontPaletteValuesRule.h:
+        * css/CSSImportRule.h:
+        * css/CSSKeyframeRule.h:
+        * css/CSSKeyframesRule.h:
+        * css/CSSLayerBlockRule.h:
+        * css/CSSLayerStatementRule.h:
+        * css/CSSMediaRule.h:
+        * css/CSSNamespaceRule.h:
+        * css/CSSPageRule.h:
+        * css/CSSRule.cpp:
+        * css/CSSRule.h:
+        (WebCore::CSSRule::typeForBindings const):
+        * css/CSSRule.idl:
+        * css/CSSStyleRule.h:
+        * css/CSSSupportsRule.h:
+        * css/CSSUnknownRule.h:
+        * css/StyleRuleType.h:
+        * style/InspectorCSSOMWrappers.cpp:
+        (WebCore::Style::InspectorCSSOMWrappers::collect):
+
</ins><span class="cx"> 2021-12-11  Antoine Quint  <graouts@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         Expose a frameRate property to Web Animations
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSCSSRuleCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp     2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp        2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -69,36 +69,37 @@
</span><span class="cx"> 
</span><span class="cx"> JSValue toJSNewlyCreated(JSGlobalObject*, JSDOMGlobalObject* globalObject, Ref<CSSRule>&& rule)
</span><span class="cx"> {
</span><del>-    switch (rule->type()) {
-    case CSSRule::STYLE_RULE:
</del><ins>+    switch (rule->styleRuleType()) {
+    case StyleRuleType::Style:
</ins><span class="cx">         return createWrapper<CSSStyleRule>(globalObject, WTFMove(rule));
</span><del>-    case CSSRule::MEDIA_RULE:
</del><ins>+    case StyleRuleType::Media:
</ins><span class="cx">         return createWrapper<CSSMediaRule>(globalObject, WTFMove(rule));
</span><del>-    case CSSRule::FONT_FACE_RULE:
</del><ins>+    case StyleRuleType::FontFace:
</ins><span class="cx">         return createWrapper<CSSFontFaceRule>(globalObject, WTFMove(rule));
</span><del>-    case CSSRule::FONT_PALETTE_VALUES_RULE:
</del><ins>+    case StyleRuleType::FontPaletteValues:
</ins><span class="cx">         return createWrapper<CSSFontPaletteValuesRule>(globalObject, WTFMove(rule));
</span><del>-    case CSSRule::PAGE_RULE:
</del><ins>+    case StyleRuleType::Page:
</ins><span class="cx">         return createWrapper<CSSPageRule>(globalObject, WTFMove(rule));
</span><del>-    case CSSRule::IMPORT_RULE:
</del><ins>+    case StyleRuleType::Import:
</ins><span class="cx">         return createWrapper<CSSImportRule>(globalObject, WTFMove(rule));
</span><del>-    case CSSRule::NAMESPACE_RULE:
</del><ins>+    case StyleRuleType::Namespace:
</ins><span class="cx">         return createWrapper<CSSNamespaceRule>(globalObject, WTFMove(rule));
</span><del>-    case CSSRule::KEYFRAME_RULE:
</del><ins>+    case StyleRuleType::Keyframe:
</ins><span class="cx">         return createWrapper<CSSKeyframeRule>(globalObject, WTFMove(rule));
</span><del>-    case CSSRule::KEYFRAMES_RULE:
</del><ins>+    case StyleRuleType::Keyframes:
</ins><span class="cx">         return createWrapper<CSSKeyframesRule>(globalObject, WTFMove(rule));
</span><del>-    case CSSRule::SUPPORTS_RULE:
</del><ins>+    case StyleRuleType::Supports:
</ins><span class="cx">         return createWrapper<CSSSupportsRule>(globalObject, WTFMove(rule));
</span><del>-    case CSSRule::COUNTER_STYLE_RULE:
</del><ins>+    case StyleRuleType::CounterStyle:
</ins><span class="cx">         return createWrapper<CSSCounterStyleRule>(globalObject, WTFMove(rule));
</span><del>-    case CSSRule::LAYER_BLOCK_RULE:
</del><ins>+    case StyleRuleType::LayerBlock:
</ins><span class="cx">         return createWrapper<CSSLayerBlockRule>(globalObject, WTFMove(rule));
</span><del>-    case CSSRule::LAYER_STATEMENT_RULE:
</del><ins>+    case StyleRuleType::LayerStatement:
</ins><span class="cx">         return createWrapper<CSSLayerStatementRule>(globalObject, WTFMove(rule));
</span><del>-    case CSSRule::UNKNOWN_RULE:
-    case CSSRule::CHARSET_RULE:
-    case CSSRule::MARGIN_RULE:
</del><ins>+    case StyleRuleType::Container:
+    case StyleRuleType::Unknown:
+    case StyleRuleType::Charset:
+    case StyleRuleType::Margin:
</ins><span class="cx">         return createWrapper<CSSRule>(globalObject, WTFMove(rule));
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm   2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm      2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -1422,13 +1422,14 @@
</span><span class="cx"> 
</span><span class="cx">     return () if $interface->extendedAttributes->{"DoNotCheckConstants"} || !@{$interface->constants};
</span><span class="cx"> 
</span><del>-    my $baseScope = $interface->extendedAttributes->{"ConstantsScope"} || $interface->type->name;
</del><ins>+    my $enum = $interface->extendedAttributes->{"ConstantsEnum"};
+    my $baseScope = $enum || $interface->extendedAttributes->{"ConstantsScope"} || $interface->type->name;
</ins><span class="cx"> 
</span><span class="cx">     my @checks = ();
</span><span class="cx">     foreach my $constant (@{$interface->constants}) {
</span><span class="cx">         my $scope = $constant->extendedAttributes->{"ImplementedBy"} || $baseScope;
</span><span class="cx">         my $name = $constant->extendedAttributes->{"ImplementedAs"} || $constant->name;
</span><del>-        my $value = $constant->value;
</del><ins>+        my $value = $enum ? "static_cast<" . $enum . ">(" . $constant->value . ")" : $constant->value;
</ins><span class="cx">         my $conditional = $constant->extendedAttributes->{"Conditional"};
</span><span class="cx">         push(@checks, "#if " . $generator->GenerateConditionalStringFromAttributeValue($conditional) . "\n") if $conditional;
</span><span class="cx">         push(@checks, "static_assert(${scope}::${name} == ${value}, \"${name} in ${scope} does not match value from IDL\");\n");
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsIDLAttributesjson"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/IDLAttributes.json (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/IDLAttributes.json 2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/bindings/scripts/IDLAttributes.json    2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -89,6 +89,10 @@
</span><span class="cx">             "contextsAllowed": ["interface"],
</span><span class="cx">             "values": ["*"]
</span><span class="cx">         },
</span><ins>+        "ConstantsEnum": {
+            "contextsAllowed": ["interface"],
+            "values": ["*"]
+        },
</ins><span class="cx">         "ContextAllowsMediaDevices": {
</span><span class="cx">             "contextsAllowed": ["attribute"]
</span><span class="cx">         },
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSCounterStyleRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSCounterStyleRule.h (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSCounterStyleRule.h   2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/CSSCounterStyleRule.h      2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx"> 
</span><span class="cx">     String cssText() const final;
</span><span class="cx">     void reattach(StyleRuleBase&) final;
</span><del>-    CSSRule::Type type() const final { return COUNTER_STYLE_RULE; }
</del><ins>+    StyleRuleType styleRuleType() const final { return StyleRuleType::CounterStyle; }
</ins><span class="cx"> 
</span><span class="cx">     String name() const { return m_counterStyleRule->name(); }
</span><span class="cx">     String system() const { return m_counterStyleRule->system(); }
</span><span class="lines">@@ -118,7 +118,7 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><del>-SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSCounterStyleRule, CSSRule::COUNTER_STYLE_RULE)
</del><ins>+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSCounterStyleRule, StyleRuleType::CounterStyle)
</ins><span class="cx"> 
</span><span class="cx"> SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::StyleRuleCounterStyle)
</span><span class="cx"> static bool isType(const WebCore::StyleRuleBase& rule) { return rule.isCounterStyleRule(); }
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSFontFaceRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFontFaceRule.h (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFontFaceRule.h       2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/CSSFontFaceRule.h  2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx"> private:
</span><span class="cx">     CSSFontFaceRule(StyleRuleFontFace&, CSSStyleSheet* parent);
</span><span class="cx"> 
</span><del>-    CSSRule::Type type() const final { return FONT_FACE_RULE; }
</del><ins>+    StyleRuleType styleRuleType() const final { return StyleRuleType::FontFace; }
</ins><span class="cx">     String cssText() const final;
</span><span class="cx">     void reattach(StyleRuleBase&) final;
</span><span class="cx"> 
</span><span class="lines">@@ -50,4 +50,4 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><del>-SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSFontFaceRule, CSSRule::FONT_FACE_RULE)
</del><ins>+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSFontFaceRule, StyleRuleType::FontFace)
</ins></span></pre></div>
<a id="trunkSourceWebCorecssCSSFontPaletteValuesRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSFontPaletteValuesRule.h (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSFontPaletteValuesRule.h      2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/CSSFontPaletteValuesRule.h 2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx"> private:
</span><span class="cx">     CSSFontPaletteValuesRule(StyleRuleFontPaletteValues&, CSSStyleSheet* parent);
</span><span class="cx"> 
</span><del>-    CSSRule::Type type() const final { return FONT_PALETTE_VALUES_RULE; }
</del><ins>+    StyleRuleType styleRuleType() const final { return StyleRuleType::FontPaletteValues; }
</ins><span class="cx">     String cssText() const final;
</span><span class="cx">     void reattach(StyleRuleBase&) final;
</span><span class="cx"> 
</span><span class="lines">@@ -59,4 +59,4 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><del>-SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSFontPaletteValuesRule, CSSRule::FONT_PALETTE_VALUES_RULE)
</del><ins>+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSFontPaletteValuesRule, StyleRuleType::FontPaletteValues)
</ins></span></pre></div>
<a id="trunkSourceWebCorecssCSSImportRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSImportRule.h (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSImportRule.h 2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/CSSImportRule.h    2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx"> private:
</span><span class="cx">     CSSImportRule(StyleRuleImport&, CSSStyleSheet*);
</span><span class="cx"> 
</span><del>-    CSSRule::Type type() const final { return IMPORT_RULE; }
</del><ins>+    StyleRuleType styleRuleType() const final { return StyleRuleType::Import; }
</ins><span class="cx">     String cssText() const final;
</span><span class="cx">     void reattach(StyleRuleBase&) final;
</span><span class="cx"> 
</span><span class="lines">@@ -54,4 +54,4 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><del>-SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSImportRule, CSSRule::IMPORT_RULE)
</del><ins>+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSImportRule, StyleRuleType::Import)
</ins></span></pre></div>
<a id="trunkSourceWebCorecssCSSKeyframeRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSKeyframeRule.h (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSKeyframeRule.h       2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/CSSKeyframeRule.h  2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -80,7 +80,7 @@
</span><span class="cx"> private:
</span><span class="cx">     CSSKeyframeRule(StyleRuleKeyframe&, CSSKeyframesRule* parent);
</span><span class="cx"> 
</span><del>-    CSSRule::Type type() const final { return KEYFRAME_RULE; }
</del><ins>+    StyleRuleType styleRuleType() const final { return StyleRuleType::Keyframe; }
</ins><span class="cx"> 
</span><span class="cx">     Ref<StyleRuleKeyframe> m_keyframe;
</span><span class="cx">     mutable RefPtr<StyleRuleCSSStyleDeclaration> m_propertiesCSSOMWrapper;
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSKeyframesRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSKeyframesRule.h (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSKeyframesRule.h      2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/CSSKeyframesRule.h 2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual ~CSSKeyframesRule();
</span><span class="cx"> 
</span><del>-    CSSRule::Type type() const final { return KEYFRAMES_RULE; }
</del><ins>+    StyleRuleType styleRuleType() const final { return StyleRuleType::Keyframes; }
</ins><span class="cx">     String cssText() const final;
</span><span class="cx">     void reattach(StyleRuleBase&) final;
</span><span class="cx"> 
</span><span class="lines">@@ -109,7 +109,7 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><del>-SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSKeyframesRule, CSSRule::KEYFRAMES_RULE)
</del><ins>+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSKeyframesRule, StyleRuleType::Keyframes)
</ins><span class="cx"> 
</span><span class="cx"> SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::StyleRuleKeyframes)
</span><span class="cx">     static bool isType(const WebCore::StyleRuleBase& rule) { return rule.isKeyframesRule(); }
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSLayerBlockRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSLayerBlockRule.h (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSLayerBlockRule.h     2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/CSSLayerBlockRule.h        2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     CSSLayerBlockRule(StyleRuleLayer&, CSSStyleSheet*);
</span><del>-    CSSRule::Type type() const final { return LAYER_BLOCK_RULE; }
</del><ins>+    StyleRuleType styleRuleType() const final { return StyleRuleType::LayerBlock; }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> String stringFromCascadeLayerName(const CascadeLayerName&);
</span><span class="lines">@@ -50,4 +50,4 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><del>-SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSLayerBlockRule, CSSRule::LAYER_BLOCK_RULE)
</del><ins>+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSLayerBlockRule, StyleRuleType::LayerBlock)
</ins></span></pre></div>
<a id="trunkSourceWebCorecssCSSLayerStatementRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSLayerStatementRule.h (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSLayerStatementRule.h 2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/CSSLayerStatementRule.h    2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     CSSLayerStatementRule(StyleRuleLayer&, CSSStyleSheet*);
</span><del>-    CSSRule::Type type() const final { return LAYER_STATEMENT_RULE; }
</del><ins>+    StyleRuleType styleRuleType() const final { return StyleRuleType::LayerStatement; }
</ins><span class="cx">     void reattach(StyleRuleBase&) final;
</span><span class="cx"> 
</span><span class="cx">     Ref<StyleRuleLayer> m_layerRule;
</span><span class="lines">@@ -51,4 +51,4 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><del>-SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSLayerStatementRule, CSSRule::LAYER_STATEMENT_RULE)
</del><ins>+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSLayerStatementRule, StyleRuleType::LayerStatement)
</ins></span></pre></div>
<a id="trunkSourceWebCorecssCSSMediaRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSMediaRule.h (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSMediaRule.h  2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/CSSMediaRule.h     2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx"> private:
</span><span class="cx">     CSSMediaRule(StyleRuleMedia&, CSSStyleSheet*);
</span><span class="cx"> 
</span><del>-    CSSRule::Type type() const final { return MEDIA_RULE; }
</del><ins>+    StyleRuleType styleRuleType() const final { return StyleRuleType::Media; }
</ins><span class="cx">     void reattach(StyleRuleBase&) final;
</span><span class="cx">     String cssText() const final;
</span><span class="cx">     String conditionText() const final;
</span><span class="lines">@@ -53,4 +53,4 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><del>-SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSMediaRule, CSSRule::MEDIA_RULE)
</del><ins>+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSMediaRule, StyleRuleType::Media)
</ins></span></pre></div>
<a id="trunkSourceWebCorecssCSSNamespaceRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSNamespaceRule.h (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSNamespaceRule.h      2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/CSSNamespaceRule.h 2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx"> private:
</span><span class="cx">     CSSNamespaceRule(StyleRuleNamespace&, CSSStyleSheet*);
</span><span class="cx"> 
</span><del>-    CSSRule::Type type() const final { return NAMESPACE_RULE; }
</del><ins>+    StyleRuleType styleRuleType() const final { return StyleRuleType::Namespace; }
</ins><span class="cx">     String cssText() const final;
</span><span class="cx">     void reattach(StyleRuleBase&) final;
</span><span class="cx"> 
</span><span class="lines">@@ -52,4 +52,4 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><del>-SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSNamespaceRule, CSSRule::NAMESPACE_RULE)
</del><ins>+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSNamespaceRule, StyleRuleType::Namespace)
</ins></span></pre></div>
<a id="trunkSourceWebCorecssCSSPageRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSPageRule.h (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSPageRule.h   2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/CSSPageRule.h      2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> private:
</span><span class="cx">     CSSPageRule(StyleRulePage&, CSSStyleSheet*);
</span><span class="cx"> 
</span><del>-    CSSRule::Type type() const final { return PAGE_RULE; }
</del><ins>+    StyleRuleType styleRuleType() const final { return StyleRuleType::Page; }
</ins><span class="cx">     String cssText() const final;
</span><span class="cx">     void reattach(StyleRuleBase&) final;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSRulecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSRule.cpp (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSRule.cpp     2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/CSSRule.cpp        2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -36,20 +36,6 @@
</span><span class="cx"> 
</span><span class="cx"> COMPILE_ASSERT(sizeof(CSSRule) == sizeof(SameSizeAsCSSRule), CSSRule_should_stay_small);
</span><span class="cx"> 
</span><del>-COMPILE_ASSERT(StyleRuleType::Unknown == static_cast<StyleRuleType>(CSSRule::Type::UNKNOWN_RULE), enums_should_match);
-COMPILE_ASSERT(StyleRuleType::Style == static_cast<StyleRuleType>(CSSRule::Type::STYLE_RULE), enums_should_match);
-COMPILE_ASSERT(StyleRuleType::Charset == static_cast<StyleRuleType>(CSSRule::Type::CHARSET_RULE), enums_should_match);
-COMPILE_ASSERT(StyleRuleType::Import == static_cast<StyleRuleType>(CSSRule::Type::IMPORT_RULE), enums_should_match);
-COMPILE_ASSERT(StyleRuleType::Media == static_cast<StyleRuleType>(CSSRule::Type::MEDIA_RULE), enums_should_match);
-COMPILE_ASSERT(StyleRuleType::FontFace == static_cast<StyleRuleType>(CSSRule::Type::FONT_FACE_RULE), enums_should_match);
-COMPILE_ASSERT(StyleRuleType::Page == static_cast<StyleRuleType>(CSSRule::Type::PAGE_RULE), enums_should_match);
-COMPILE_ASSERT(StyleRuleType::Keyframes == static_cast<StyleRuleType>(CSSRule::Type::KEYFRAMES_RULE), enums_should_match);
-COMPILE_ASSERT(StyleRuleType::Keyframe == static_cast<StyleRuleType>(CSSRule::Type::KEYFRAME_RULE), enums_should_match);
-COMPILE_ASSERT(StyleRuleType::Namespace == static_cast<StyleRuleType>(CSSRule::Type::NAMESPACE_RULE), enums_should_match);
-COMPILE_ASSERT(StyleRuleType::CounterStyle == static_cast<StyleRuleType>(CSSRule::Type::COUNTER_STYLE_RULE), enums_should_match);
-COMPILE_ASSERT(StyleRuleType::Supports == static_cast<StyleRuleType>(CSSRule::Type::SUPPORTS_RULE), enums_should_match);
-COMPILE_ASSERT(StyleRuleType::FontPaletteValues == static_cast<StyleRuleType>(CSSRule::Type::FONT_PALETTE_VALUES_RULE), enums_should_match);
-
</del><span class="cx"> ExceptionOr<void> CSSRule::setCssText(const String&)
</span><span class="cx"> {
</span><span class="cx">     return { };
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSRule.h (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSRule.h       2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/CSSRule.h  2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -23,6 +23,7 @@
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><span class="cx"> #include "ExceptionOr.h"
</span><ins>+#include "StyleRuleType.h"
</ins><span class="cx"> #include <wtf/TypeCasts.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -36,32 +37,9 @@
</span><span class="cx"> public:
</span><span class="cx">     virtual ~CSSRule() = default;
</span><span class="cx"> 
</span><del>-    // FIXME: Remove pointless duplication by replacing with StyleRuleType.
-    enum Type {
-        UNKNOWN_RULE = 0,
-        STYLE_RULE = 1,
-        CHARSET_RULE = 2,
-        IMPORT_RULE = 3,
-        MEDIA_RULE = 4,
-        FONT_FACE_RULE = 5,
-        PAGE_RULE = 6,
-        KEYFRAMES_RULE = 7,
-        KEYFRAME_RULE = 8,
-        MARGIN_RULE = 9,
-        NAMESPACE_RULE = 10,
-        COUNTER_STYLE_RULE = 11,
-        SUPPORTS_RULE = 12,
-        LAYER_BLOCK_RULE = 16,
-        LAYER_STATEMENT_RULE = 17,
-        FONT_PALETTE_VALUES_RULE = 19,
-    };
</del><ins>+    unsigned short type() const { return static_cast<unsigned short>(styleRuleType()); }
</ins><span class="cx"> 
</span><del>-    enum DeprecatedType {
-        WEBKIT_KEYFRAMES_RULE = KEYFRAMES_RULE,
-        WEBKIT_KEYFRAME_RULE = KEYFRAME_RULE
-    };
-
-    virtual Type type() const = 0;
</del><ins>+    virtual StyleRuleType styleRuleType() const = 0;
</ins><span class="cx">     virtual String cssText() const = 0;
</span><span class="cx">     virtual void reattach(StyleRuleBase&) = 0;
</span><span class="cx"> 
</span><span class="lines">@@ -119,5 +97,5 @@
</span><span class="cx"> 
</span><span class="cx"> #define SPECIALIZE_TYPE_TRAITS_CSS_RULE(ToValueTypeName, predicate) \
</span><span class="cx"> SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ToValueTypeName) \
</span><del>-    static bool isType(const WebCore::CSSRule& rule) { return rule.type() == WebCore::predicate; } \
</del><ins>+    static bool isType(const WebCore::CSSRule& rule) { return rule.styleRuleType() == WebCore::predicate; } \
</ins><span class="cx"> SPECIALIZE_TYPE_TRAITS_END()
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSRuleidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSRule.idl (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSRule.idl     2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/CSSRule.idl        2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx">     GenerateIsReachable,
</span><span class="cx">     JSCustomHeader,
</span><span class="cx">     JSCustomMarkFunction,
</span><ins>+    ConstantsEnum=StyleRuleType
</ins><span class="cx"> ] interface CSSRule {
</span><span class="cx">     attribute DOMString? cssText;
</span><span class="cx">     readonly attribute CSSRule? parentRule;
</span><span class="lines">@@ -31,21 +32,22 @@
</span><span class="cx">     readonly attribute CSSStyleSheet? parentStyleSheet;
</span><span class="cx"> 
</span><span class="cx">     readonly attribute unsigned short type;
</span><del>-    const unsigned short UNKNOWN_RULE = 0;
-    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 KEYFRAMES_RULE = 7;
-    const unsigned short KEYFRAME_RULE = 8;
-    const unsigned short MARGIN_RULE = 9;
-    const unsigned short NAMESPACE_RULE = 10;
-    [EnabledBySetting=CSSCounterStyleAtRulesEnabled] const unsigned short COUNTER_STYLE_RULE = 11;
-    const unsigned short SUPPORTS_RULE = 12;
</del><ins>+    
+    [ImplementedAs=Unknown] const unsigned short UNKNOWN_RULE = 0;
+    [ImplementedAs=Style] const unsigned short STYLE_RULE = 1;
+    [ImplementedAs=Charset] const unsigned short CHARSET_RULE = 2;
+    [ImplementedAs=Import] const unsigned short IMPORT_RULE = 3;
+    [ImplementedAs=Media] const unsigned short MEDIA_RULE = 4;
+    [ImplementedAs=FontFace] const unsigned short FONT_FACE_RULE = 5;
+    [ImplementedAs=Page] const unsigned short PAGE_RULE = 6;
+    [ImplementedAs=Keyframes] const unsigned short KEYFRAMES_RULE = 7;
+    [ImplementedAs=Keyframe] const unsigned short KEYFRAME_RULE = 8;
+    [ImplementedAs=Margin] const unsigned short MARGIN_RULE = 9;
+    [ImplementedAs=Namespace] const unsigned short NAMESPACE_RULE = 10;
+    [ImplementedAs=CounterStyle, EnabledBySetting=CSSCounterStyleAtRulesEnabled] const unsigned short COUNTER_STYLE_RULE = 11;
+    [ImplementedAs=Supports] const unsigned short SUPPORTS_RULE = 12;
</ins><span class="cx"> 
</span><span class="cx">     // Legacy synonyms for the above, kept to avoid breaking existing content.
</span><del>-    const unsigned short WEBKIT_KEYFRAMES_RULE = 7;
-    const unsigned short WEBKIT_KEYFRAME_RULE = 8;
</del><ins>+    [ImplementedAs=Keyframes] const unsigned short WEBKIT_KEYFRAMES_RULE = 7;
+    [ImplementedAs=Keyframe] const unsigned short WEBKIT_KEYFRAME_RULE = 8;
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSStyleRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSStyleRule.h (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSStyleRule.h  2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/CSSStyleRule.h     2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx"> private:
</span><span class="cx">     CSSStyleRule(StyleRule&, CSSStyleSheet*);
</span><span class="cx"> 
</span><del>-    CSSRule::Type type() const final { return STYLE_RULE; }
</del><ins>+    StyleRuleType styleRuleType() const final { return StyleRuleType::Style; }
</ins><span class="cx">     String cssText() const final;
</span><span class="cx">     void reattach(StyleRuleBase&) final;
</span><span class="cx"> 
</span><span class="lines">@@ -58,4 +58,4 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><del>-SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSStyleRule, CSSRule::STYLE_RULE)
</del><ins>+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSStyleRule, StyleRuleType::Style)
</ins></span></pre></div>
<a id="trunkSourceWebCorecssCSSSupportsRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSSupportsRule.h (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSSupportsRule.h       2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/CSSSupportsRule.h  2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -47,9 +47,9 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     CSSSupportsRule(StyleRuleSupports&, CSSStyleSheet*);
</span><del>-    CSSRule::Type type() const final { return SUPPORTS_RULE; }
</del><ins>+    StyleRuleType styleRuleType() const final { return StyleRuleType::Supports; }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><del>-SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSSupportsRule, CSSRule::SUPPORTS_RULE)
</del><ins>+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSSupportsRule, StyleRuleType::Supports)
</ins></span></pre></div>
<a id="trunkSourceWebCorecssCSSUnknownRuleh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSUnknownRule.h (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSUnknownRule.h        2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/CSSUnknownRule.h   2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx">     void reattach(StyleRuleBase&) final { }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    CSSRule::Type type() const final { return UNKNOWN_RULE; }
</del><ins>+    StyleRuleType styleRuleType() const final { return StyleRuleType::Unknown; }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleRulecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleRule.cpp (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleRule.cpp   2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/StyleRule.cpp      2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -107,6 +107,7 @@
</span><span class="cx">     case StyleRuleType::Container:
</span><span class="cx">         delete downcast<StyleRuleContainer>(this);
</span><span class="cx">         return;
</span><ins>+    case StyleRuleType::Margin:
</ins><span class="cx">     case StyleRuleType::Unknown:
</span><span class="cx">         ASSERT_NOT_REACHED();
</span><span class="cx">         return;
</span><span class="lines">@@ -145,6 +146,7 @@
</span><span class="cx">     case StyleRuleType::Unknown:
</span><span class="cx">     case StyleRuleType::Charset:
</span><span class="cx">     case StyleRuleType::Keyframe:
</span><ins>+    case StyleRuleType::Margin:
</ins><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx">     CRASH();
</span><span class="lines">@@ -197,6 +199,7 @@
</span><span class="cx">     case StyleRuleType::Unknown:
</span><span class="cx">     case StyleRuleType::Charset:
</span><span class="cx">     case StyleRuleType::Keyframe:
</span><ins>+    case StyleRuleType::Margin:
</ins><span class="cx">         ASSERT_NOT_REACHED();
</span><span class="cx">         break;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleRuleTypeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleRuleType.h (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleRuleType.h 2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/StyleRuleType.h    2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -28,15 +28,16 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> enum class StyleRuleType : uint8_t {
</span><del>-    Unknown = 0, // Not used.
</del><ins>+    Unknown = 0,
</ins><span class="cx">     Style = 1,
</span><del>-    Charset = 2, // Not used. These are internally strings owned by the style sheet.
</del><ins>+    Charset = 2,
</ins><span class="cx">     Import = 3,
</span><span class="cx">     Media = 4,
</span><span class="cx">     FontFace = 5,
</span><span class="cx">     Page = 6,
</span><span class="cx">     Keyframes = 7,
</span><del>-    Keyframe = 8, // Not used. These are internally non-rule StyleRuleKeyframe objects.
</del><ins>+    Keyframe = 8,
+    Margin = 9,
</ins><span class="cx">     Namespace = 10,
</span><span class="cx">     CounterStyle = 11,
</span><span class="cx">     Supports = 12,
</span></span></pre></div>
<a id="trunkSourceWebCorecssStyleSheetContentscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/StyleSheetContents.cpp  2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/css/StyleSheetContents.cpp     2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -455,32 +455,11 @@
</span><span class="cx">     for (auto& rule : rules) {
</span><span class="cx">         if (handler(*rule))
</span><span class="cx">             return true;
</span><del>-        switch (rule->type()) {
-        case StyleRuleType::Media:
-        case StyleRuleType::Supports:
-        case StyleRuleType::LayerBlock:
-        case StyleRuleType::Container: {
-            auto* childRules = downcast<StyleRuleGroup>(*rule).childRulesWithoutDeferredParsing();
-            if (childRules && traverseRulesInVector(*childRules, handler))
-                return true;
-            break;
-        }
-        case StyleRuleType::Import:
-            ASSERT_NOT_REACHED();
-            break;
-        case StyleRuleType::Style:
-        case StyleRuleType::FontFace:
-        case StyleRuleType::FontPaletteValues:
-        case StyleRuleType::Page:
-        case StyleRuleType::Keyframes:
-        case StyleRuleType::Namespace:
-        case StyleRuleType::Unknown:
-        case StyleRuleType::Charset:
-        case StyleRuleType::CounterStyle:
-        case StyleRuleType::Keyframe:
-        case StyleRuleType::LayerStatement:
-            break;
-        }
</del><ins>+        if (!rule->isGroupRule())
+            continue;
+        auto* childRules = downcast<StyleRuleGroup>(*rule).childRulesWithoutDeferredParsing();
+        if (childRules && traverseRulesInVector(*childRules, handler))
+            return true;
</ins><span class="cx">     }
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="lines">@@ -525,6 +504,7 @@
</span><span class="cx">         case StyleRuleType::LayerStatement:
</span><span class="cx">         case StyleRuleType::Container:
</span><span class="cx">         case StyleRuleType::FontPaletteValues:
</span><ins>+        case StyleRuleType::Margin:
</ins><span class="cx">             return false;
</span><span class="cx">         };
</span><span class="cx">         ASSERT_NOT_REACHED();
</span></span></pre></div>
<a id="trunkSourceWebCorestyleInspectorCSSOMWrapperscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/style/InspectorCSSOMWrappers.cpp (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/style/InspectorCSSOMWrappers.cpp    2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebCore/style/InspectorCSSOMWrappers.cpp       2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -59,20 +59,20 @@
</span><span class="cx">     unsigned size = listType->length();
</span><span class="cx">     for (unsigned i = 0; i < size; ++i) {
</span><span class="cx">         CSSRule* cssRule = listType->item(i);
</span><del>-        switch (cssRule->type()) {
-        case CSSRule::IMPORT_RULE:
</del><ins>+        switch (cssRule->styleRuleType()) {
+        case StyleRuleType::Import:
</ins><span class="cx">             collect(downcast<CSSImportRule>(*cssRule).styleSheet());
</span><span class="cx">             break;
</span><del>-        case CSSRule::LAYER_BLOCK_RULE:
</del><ins>+        case StyleRuleType::LayerBlock:
</ins><span class="cx">             collect(downcast<CSSLayerBlockRule>(cssRule));
</span><span class="cx">             break;
</span><del>-        case CSSRule::MEDIA_RULE:
</del><ins>+        case StyleRuleType::Media:
</ins><span class="cx">             collect(downcast<CSSMediaRule>(cssRule));
</span><span class="cx">             break;
</span><del>-        case CSSRule::SUPPORTS_RULE:
</del><ins>+        case StyleRuleType::Supports:
</ins><span class="cx">             collect(downcast<CSSSupportsRule>(cssRule));
</span><span class="cx">             break;
</span><del>-        case CSSRule::STYLE_RULE:
</del><ins>+        case StyleRuleType::Style:
</ins><span class="cx">             m_styleRuleToCSSOMWrapperMap.add(&downcast<CSSStyleRule>(*cssRule).styleRule(), downcast<CSSStyleRule>(cssRule));
</span><span class="cx">             break;
</span><span class="cx">         default:
</span></span></pre></div>
<a id="trunkSourceWebKitLegacymacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/mac/ChangeLog  2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog     2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2021-12-11  Antti Koivisto  <antti@apple.com>
+
+        Remove redundant StyleRule::Type enum
+        https://bugs.webkit.org/show_bug.cgi?id=234156
+
+        Reviewed by Alan Bujtas.
+
+        * DOM/DOMCSS.mm:
+        (kitClass):
+        * DOM/DOMCSSRule.mm:
+        (-[DOMCSSRule type]):
+
</ins><span class="cx"> 2021-12-10  Michael Saboff  <msaboff@apple.com>
</span><span class="cx"> 
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=234173
</span></span></pre></div>
<a id="trunkSourceWebKitLegacymacDOMDOMCSSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/mac/DOM/DOMCSS.mm (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/mac/DOM/DOMCSS.mm      2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebKitLegacy/mac/DOM/DOMCSS.mm 2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -60,20 +60,20 @@
</span><span class="cx"> 
</span><span class="cx"> Class kitClass(WebCore::CSSRule* impl)
</span><span class="cx"> {
</span><del>-    switch (impl->type()) {
-    case WebCore::CSSRule::UNKNOWN_RULE:
</del><ins>+    switch (impl->styleRuleType()) {
+    case WebCore::StyleRuleType::Unknown:
</ins><span class="cx">         return [DOMCSSUnknownRule class];
</span><del>-    case WebCore::CSSRule::STYLE_RULE:
</del><ins>+    case WebCore::StyleRuleType::Style:
</ins><span class="cx">         return [DOMCSSStyleRule class];
</span><del>-    case WebCore::CSSRule::CHARSET_RULE:
</del><ins>+    case WebCore::StyleRuleType::Charset:
</ins><span class="cx">         return [DOMCSSCharsetRule class];
</span><del>-    case WebCore::CSSRule::IMPORT_RULE:
</del><ins>+    case WebCore::StyleRuleType::Import:
</ins><span class="cx">         return [DOMCSSImportRule class];
</span><del>-    case WebCore::CSSRule::MEDIA_RULE:
</del><ins>+    case WebCore::StyleRuleType::Media:
</ins><span class="cx">         return [DOMCSSMediaRule class];
</span><del>-    case WebCore::CSSRule::FONT_FACE_RULE:
</del><ins>+    case WebCore::StyleRuleType::FontFace:
</ins><span class="cx">         return [DOMCSSFontFaceRule class];
</span><del>-    case WebCore::CSSRule::PAGE_RULE:
</del><ins>+    case WebCore::StyleRuleType::Page:
</ins><span class="cx">         return [DOMCSSPageRule class];
</span><span class="cx">     default:
</span><span class="cx">         return [DOMCSSRule class];
</span></span></pre></div>
<a id="trunkSourceWebKitLegacymacDOMDOMCSSRulemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKitLegacy/mac/DOM/DOMCSSRule.mm (286915 => 286916)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKitLegacy/mac/DOM/DOMCSSRule.mm  2021-12-11 18:20:09 UTC (rev 286915)
+++ trunk/Source/WebKitLegacy/mac/DOM/DOMCSSRule.mm     2021-12-11 18:28:39 UTC (rev 286916)
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx"> - (unsigned short)type
</span><span class="cx"> {
</span><span class="cx">     WebCore::JSMainThreadNullState state;
</span><del>-    return IMPL->type();
</del><ins>+    return static_cast<unsigned short>(IMPL->type());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (NSString *)cssText
</span></span></pre>
</div>
</div>

</body>
</html>