Title: [283170] trunk
Revision
283170
Author
[email protected]
Date
2021-09-28 08:40:24 -0700 (Tue, 28 Sep 2021)

Log Message

[CSS Cascade Layers] Add CSSOM interface
https://bugs.webkit.org/show_bug.cgi?id=230882

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-cascade/parsing/layer-expected.txt: Added.

Source/WebCore:

Add a minimal CSSLayerRule interface. This is yet unspecified (https://github.com/w3c/csswg-drafts/issues/6576)
but the final version likely won't differ much or at all. This also matches Firefox.

This makes parsing and serialization WPT tests work.

* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* css/CSSLayerRule.cpp: Added.
(WebCore::CSSLayerRule::CSSLayerRule):
(WebCore::CSSLayerRule::create):
(WebCore::CSSLayerRule::cssText const):

The only available functionality is getting the cssText.

* css/CSSLayerRule.h: Added.
* css/CSSLayerRule.idl: Added.
* css/CSSRule.h:
* css/StyleRule.cpp:
(WebCore::StyleRuleBase::createCSSOMWrapper const):

Make the wrapper.

* css/StyleRuleType.h:

Update the type constant to match Firefox (this is not specified).

* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::wrapperInsertRule):

Remember the return after succesful insert.

LayoutTests:

* TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (283169 => 283170)


--- trunk/LayoutTests/ChangeLog	2021-09-28 15:36:25 UTC (rev 283169)
+++ trunk/LayoutTests/ChangeLog	2021-09-28 15:40:24 UTC (rev 283170)
@@ -1,5 +1,14 @@
 2021-09-28  Antti Koivisto  <[email protected]>
 
+        [CSS Cascade Layers] Add CSSOM interface
+        https://bugs.webkit.org/show_bug.cgi?id=230882
+
+        Reviewed by Simon Fraser.
+
+        * TestExpectations:
+
+2021-09-28  Antti Koivisto  <[email protected]>
+
         [CSS Cascade Layers] Import more WPT tests
         https://bugs.webkit.org/show_bug.cgi?id=230883
 

Modified: trunk/LayoutTests/TestExpectations (283169 => 283170)


--- trunk/LayoutTests/TestExpectations	2021-09-28 15:36:25 UTC (rev 283169)
+++ trunk/LayoutTests/TestExpectations	2021-09-28 15:40:24 UTC (rev 283170)
@@ -2121,8 +2121,6 @@
 imported/w3c/web-platform-tests/css/css-cascade/important-prop.html [ ImageOnlyFailure ]
 webkit.org/b/187093 [ Debug ] imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml.html [ Skip ]
 
-webkit.org/b/230882 imported/w3c/web-platform-tests/css/css-cascade/parsing/layer.html [ Skip ]
-
 webkit.org/b/148801 imported/w3c/web-platform-tests/css/css-color/t422-rgba-onscreen-b.xht [ ImageOnlyFailure ]
 webkit.org/b/148801 imported/w3c/web-platform-tests/css/css-color/t422-rgba-onscreen-multiple-boxes-c.xht [ ImageOnlyFailure ]
 webkit.org/b/148801 imported/w3c/web-platform-tests/css/css-color/t425-hsla-onscreen-multiple-boxes-c.xht [ ImageOnlyFailure ]

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (283169 => 283170)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-09-28 15:36:25 UTC (rev 283169)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-09-28 15:40:24 UTC (rev 283170)
@@ -1,5 +1,14 @@
 2021-09-28  Antti Koivisto  <[email protected]>
 
+        [CSS Cascade Layers] Add CSSOM interface
+        https://bugs.webkit.org/show_bug.cgi?id=230882
+
+        Reviewed by Simon Fraser.
+
+        * web-platform-tests/css/css-cascade/parsing/layer-expected.txt: Added.
+
+2021-09-28  Antti Koivisto  <[email protected]>
+
         [CSS Cascade Layers] Import more WPT tests
         https://bugs.webkit.org/show_bug.cgi?id=230883
 

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/parsing/layer-expected.txt (0 => 283170)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/parsing/layer-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/parsing/layer-expected.txt	2021-09-28 15:40:24 UTC (rev 283170)
@@ -0,0 +1,18 @@
+
+PASS @layer A; should be a valid rule
+PASS @layer A, B, C; should be a valid rule
+PASS @layer A.A; should be a valid rule
+PASS @layer A, B.C.D, C; should be a valid rule
+PASS @layer; should be an invalid rule
+PASS @layer A . A; should be an invalid rule
+PASS @layer {
+} should be a valid rule
+PASS @layer A {
+} should be a valid rule
+PASS @layer A.B {
+} should be a valid rule
+PASS @layer A . B {
+} should be an invalid rule
+PASS @layer A, B, C {
+} should be an invalid rule
+

Modified: trunk/Source/WebCore/CMakeLists.txt (283169 => 283170)


--- trunk/Source/WebCore/CMakeLists.txt	2021-09-28 15:36:25 UTC (rev 283169)
+++ trunk/Source/WebCore/CMakeLists.txt	2021-09-28 15:40:24 UTC (rev 283170)
@@ -711,6 +711,7 @@
     css/CSSImportRule.idl
     css/CSSKeyframeRule.idl
     css/CSSKeyframesRule.idl
+    css/CSSLayerRule.idl
     css/CSSMediaRule.idl
     css/CSSNamespaceRule.idl
     css/CSSPaintCallback.idl

Modified: trunk/Source/WebCore/ChangeLog (283169 => 283170)


--- trunk/Source/WebCore/ChangeLog	2021-09-28 15:36:25 UTC (rev 283169)
+++ trunk/Source/WebCore/ChangeLog	2021-09-28 15:40:24 UTC (rev 283170)
@@ -1,3 +1,44 @@
+2021-09-28  Antti Koivisto  <[email protected]>
+
+        [CSS Cascade Layers] Add CSSOM interface
+        https://bugs.webkit.org/show_bug.cgi?id=230882
+
+        Reviewed by Simon Fraser.
+
+        Add a minimal CSSLayerRule interface. This is yet unspecified (https://github.com/w3c/csswg-drafts/issues/6576)
+        but the final version likely won't differ much or at all. This also matches Firefox.
+
+        This makes parsing and serialization WPT tests work.
+
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/CSSLayerRule.cpp: Added.
+        (WebCore::CSSLayerRule::CSSLayerRule):
+        (WebCore::CSSLayerRule::create):
+        (WebCore::CSSLayerRule::cssText const):
+
+        The only available functionality is getting the cssText.
+
+        * css/CSSLayerRule.h: Added.
+        * css/CSSLayerRule.idl: Added.
+        * css/CSSRule.h:
+        * css/StyleRule.cpp:
+        (WebCore::StyleRuleBase::createCSSOMWrapper const):
+
+        Make the wrapper.
+
+        * css/StyleRuleType.h:
+
+        Update the type constant to match Firefox (this is not specified).
+
+        * css/StyleSheetContents.cpp:
+        (WebCore::StyleSheetContents::wrapperInsertRule):
+
+        Remember the return after succesful insert.
+
 2021-09-28  Fujii Hironori  <[email protected]>
 
         Unreviewed, reverting r283136.

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (283169 => 283170)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2021-09-28 15:36:25 UTC (rev 283169)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2021-09-28 15:40:24 UTC (rev 283170)
@@ -696,6 +696,7 @@
 $(PROJECT_DIR)/css/CSSImportRule.idl
 $(PROJECT_DIR)/css/CSSKeyframeRule.idl
 $(PROJECT_DIR)/css/CSSKeyframesRule.idl
+$(PROJECT_DIR)/css/CSSLayerRule.idl
 $(PROJECT_DIR)/css/CSSMediaRule.idl
 $(PROJECT_DIR)/css/CSSNamespaceRule.idl
 $(PROJECT_DIR)/css/CSSPageRule.idl

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (283169 => 283170)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2021-09-28 15:36:25 UTC (rev 283169)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2021-09-28 15:40:24 UTC (rev 283170)
@@ -312,6 +312,8 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSKeyframesRule.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSKeywordValue.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSKeywordValue.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSLayerRule.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSLayerRule.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSMathInvert.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSMathInvert.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSMathMax.cpp

Modified: trunk/Source/WebCore/DerivedSources.make (283169 => 283170)


--- trunk/Source/WebCore/DerivedSources.make	2021-09-28 15:36:25 UTC (rev 283169)
+++ trunk/Source/WebCore/DerivedSources.make	2021-09-28 15:40:24 UTC (rev 283170)
@@ -578,6 +578,7 @@
     $(WebCore)/css/CSSFontPaletteValuesRule.idl \
     $(WebCore)/css/CSSGroupingRule.idl \
     $(WebCore)/css/CSSImportRule.idl \
+    $(WebCore)/css/CSSLayerRule.idl \
     $(WebCore)/css/CSSKeyframeRule.idl \
     $(WebCore)/css/CSSKeyframesRule.idl \
     $(WebCore)/css/CSSMediaRule.idl \

Modified: trunk/Source/WebCore/Sources.txt (283169 => 283170)


--- trunk/Source/WebCore/Sources.txt	2021-09-28 15:36:25 UTC (rev 283169)
+++ trunk/Source/WebCore/Sources.txt	2021-09-28 15:40:24 UTC (rev 283170)
@@ -681,6 +681,7 @@
 css/CSSInitialValue.cpp
 css/CSSKeyframeRule.cpp
 css/CSSKeyframesRule.cpp
+css/CSSLayerRule.cpp
 css/CSSLineBoxContainValue.cpp
 css/CSSMarkup.cpp
 css/CSSMediaRule.cpp
@@ -2833,6 +2834,7 @@
 JSCSSImportRule.cpp
 JSCSSKeyframeRule.cpp
 JSCSSKeyframesRule.cpp
+JSCSSLayerRule.cpp
 JSCSSMediaRule.cpp
 JSCSSNamespaceRule.cpp
 JSCSSPageRule.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (283169 => 283170)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-09-28 15:36:25 UTC (rev 283169)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-09-28 15:40:24 UTC (rev 283170)
@@ -16388,6 +16388,9 @@
 		E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ResourceLoadPriority.h; sourceTree = "<group>"; };
 		E42E76D91C7AF76C00E3614D /* StyleUpdate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleUpdate.cpp; sourceTree = "<group>"; };
 		E42E76DB1C7AF77600E3614D /* StyleUpdate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleUpdate.h; sourceTree = "<group>"; };
+		E430C1B727030941003B553F /* CSSLayerRule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSLayerRule.h; sourceTree = "<group>"; };
+		E430C1B92703094E003B553F /* CSSLayerRule.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSLayerRule.idl; sourceTree = "<group>"; };
+		E430C1BA27030B86003B553F /* CSSLayerRule.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CSSLayerRule.cpp; sourceTree = "<group>"; };
 		E43105B716750F0C00DB2FB8 /* NodeTraversal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NodeTraversal.cpp; sourceTree = "<group>"; };
 		E43105BA16750F1600DB2FB8 /* NodeTraversal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeTraversal.h; sourceTree = "<group>"; };
 		E4312AB524B3265600678349 /* LayoutIntegrationPagination.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutIntegrationPagination.cpp; sourceTree = "<group>"; };
@@ -29625,6 +29628,9 @@
 				31288E700E3005D6003619AE /* CSSKeyframesRule.cpp */,
 				31288E710E3005D6003619AE /* CSSKeyframesRule.h */,
 				316FE0920E6CCD7F00BF6088 /* CSSKeyframesRule.idl */,
+				E430C1BA27030B86003B553F /* CSSLayerRule.cpp */,
+				E430C1B727030941003B553F /* CSSLayerRule.h */,
+				E430C1B92703094E003B553F /* CSSLayerRule.idl */,
 				BC772E15133162C2001EC9CE /* CSSLineBoxContainValue.cpp */,
 				BC772E121331620C001EC9CE /* CSSLineBoxContainValue.h */,
 				946D37471D6D060C0077084F /* CSSMarkup.cpp */,

Added: trunk/Source/WebCore/css/CSSLayerRule.cpp (0 => 283170)


--- trunk/Source/WebCore/css/CSSLayerRule.cpp	                        (rev 0)
+++ trunk/Source/WebCore/css/CSSLayerRule.cpp	2021-09-28 15:40:24 UTC (rev 283170)
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials
+ *    provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "CSSLayerRule.h"
+
+#include "CSSStyleSheet.h"
+#include "StyleRule.h"
+#include <wtf/text/StringBuilder.h>
+
+namespace WebCore {
+
+CSSLayerRule::CSSLayerRule(StyleRuleLayer& rule, CSSStyleSheet* parent)
+    : CSSGroupingRule(rule, parent)
+{
+}
+
+Ref<CSSLayerRule> CSSLayerRule::create(StyleRuleLayer& rule, CSSStyleSheet* parent)
+{
+    return adoptRef(*new CSSLayerRule(rule, parent));
+}
+
+String CSSLayerRule::cssText() const
+{
+    auto& layer = downcast<StyleRuleLayer>(groupRule());
+
+    StringBuilder result;
+
+    auto appendLayerName = [&](auto& name) {
+        for (auto& segment : name) {
+            result.append(segment);
+            if (&segment != &name.last())
+                result.append('.');
+        }
+    };
+
+    if (layer.isStatement()) {
+        result.append("@layer ");
+        for (auto& name : layer.nameList()) {
+            appendLayerName(name);
+            if (&name != &layer.nameList().last())
+                result.append(", ");
+        }
+        result.append(';');
+        return result.toString();
+    }
+
+    result.append("@layer ");
+    if (!layer.name().isEmpty()) {
+        appendLayerName(layer.name());
+        result.append(' ');
+    }
+    result.append("{\n");
+    appendCSSTextForItems(result);
+    result.append('}');
+    return result.toString();
+}
+
+} // namespace WebCore
+

Added: trunk/Source/WebCore/css/CSSLayerRule.h (0 => 283170)


--- trunk/Source/WebCore/css/CSSLayerRule.h	                        (rev 0)
+++ trunk/Source/WebCore/css/CSSLayerRule.h	2021-09-28 15:40:24 UTC (rev 283170)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials
+ *    provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "CSSGroupingRule.h"
+
+namespace WebCore {
+
+class StyleRuleLayer;
+
+class CSSLayerRule final : public CSSGroupingRule {
+public:
+    static Ref<CSSLayerRule> create(StyleRuleLayer&, CSSStyleSheet* parent);
+
+    String cssText() const final;
+
+private:
+    CSSLayerRule(StyleRuleLayer&, CSSStyleSheet*);
+    CSSRule::Type type() const final { return LAYER_RULE; }
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSLayerRule, CSSRule::LAYER_RULE)

Added: trunk/Source/WebCore/css/CSSLayerRule.idl (0 => 283170)


--- trunk/Source/WebCore/css/CSSLayerRule.idl	                        (rev 0)
+++ trunk/Source/WebCore/css/CSSLayerRule.idl	2021-09-28 15:40:24 UTC (rev 283170)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials
+ *    provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+[
+    Exposed=Window
+] interface CSSLayerRule : CSSGroupingRule {
+};

Modified: trunk/Source/WebCore/css/CSSRule.h (283169 => 283170)


--- trunk/Source/WebCore/css/CSSRule.h	2021-09-28 15:36:25 UTC (rev 283169)
+++ trunk/Source/WebCore/css/CSSRule.h	2021-09-28 15:40:24 UTC (rev 283170)
@@ -36,7 +36,7 @@
 public:
     virtual ~CSSRule() = default;
 
-    // WebIDL enum
+    // FIXME: Remove pointless duplication by replacing with StyleRuleType.
     enum Type {
         UNKNOWN_RULE = 0,
         STYLE_RULE = 1,
@@ -51,7 +51,8 @@
         NAMESPACE_RULE = 10,
         COUNTER_STYLE_RULE = 11,
         SUPPORTS_RULE = 12,
-        FONT_PALETTE_VALUES_RULE = 19
+        LAYER_RULE = 16,
+        FONT_PALETTE_VALUES_RULE = 19,
     };
 
     enum DeprecatedType {

Modified: trunk/Source/WebCore/css/StyleRule.cpp (283169 => 283170)


--- trunk/Source/WebCore/css/StyleRule.cpp	2021-09-28 15:36:25 UTC (rev 283169)
+++ trunk/Source/WebCore/css/StyleRule.cpp	2021-09-28 15:40:24 UTC (rev 283170)
@@ -29,6 +29,7 @@
 #include "CSSImportRule.h"
 #include "CSSKeyframeRule.h"
 #include "CSSKeyframesRule.h"
+#include "CSSLayerRule.h"
 #include "CSSMediaRule.h"
 #include "CSSNamespaceRule.h"
 #include "CSSPageRule.h"
@@ -177,7 +178,8 @@
         rule = CSSCounterStyleRule::create(downcast<StyleRuleCounterStyle>(self), parentSheet);
         break;
     case StyleRuleType::Layer:
-        // FIXME: Implement.
+        rule = CSSLayerRule::create(downcast<StyleRuleLayer>(self), parentSheet);
+        break;
     case StyleRuleType::Unknown:
     case StyleRuleType::Charset:
     case StyleRuleType::Keyframe:

Modified: trunk/Source/WebCore/css/StyleRuleType.h (283169 => 283170)


--- trunk/Source/WebCore/css/StyleRuleType.h	2021-09-28 15:36:25 UTC (rev 283169)
+++ trunk/Source/WebCore/css/StyleRuleType.h	2021-09-28 15:40:24 UTC (rev 283170)
@@ -37,12 +37,11 @@
     Page = 6,
     Keyframes = 7,
     Keyframe = 8, // Not used. These are internally non-rule StyleRuleKeyframe objects.
-    // Margin = 9, FIXME: Why is this missing?
     Namespace = 10,
     CounterStyle = 11,
     Supports = 12,
+    Layer = 16,
     FontPaletteValues = 19,
-    Layer = 20
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (283169 => 283170)


--- trunk/Source/WebCore/css/StyleSheetContents.cpp	2021-09-28 15:36:25 UTC (rev 283169)
+++ trunk/Source/WebCore/css/StyleSheetContents.cpp	2021-09-28 15:40:24 UTC (rev 283170)
@@ -243,9 +243,11 @@
         if (!is<StyleRuleLayer>(rule))
             return false;
         auto& layerRule = downcast<StyleRuleLayer>(rule.get());
-        if (layerRule.isStatement())
+        if (layerRule.isStatement()) {
             m_layerRulesBeforeImportRules.insert(childVectorIndex, &layerRule);
-        else if (childVectorIndex < m_layerRulesBeforeImportRules.size())
+            return true;
+        }
+        if (childVectorIndex < m_layerRulesBeforeImportRules.size())
             return false;
     }
     childVectorIndex -= m_layerRulesBeforeImportRules.size();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to