Title: [286657] trunk
Revision
286657
Author
[email protected]
Date
2021-12-08 08:55:05 -0800 (Wed, 08 Dec 2021)

Log Message

[CSS Cascade Layers] Update CSSOM to the spec
https://bugs.webkit.org/show_bug.cgi?id=231340
<rdar://problem/83958697>

Reviewed by Simon Fraser.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-cascade/idlharness-expected.txt:
* web-platform-tests/css/css-cascade/layer-rules-cssom-expected.txt:

Source/WebCore:

Add CSSLayerBlockRule and CSSLayerStatementRule interfaces.
Also add support for layerName property of CSSImportRule.

https://www.w3.org/TR/css-cascade-5/#layer-apis

* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSCSSRuleCustom.cpp:
(WebCore::toJSNewlyCreated):
* css/CSSImportRule+Layer.idl: Copied from Source/WebCore/css/CSSLayerRule.idl.
* css/CSSImportRule.cpp:
(WebCore::CSSImportRule::layerName const):
(WebCore::CSSImportRule::cascadeLayerName const): Deleted.
* css/CSSImportRule.h:
* css/CSSLayerBlockRule.cpp: Renamed from Source/WebCore/css/CSSLayerRule.cpp.
(WebCore::CSSLayerBlockRule::CSSLayerBlockRule):
(WebCore::CSSLayerBlockRule::create):
(WebCore::CSSLayerBlockRule::cssText const):
(WebCore::CSSLayerBlockRule::name const):
(WebCore::stringFromCascadeLayerName):
* css/CSSLayerBlockRule.h: Copied from Source/WebCore/css/CSSLayerRule.h.
* css/CSSLayerBlockRule.idl: Copied from Source/WebCore/css/CSSLayerRule.idl.
* css/CSSLayerStatementRule.cpp: Copied from Source/WebCore/css/CSSLayerRule.h.
(WebCore::CSSLayerStatementRule::CSSLayerStatementRule):
(WebCore::CSSLayerStatementRule::create):
(WebCore::CSSLayerStatementRule::cssText const):
(WebCore::CSSLayerStatementRule::nameList const):
(WebCore::CSSLayerStatementRule::reattach):
* css/CSSLayerStatementRule.h: Renamed from Source/WebCore/css/CSSLayerRule.h.
* css/CSSLayerStatementRule.idl: Renamed from Source/WebCore/css/CSSLayerRule.idl.
* css/CSSRule.h:
* css/StyleRule.cpp:
(WebCore::StyleRuleBase::destroy):
(WebCore::StyleRuleBase::copy const):
(WebCore::StyleRuleBase::createCSSOMWrapper const):
(WebCore::StyleRuleLayer::StyleRuleLayer):
* css/StyleRule.h:
(WebCore::StyleRuleBase::isGroupRule const):
(WebCore::StyleRuleBase::isLayerRule const):
* css/StyleRuleType.h:
* css/StyleSheetContents.cpp:
(WebCore::traverseRulesInVector):
(WebCore::StyleSheetContents::traverseSubresources const):
* css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::consumeLayerRule):
* inspector/InspectorStyleSheet.cpp:
(flattenSourceData):
(WebCore::asCSSRuleList):
(WebCore::buildArrayForGroupings):
* style/InspectorCSSOMWrappers.cpp:
(WebCore::Style::InspectorCSSOMWrappers::collect):

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (286656 => 286657)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-12-08 16:55:05 UTC (rev 286657)
@@ -1,3 +1,14 @@
+2021-12-08  Antti Koivisto  <[email protected]>
+
+        [CSS Cascade Layers] Update CSSOM to the spec
+        https://bugs.webkit.org/show_bug.cgi?id=231340
+        <rdar://problem/83958697>
+
+        Reviewed by Simon Fraser.
+
+        * web-platform-tests/css/css-cascade/idlharness-expected.txt:
+        * web-platform-tests/css/css-cascade/layer-rules-cssom-expected.txt:
+
 2021-12-08  Antoine Quint  <[email protected]>
 
         'border-radius shorthand is getting expanded in WebKit

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/idlharness-expected.txt (286656 => 286657)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/idlharness-expected.txt	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/idlharness-expected.txt	2021-12-08 16:55:05 UTC (rev 286657)
@@ -4,26 +4,26 @@
 PASS Partial interface CSSImportRule: original interface defined
 PASS Partial interface CSSImportRule: valid exposure set
 PASS Partial interface CSSImportRule: member names are unique
-FAIL CSSLayerBlockRule interface: existence and properties of interface object assert_own_property: self does not have own property "CSSLayerBlockRule" expected property "CSSLayerBlockRule" missing
-FAIL CSSLayerBlockRule interface object length assert_own_property: self does not have own property "CSSLayerBlockRule" expected property "CSSLayerBlockRule" missing
-FAIL CSSLayerBlockRule interface object name assert_own_property: self does not have own property "CSSLayerBlockRule" expected property "CSSLayerBlockRule" missing
-FAIL CSSLayerBlockRule interface: existence and properties of interface prototype object assert_own_property: self does not have own property "CSSLayerBlockRule" expected property "CSSLayerBlockRule" missing
-FAIL CSSLayerBlockRule interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "CSSLayerBlockRule" expected property "CSSLayerBlockRule" missing
-FAIL CSSLayerBlockRule interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "CSSLayerBlockRule" expected property "CSSLayerBlockRule" missing
-FAIL CSSLayerBlockRule interface: attribute name assert_own_property: self does not have own property "CSSLayerBlockRule" expected property "CSSLayerBlockRule" missing
-FAIL CSSLayerBlockRule must be primary interface of block assert_own_property: self does not have own property "CSSLayerBlockRule" expected property "CSSLayerBlockRule" missing
-FAIL Stringification of block assert_class_string: class string of block expected "[object CSSLayerBlockRule]" but got "[object CSSRule]"
-FAIL CSSLayerBlockRule interface: block must inherit property "name" with the proper type assert_inherits: property "name" not found in prototype chain
-FAIL CSSLayerStatementRule interface: existence and properties of interface object assert_own_property: self does not have own property "CSSLayerStatementRule" expected property "CSSLayerStatementRule" missing
-FAIL CSSLayerStatementRule interface object length assert_own_property: self does not have own property "CSSLayerStatementRule" expected property "CSSLayerStatementRule" missing
-FAIL CSSLayerStatementRule interface object name assert_own_property: self does not have own property "CSSLayerStatementRule" expected property "CSSLayerStatementRule" missing
-FAIL CSSLayerStatementRule interface: existence and properties of interface prototype object assert_own_property: self does not have own property "CSSLayerStatementRule" expected property "CSSLayerStatementRule" missing
-FAIL CSSLayerStatementRule interface: existence and properties of interface prototype object's "constructor" property assert_own_property: self does not have own property "CSSLayerStatementRule" expected property "CSSLayerStatementRule" missing
-FAIL CSSLayerStatementRule interface: existence and properties of interface prototype object's @@unscopables property assert_own_property: self does not have own property "CSSLayerStatementRule" expected property "CSSLayerStatementRule" missing
-FAIL CSSLayerStatementRule interface: attribute nameList assert_own_property: self does not have own property "CSSLayerStatementRule" expected property "CSSLayerStatementRule" missing
-FAIL CSSLayerStatementRule must be primary interface of statement assert_own_property: self does not have own property "CSSLayerStatementRule" expected property "CSSLayerStatementRule" missing
-FAIL Stringification of statement assert_class_string: class string of statement expected "[object CSSLayerStatementRule]" but got "[object CSSRule]"
-FAIL CSSLayerStatementRule interface: statement must inherit property "nameList" with the proper type assert_inherits: property "nameList" not found in prototype chain
-FAIL CSSImportRule interface: attribute layerName assert_true: The prototype object must have a property "layerName" expected true got false
-FAIL CSSImportRule interface: layeredImport must inherit property "layerName" with the proper type assert_inherits: property "layerName" not found in prototype chain
+PASS CSSLayerBlockRule interface: existence and properties of interface object
+PASS CSSLayerBlockRule interface object length
+PASS CSSLayerBlockRule interface object name
+PASS CSSLayerBlockRule interface: existence and properties of interface prototype object
+PASS CSSLayerBlockRule interface: existence and properties of interface prototype object's "constructor" property
+PASS CSSLayerBlockRule interface: existence and properties of interface prototype object's @@unscopables property
+PASS CSSLayerBlockRule interface: attribute name
+PASS CSSLayerBlockRule must be primary interface of block
+PASS Stringification of block
+PASS CSSLayerBlockRule interface: block must inherit property "name" with the proper type
+PASS CSSLayerStatementRule interface: existence and properties of interface object
+PASS CSSLayerStatementRule interface object length
+PASS CSSLayerStatementRule interface object name
+PASS CSSLayerStatementRule interface: existence and properties of interface prototype object
+PASS CSSLayerStatementRule interface: existence and properties of interface prototype object's "constructor" property
+PASS CSSLayerStatementRule interface: existence and properties of interface prototype object's @@unscopables property
+PASS CSSLayerStatementRule interface: attribute nameList
+PASS CSSLayerStatementRule must be primary interface of statement
+PASS Stringification of statement
+PASS CSSLayerStatementRule interface: statement must inherit property "nameList" with the proper type
+PASS CSSImportRule interface: attribute layerName
+PASS CSSImportRule interface: layeredImport must inherit property "layerName" with the proper type
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/layer-rules-cssom-expected.txt (286656 => 286657)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/layer-rules-cssom-expected.txt	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/layer-rules-cssom-expected.txt	2021-12-08 16:55:05 UTC (rev 286657)
@@ -1,11 +1,11 @@
 
-FAIL Basic layer block name assert_implements: undefined
-FAIL Anonymous layer block name assert_implements: undefined
-FAIL Basic layer statement name assert_implements: undefined
-FAIL Layer statement with multiple names assert_implements: undefined
-FAIL Nested layer block names assert_implements: undefined
-FAIL Nested layer statement name lists assert_implements: undefined
-FAIL Import into anonymous layer assert_implements: undefined
-FAIL Import into named layer assert_implements: undefined
-FAIL Import without layer assert_implements: undefined
+PASS Basic layer block name
+PASS Anonymous layer block name
+PASS Basic layer statement name
+PASS Layer statement with multiple names
+PASS Nested layer block names
+PASS Nested layer statement name lists
+PASS Import into anonymous layer
+PASS Import into named layer
+PASS Import without layer
 

Modified: trunk/Source/WebCore/CMakeLists.txt (286656 => 286657)


--- trunk/Source/WebCore/CMakeLists.txt	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/CMakeLists.txt	2021-12-08 16:55:05 UTC (rev 286657)
@@ -750,7 +750,8 @@
     css/CSSImportRule.idl
     css/CSSKeyframeRule.idl
     css/CSSKeyframesRule.idl
-    css/CSSLayerRule.idl
+    css/CSSLayerBlockRule.idl
+    css/CSSLayerStatementRule.idl
     css/CSSMediaRule.idl
     css/CSSNamespaceRule.idl
     css/CSSPaintCallback.idl

Modified: trunk/Source/WebCore/ChangeLog (286656 => 286657)


--- trunk/Source/WebCore/ChangeLog	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/ChangeLog	2021-12-08 16:55:05 UTC (rev 286657)
@@ -1,3 +1,66 @@
+2021-12-08  Antti Koivisto  <[email protected]>
+
+        [CSS Cascade Layers] Update CSSOM to the spec
+        https://bugs.webkit.org/show_bug.cgi?id=231340
+        <rdar://problem/83958697>
+
+        Reviewed by Simon Fraser.
+
+        Add CSSLayerBlockRule and CSSLayerStatementRule interfaces.
+        Also add support for layerName property of CSSImportRule.
+
+        https://www.w3.org/TR/css-cascade-5/#layer-apis
+
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/JSCSSRuleCustom.cpp:
+        (WebCore::toJSNewlyCreated):
+        * css/CSSImportRule+Layer.idl: Copied from Source/WebCore/css/CSSLayerRule.idl.
+        * css/CSSImportRule.cpp:
+        (WebCore::CSSImportRule::layerName const):
+        (WebCore::CSSImportRule::cascadeLayerName const): Deleted.
+        * css/CSSImportRule.h:
+        * css/CSSLayerBlockRule.cpp: Renamed from Source/WebCore/css/CSSLayerRule.cpp.
+        (WebCore::CSSLayerBlockRule::CSSLayerBlockRule):
+        (WebCore::CSSLayerBlockRule::create):
+        (WebCore::CSSLayerBlockRule::cssText const):
+        (WebCore::CSSLayerBlockRule::name const):
+        (WebCore::stringFromCascadeLayerName):
+        * css/CSSLayerBlockRule.h: Copied from Source/WebCore/css/CSSLayerRule.h.
+        * css/CSSLayerBlockRule.idl: Copied from Source/WebCore/css/CSSLayerRule.idl.
+        * css/CSSLayerStatementRule.cpp: Copied from Source/WebCore/css/CSSLayerRule.h.
+        (WebCore::CSSLayerStatementRule::CSSLayerStatementRule):
+        (WebCore::CSSLayerStatementRule::create):
+        (WebCore::CSSLayerStatementRule::cssText const):
+        (WebCore::CSSLayerStatementRule::nameList const):
+        (WebCore::CSSLayerStatementRule::reattach):
+        * css/CSSLayerStatementRule.h: Renamed from Source/WebCore/css/CSSLayerRule.h.
+        * css/CSSLayerStatementRule.idl: Renamed from Source/WebCore/css/CSSLayerRule.idl.
+        * css/CSSRule.h:
+        * css/StyleRule.cpp:
+        (WebCore::StyleRuleBase::destroy):
+        (WebCore::StyleRuleBase::copy const):
+        (WebCore::StyleRuleBase::createCSSOMWrapper const):
+        (WebCore::StyleRuleLayer::StyleRuleLayer):
+        * css/StyleRule.h:
+        (WebCore::StyleRuleBase::isGroupRule const):
+        (WebCore::StyleRuleBase::isLayerRule const):
+        * css/StyleRuleType.h:
+        * css/StyleSheetContents.cpp:
+        (WebCore::traverseRulesInVector):
+        (WebCore::StyleSheetContents::traverseSubresources const):
+        * css/parser/CSSParserImpl.cpp:
+        (WebCore::CSSParserImpl::consumeLayerRule):
+        * inspector/InspectorStyleSheet.cpp:
+        (flattenSourceData):
+        (WebCore::asCSSRuleList):
+        (WebCore::buildArrayForGroupings):
+        * style/InspectorCSSOMWrappers.cpp:
+        (WebCore::Style::InspectorCSSOMWrappers::collect):
+
 2021-12-08  Youenn Fablet  <[email protected]>
 
         Same-site lax cookies not sent by fetch event handler after page reload

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (286656 => 286657)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2021-12-08 16:55:05 UTC (rev 286657)
@@ -878,10 +878,12 @@
 $(PROJECT_DIR)/css/CSSFontFaceRule.idl
 $(PROJECT_DIR)/css/CSSFontPaletteValuesRule.idl
 $(PROJECT_DIR)/css/CSSGroupingRule.idl
+$(PROJECT_DIR)/css/CSSImportRule+Layer.idl
 $(PROJECT_DIR)/css/CSSImportRule.idl
 $(PROJECT_DIR)/css/CSSKeyframeRule.idl
 $(PROJECT_DIR)/css/CSSKeyframesRule.idl
-$(PROJECT_DIR)/css/CSSLayerRule.idl
+$(PROJECT_DIR)/css/CSSLayerBlockRule.idl
+$(PROJECT_DIR)/css/CSSLayerStatementRule.idl
 $(PROJECT_DIR)/css/CSSMediaRule.idl
 $(PROJECT_DIR)/css/CSSNamespaceRule.idl
 $(PROJECT_DIR)/css/CSSPageRule.idl
@@ -1325,8 +1327,8 @@
 $(PROJECT_DIR)/html/parser/HTMLEntityNames.in
 $(PROJECT_DIR)/html/parser/create-html-entity-table
 $(PROJECT_DIR)/html/shadow/imageOverlay.css
+$(PROJECT_DIR)/html/shadow/mac/imageControlsMac.css
 $(PROJECT_DIR)/html/shadow/meterElementShadow.css
-$(PROJECT_DIR)/html/shadow/mac/imageControlsMac.css
 $(PROJECT_DIR)/html/track/AudioTrack.idl
 $(PROJECT_DIR)/html/track/AudioTrackList.idl
 $(PROJECT_DIR)/html/track/DataCue.idl

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (286656 => 286657)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2021-12-08 16:55:05 UTC (rev 286657)
@@ -296,6 +296,8 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSFontPaletteValuesRule.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSGroupingRule.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSGroupingRule.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSImportRule+Layer.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSImportRule+Layer.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSImportRule.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSImportRule.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSKeyframeRule.cpp
@@ -304,8 +306,10 @@
 $(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/JSCSSLayerBlockRule.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSLayerBlockRule.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSLayerStatementRule.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSCSSLayerStatementRule.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 (286656 => 286657)


--- trunk/Source/WebCore/DerivedSources.make	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/DerivedSources.make	2021-12-08 16:55:05 UTC (rev 286657)
@@ -758,7 +758,9 @@
     $(WebCore)/css/CSSFontPaletteValuesRule.idl \
     $(WebCore)/css/CSSGroupingRule.idl \
     $(WebCore)/css/CSSImportRule.idl \
-    $(WebCore)/css/CSSLayerRule.idl \
+    $(WebCore)/css/CSSImportRule+Layer.idl \
+    $(WebCore)/css/CSSLayerBlockRule.idl \
+    $(WebCore)/css/CSSLayerStatementRule.idl \
     $(WebCore)/css/CSSKeyframeRule.idl \
     $(WebCore)/css/CSSKeyframesRule.idl \
     $(WebCore)/css/CSSMediaRule.idl \

Modified: trunk/Source/WebCore/Sources.txt (286656 => 286657)


--- trunk/Source/WebCore/Sources.txt	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/Sources.txt	2021-12-08 16:55:05 UTC (rev 286657)
@@ -733,7 +733,8 @@
 css/CSSImportRule.cpp
 css/CSSKeyframeRule.cpp
 css/CSSKeyframesRule.cpp
-css/CSSLayerRule.cpp
+css/CSSLayerBlockRule.cpp
+css/CSSLayerStatementRule.cpp
 css/CSSLineBoxContainValue.cpp
 css/CSSMarkup.cpp
 css/CSSMediaRule.cpp
@@ -2925,7 +2926,8 @@
 JSCSSImportRule.cpp
 JSCSSKeyframeRule.cpp
 JSCSSKeyframesRule.cpp
-JSCSSLayerRule.cpp
+JSCSSLayerBlockRule.cpp
+JSCSSLayerStatementRule.cpp
 JSCSSMediaRule.cpp
 JSCSSNamespaceRule.cpp
 JSCSSPageRule.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (286656 => 286657)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-12-08 16:55:05 UTC (rev 286657)
@@ -5388,6 +5388,8 @@
 		E4F38D1B2626F13B007B1064 /* DefaultResourceLoadPriority.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F38D192626F13B007B1064 /* DefaultResourceLoadPriority.h */; };
 		E4F819C626FB4EBF0094E162 /* InlineBoxPainter.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F819C526FB4EBF0094E162 /* InlineBoxPainter.h */; };
 		E4F9EEF3156DA00700D23E7E /* StyleSheetContents.h in Headers */ = {isa = PBXBuildFile; fileRef = E4F9EEF1156D84C400D23E7E /* StyleSheetContents.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		E4FFCEBB2760AC0100A68B03 /* CSSLayerStatementRule.h in Headers */ = {isa = PBXBuildFile; fileRef = E4FFCEB82760AC0000A68B03 /* CSSLayerStatementRule.h */; };
+		E4FFCEBE2760AC1600A68B03 /* CSSLayerBlockRule.h in Headers */ = {isa = PBXBuildFile; fileRef = E430C1B727030941003B553F /* CSSLayerBlockRule.h */; };
 		E50620842540919C00C43091 /* ContactsRequestData.h in Headers */ = {isa = PBXBuildFile; fileRef = E50620832540919B00C43091 /* ContactsRequestData.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E51194BF270E7E4A0064FCBA /* ShadowPseudoIds.h in Headers */ = {isa = PBXBuildFile; fileRef = E51194BD270E7E4A0064FCBA /* ShadowPseudoIds.h */; };
 		E516699120FF9918009D2C27 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = E516698F20FF9916009D2C27 /* [email protected] */; };
@@ -17225,6 +17227,7 @@
 		E403B79F251B118B0019E800 /* LayoutIntegrationCoverage.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutIntegrationCoverage.cpp; sourceTree = "<group>"; };
 		E403B7A1251B11930019E800 /* LayoutIntegrationCoverage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutIntegrationCoverage.h; sourceTree = "<group>"; };
 		E406F3FB1198307D009D59D6 /* ColorData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ColorData.cpp; path = DerivedSources/WebCore/ColorData.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
+		E4114B252760DC36007B789B /* CSSImportRule+Layer.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = "CSSImportRule+Layer.idl"; sourceTree = "<group>"; };
 		E415EB11270C351200E8DA1B /* InlineIteratorInlineBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineIteratorInlineBox.h; sourceTree = "<group>"; };
 		E415EB14270C353700E8DA1B /* InlineIteratorInlineBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InlineIteratorInlineBox.cpp; sourceTree = "<group>"; };
 		E418025323D4549A00FFB071 /* LayoutIntegrationBoxTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutIntegrationBoxTree.h; sourceTree = "<group>"; };
@@ -17242,9 +17245,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>"; };
+		E430C1B727030941003B553F /* CSSLayerBlockRule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CSSLayerBlockRule.h; sourceTree = "<group>"; };
+		E430C1B92703094E003B553F /* CSSLayerBlockRule.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = CSSLayerBlockRule.idl; sourceTree = "<group>"; };
+		E430C1BA27030B86003B553F /* CSSLayerBlockRule.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CSSLayerBlockRule.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>"; };
@@ -17461,6 +17464,9 @@
 		E4F9EEF0156D84C400D23E7E /* StyleSheetContents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleSheetContents.cpp; sourceTree = "<group>"; };
 		E4F9EEF1156D84C400D23E7E /* StyleSheetContents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleSheetContents.h; sourceTree = "<group>"; };
 		E4FB4B35239BEB10003C336A /* LayoutIntegrationInlineContent.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutIntegrationInlineContent.cpp; sourceTree = "<group>"; };
+		E4FFCEB82760AC0000A68B03 /* CSSLayerStatementRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSLayerStatementRule.h; sourceTree = "<group>"; };
+		E4FFCEB92760AC0000A68B03 /* CSSLayerStatementRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSLayerStatementRule.cpp; sourceTree = "<group>"; };
+		E4FFCEBA2760AC0100A68B03 /* CSSLayerStatementRule.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CSSLayerStatementRule.idl; sourceTree = "<group>"; };
 		E50620832540919B00C43091 /* ContactsRequestData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ContactsRequestData.h; sourceTree = "<group>"; };
 		E51194BD270E7E4A0064FCBA /* ShadowPseudoIds.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ShadowPseudoIds.h; sourceTree = "<group>"; };
 		E51194BE270E7E4A0064FCBA /* ShadowPseudoIds.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ShadowPseudoIds.cpp; sourceTree = "<group>"; };
@@ -31390,6 +31396,7 @@
 				9393E5FE151A99F200066F06 /* CSSImageSetValue.h */,
 				A80E6CD40A1989CA007FB8C5 /* CSSImageValue.cpp */,
 				A80E6CD00A1989CA007FB8C5 /* CSSImageValue.h */,
+				E4114B252760DC36007B789B /* CSSImportRule+Layer.idl */,
 				A80E6CC10A1989CA007FB8C5 /* CSSImportRule.cpp */,
 				A80E6CCC0A1989CA007FB8C5 /* CSSImportRule.h */,
 				85C56CA90AA89E6600D95755 /* CSSImportRule.idl */,
@@ -31399,9 +31406,12 @@
 				31288E700E3005D6003619AE /* CSSKeyframesRule.cpp */,
 				31288E710E3005D6003619AE /* CSSKeyframesRule.h */,
 				316FE0920E6CCD7F00BF6088 /* CSSKeyframesRule.idl */,
-				E430C1BA27030B86003B553F /* CSSLayerRule.cpp */,
-				E430C1B727030941003B553F /* CSSLayerRule.h */,
-				E430C1B92703094E003B553F /* CSSLayerRule.idl */,
+				E430C1BA27030B86003B553F /* CSSLayerBlockRule.cpp */,
+				E430C1B727030941003B553F /* CSSLayerBlockRule.h */,
+				E430C1B92703094E003B553F /* CSSLayerBlockRule.idl */,
+				E4FFCEB92760AC0000A68B03 /* CSSLayerStatementRule.cpp */,
+				E4FFCEB82760AC0000A68B03 /* CSSLayerStatementRule.h */,
+				E4FFCEBA2760AC0100A68B03 /* CSSLayerStatementRule.idl */,
 				BC772E15133162C2001EC9CE /* CSSLineBoxContainValue.cpp */,
 				BC772E121331620C001EC9CE /* CSSLineBoxContainValue.h */,
 				946D37471D6D060C0077084F /* CSSMarkup.cpp */,
@@ -33769,6 +33779,8 @@
 				31288E730E3005D6003619AE /* CSSKeyframeRule.h in Headers */,
 				31288E750E3005D6003619AE /* CSSKeyframesRule.h in Headers */,
 				2A4107A426CB66F8003BF797 /* CSSKeywordValue.h in Headers */,
+				E4FFCEBE2760AC1600A68B03 /* CSSLayerBlockRule.h in Headers */,
+				E4FFCEBB2760AC0100A68B03 /* CSSLayerStatementRule.h in Headers */,
 				BC772E131331620C001EC9CE /* CSSLineBoxContainValue.h in Headers */,
 				946D374A1D6D06280077084F /* CSSMarkup.h in Headers */,
 				2AEF6FD326E7ECA500326D02 /* CSSMathInvert.h in Headers */,

Modified: trunk/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp (286656 => 286657)


--- trunk/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/bindings/js/JSCSSRuleCustom.cpp	2021-12-08 16:55:05 UTC (rev 286657)
@@ -32,6 +32,8 @@
 #include "CSSImportRule.h"
 #include "CSSKeyframeRule.h"
 #include "CSSKeyframesRule.h"
+#include "CSSLayerBlockRule.h"
+#include "CSSLayerStatementRule.h"
 #include "CSSMediaRule.h"
 #include "CSSNamespaceRule.h"
 #include "CSSPageRule.h"
@@ -43,6 +45,8 @@
 #include "JSCSSImportRule.h"
 #include "JSCSSKeyframeRule.h"
 #include "JSCSSKeyframesRule.h"
+#include "JSCSSLayerBlockRule.h"
+#include "JSCSSLayerStatementRule.h"
 #include "JSCSSMediaRule.h"
 #include "JSCSSNamespaceRule.h"
 #include "JSCSSPageRule.h"
@@ -88,7 +92,13 @@
         return createWrapper<CSSSupportsRule>(globalObject, WTFMove(rule));
     case CSSRule::COUNTER_STYLE_RULE:
         return createWrapper<CSSCounterStyleRule>(globalObject, WTFMove(rule));
-    default:
+    case CSSRule::LAYER_BLOCK_RULE:
+        return createWrapper<CSSLayerBlockRule>(globalObject, WTFMove(rule));
+    case CSSRule::LAYER_STATEMENT_RULE:
+        return createWrapper<CSSLayerStatementRule>(globalObject, WTFMove(rule));
+    case CSSRule::UNKNOWN_RULE:
+    case CSSRule::CHARSET_RULE:
+    case CSSRule::MARGIN_RULE:
         return createWrapper<CSSRule>(globalObject, WTFMove(rule));
     }
 }

Copied: trunk/Source/WebCore/css/CSSImportRule+Layer.idl (from rev 286656, trunk/Source/WebCore/css/CSSLayerRule.idl) (0 => 286657)


--- trunk/Source/WebCore/css/CSSImportRule+Layer.idl	                        (rev 0)
+++ trunk/Source/WebCore/css/CSSImportRule+Layer.idl	2021-12-08 16:55:05 UTC (rev 286657)
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+typedef USVString CSSOMString;
+
+[
+    Exposed=Window
+] partial interface CSSImportRule {
+  readonly attribute CSSOMString? layerName;
+};

Modified: trunk/Source/WebCore/css/CSSImportRule.cpp (286656 => 286657)


--- trunk/Source/WebCore/css/CSSImportRule.cpp	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/css/CSSImportRule.cpp	2021-12-08 16:55:05 UTC (rev 286657)
@@ -22,6 +22,7 @@
 #include "config.h"
 #include "CSSImportRule.h"
 
+#include "CSSLayerBlockRule.h"
 #include "CSSStyleSheet.h"
 #include "MediaList.h"
 #include "StyleRuleImport.h"
@@ -56,9 +57,13 @@
     return *m_mediaCSSOMWrapper;
 }
 
-const std::optional<CascadeLayerName>& CSSImportRule::cascadeLayerName() const
+String CSSImportRule::layerName() const
 {
-    return m_importRule.get().cascadeLayerName();
+    auto name = m_importRule.get().cascadeLayerName();
+    if (!name)
+        return { };
+
+    return stringFromCascadeLayerName(*name);
 }
 
 String CSSImportRule::cssText() const

Modified: trunk/Source/WebCore/css/CSSImportRule.h (286656 => 286657)


--- trunk/Source/WebCore/css/CSSImportRule.h	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/css/CSSImportRule.h	2021-12-08 16:55:05 UTC (rev 286657)
@@ -38,7 +38,7 @@
     WEBCORE_EXPORT String href() const;
     WEBCORE_EXPORT MediaList& media() const;
     WEBCORE_EXPORT CSSStyleSheet* styleSheet() const;
-    WEBCORE_EXPORT const std::optional<CascadeLayerName>& cascadeLayerName() const;
+    String layerName() const;
 
 private:
     CSSImportRule(StyleRuleImport&, CSSStyleSheet*);

Copied: trunk/Source/WebCore/css/CSSLayerBlockRule.cpp (from rev 286656, trunk/Source/WebCore/css/CSSLayerRule.cpp) (0 => 286657)


--- trunk/Source/WebCore/css/CSSLayerBlockRule.cpp	                        (rev 0)
+++ trunk/Source/WebCore/css/CSSLayerBlockRule.cpp	2021-12-08 16:55:05 UTC (rev 286657)
@@ -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 "CSSLayerBlockRule.h"
+
+#include "CSSStyleSheet.h"
+#include "StyleRule.h"
+#include <wtf/text/StringBuilder.h>
+
+namespace WebCore {
+
+CSSLayerBlockRule::CSSLayerBlockRule(StyleRuleLayer& rule, CSSStyleSheet* parent)
+    : CSSGroupingRule(rule, parent)
+{
+    ASSERT(!rule.isStatement());
+}
+
+Ref<CSSLayerBlockRule> CSSLayerBlockRule::create(StyleRuleLayer& rule, CSSStyleSheet* parent)
+{
+    return adoptRef(*new CSSLayerBlockRule(rule, parent));
+}
+
+String CSSLayerBlockRule::cssText() const
+{
+    StringBuilder result;
+
+    result.append("@layer ");
+    if (auto name = this->name(); !name.isEmpty())
+        result.append(name, " ");
+    result.append("{\n");
+    appendCSSTextForItems(result);
+    result.append('}');
+
+    return result.toString();
+}
+
+String CSSLayerBlockRule::name() const
+{
+    auto& layer = downcast<StyleRuleLayer>(groupRule());
+
+    if (layer.name().isEmpty())
+        return emptyString();
+
+    return stringFromCascadeLayerName(layer.name());
+}
+
+String stringFromCascadeLayerName(const CascadeLayerName& name)
+{
+    StringBuilder result;
+    for (auto& segment : name) {
+        result.append(segment);
+        if (&segment != &name.last())
+            result.append('.');
+    }
+    return result.toString();
+}
+
+} // namespace WebCore
+

Copied: trunk/Source/WebCore/css/CSSLayerBlockRule.h (from rev 286656, trunk/Source/WebCore/css/CSSLayerRule.h) (0 => 286657)


--- trunk/Source/WebCore/css/CSSLayerBlockRule.h	                        (rev 0)
+++ trunk/Source/WebCore/css/CSSLayerBlockRule.h	2021-12-08 16:55:05 UTC (rev 286657)
@@ -0,0 +1,53 @@
+/*
+ * 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"
+#include "StyleRule.h"
+
+namespace WebCore {
+
+class CSSLayerBlockRule final : public CSSGroupingRule {
+public:
+    static Ref<CSSLayerBlockRule> create(StyleRuleLayer&, CSSStyleSheet* parent);
+
+    String cssText() const final;
+    String name() const;
+
+private:
+    CSSLayerBlockRule(StyleRuleLayer&, CSSStyleSheet*);
+    CSSRule::Type type() const final { return LAYER_BLOCK_RULE; }
+};
+
+String stringFromCascadeLayerName(const CascadeLayerName&);
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSLayerBlockRule, CSSRule::LAYER_BLOCK_RULE)

Copied: trunk/Source/WebCore/css/CSSLayerBlockRule.idl (from rev 286656, trunk/Source/WebCore/css/CSSLayerRule.idl) (0 => 286657)


--- trunk/Source/WebCore/css/CSSLayerBlockRule.idl	                        (rev 0)
+++ trunk/Source/WebCore/css/CSSLayerBlockRule.idl	2021-12-08 16:55:05 UTC (rev 286657)
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+typedef USVString CSSOMString;
+
+[
+    Exposed=Window
+] interface CSSLayerBlockRule : CSSGroupingRule {
+    readonly attribute CSSOMString name;
+};

Deleted: trunk/Source/WebCore/css/CSSLayerRule.cpp (286656 => 286657)


--- trunk/Source/WebCore/css/CSSLayerRule.cpp	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/css/CSSLayerRule.cpp	2021-12-08 16:55:05 UTC (rev 286657)
@@ -1,97 +0,0 @@
-/*
- * 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;
-
-    if (layer.isStatement()) {
-        result.append("@layer ");
-        for (auto& name : layer.nameList()) {
-            result.append(stringFromCascadeLayerName(name));
-            if (&name != &layer.nameList().last())
-                result.append(", ");
-        }
-        result.append(';');
-        return result.toString();
-    }
-
-    result.append("@layer ");
-    if (auto name = layerName())
-        result.append(*name, " ");
-    result.append("{\n");
-    appendCSSTextForItems(result);
-    result.append('}');
-    return result.toString();
-}
-
-std::optional<String> CSSLayerRule::layerName() const
-{
-    auto& layer = downcast<StyleRuleLayer>(groupRule());
-
-    if (!layer.isStatement() && !layer.name().isEmpty())
-        return stringFromCascadeLayerName(layer.name());
-    
-    return std::nullopt;
-}
-
-String CSSLayerRule::stringFromCascadeLayerName(const CascadeLayerName& name)
-{
-    StringBuilder result;
-    for (auto& segment : name) {
-        result.append(segment);
-        if (&segment != &name.last())
-            result.append('.');
-    }
-    return result.toString();
-}
-
-} // namespace WebCore
-

Deleted: trunk/Source/WebCore/css/CSSLayerRule.h (286656 => 286657)


--- trunk/Source/WebCore/css/CSSLayerRule.h	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/css/CSSLayerRule.h	2021-12-08 16:55:05 UTC (rev 286657)
@@ -1,55 +0,0 @@
-/*
- * 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"
-#include "StyleRule.h"
-
-namespace WebCore {
-
-class StyleRuleLayer;
-
-class CSSLayerRule final : public CSSGroupingRule {
-public:
-    static Ref<CSSLayerRule> create(StyleRuleLayer&, CSSStyleSheet* parent);
-
-    String cssText() const final;
-    std::optional<String> layerName() const;
-
-    static String stringFromCascadeLayerName(const CascadeLayerName&);
-
-private:
-    CSSLayerRule(StyleRuleLayer&, CSSStyleSheet*);
-    CSSRule::Type type() const final { return LAYER_RULE; }
-};
-
-} // namespace WebCore
-
-SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSLayerRule, CSSRule::LAYER_RULE)

Deleted: trunk/Source/WebCore/css/CSSLayerRule.idl (286656 => 286657)


--- trunk/Source/WebCore/css/CSSLayerRule.idl	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/css/CSSLayerRule.idl	2021-12-08 16:55:05 UTC (rev 286657)
@@ -1,33 +0,0 @@
-/*
- * 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 {
-};

Copied: trunk/Source/WebCore/css/CSSLayerStatementRule.cpp (from rev 286656, trunk/Source/WebCore/css/CSSLayerRule.h) (0 => 286657)


--- trunk/Source/WebCore/css/CSSLayerStatementRule.cpp	                        (rev 0)
+++ trunk/Source/WebCore/css/CSSLayerStatementRule.cpp	2021-12-08 16:55:05 UTC (rev 286657)
@@ -0,0 +1,84 @@
+/*
+ * 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 "CSSLayerStatementRule.h"
+
+#include "CSSStyleSheet.h"
+#include "StyleRule.h"
+#include <wtf/text/StringBuilder.h>
+
+namespace WebCore {
+
+CSSLayerStatementRule::CSSLayerStatementRule(StyleRuleLayer& rule, CSSStyleSheet* parent)
+    : CSSRule(parent)
+    , m_layerRule(rule)
+{
+    ASSERT(rule.isStatement());
+}
+
+Ref<CSSLayerStatementRule> CSSLayerStatementRule::create(StyleRuleLayer& rule, CSSStyleSheet* parent)
+{
+    return adoptRef(*new CSSLayerStatementRule(rule, parent));
+}
+
+String CSSLayerStatementRule::cssText() const
+{
+    StringBuilder result;
+
+    result.append("@layer ");
+
+    auto nameList = this->nameList();
+    for (auto& name : nameList) {
+        result.append(name);
+        if (&name != &nameList.last())
+            result.append(", ");
+    }
+    result.append(';');
+
+    return result.toString();
+}
+
+Vector<String> CSSLayerStatementRule::nameList() const
+{
+    Vector<String> result;
+
+    for (auto& name : m_layerRule.get().nameList())
+        result.append(stringFromCascadeLayerName(name));
+
+    return result;
+}
+
+void CSSLayerStatementRule::reattach(StyleRuleBase& rule)
+{
+    m_layerRule = static_cast<StyleRuleLayer&>(rule);
+}
+
+} // namespace WebCore
+

Copied: trunk/Source/WebCore/css/CSSLayerStatementRule.h (from rev 286656, trunk/Source/WebCore/css/CSSLayerRule.h) (0 => 286657)


--- trunk/Source/WebCore/css/CSSLayerStatementRule.h	                        (rev 0)
+++ trunk/Source/WebCore/css/CSSLayerStatementRule.h	2021-12-08 16:55:05 UTC (rev 286657)
@@ -0,0 +1,54 @@
+/*
+ * 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"
+#include "StyleRule.h"
+
+namespace WebCore {
+
+class CSSLayerStatementRule final : public CSSRule {
+public:
+    static Ref<CSSLayerStatementRule> create(StyleRuleLayer&, CSSStyleSheet* parent);
+
+    String cssText() const final;
+    Vector<String> nameList() const;
+
+private:
+    CSSLayerStatementRule(StyleRuleLayer&, CSSStyleSheet*);
+    CSSRule::Type type() const final { return LAYER_STATEMENT_RULE; }
+    void reattach(StyleRuleBase&) final;
+
+    Ref<StyleRuleLayer> m_layerRule;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSLayerStatementRule, CSSRule::LAYER_STATEMENT_RULE)

Copied: trunk/Source/WebCore/css/CSSLayerStatementRule.idl (from rev 286656, trunk/Source/WebCore/css/CSSLayerRule.idl) (0 => 286657)


--- trunk/Source/WebCore/css/CSSLayerStatementRule.idl	                        (rev 0)
+++ trunk/Source/WebCore/css/CSSLayerStatementRule.idl	2021-12-08 16:55:05 UTC (rev 286657)
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+
+typedef USVString CSSOMString;
+
+[
+    Exposed=Window
+] interface CSSLayerStatementRule : CSSRule {
+    readonly attribute FrozenArray<CSSOMString> nameList;
+};

Modified: trunk/Source/WebCore/css/CSSRule.h (286656 => 286657)


--- trunk/Source/WebCore/css/CSSRule.h	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/css/CSSRule.h	2021-12-08 16:55:05 UTC (rev 286657)
@@ -51,7 +51,8 @@
         NAMESPACE_RULE = 10,
         COUNTER_STYLE_RULE = 11,
         SUPPORTS_RULE = 12,
-        LAYER_RULE = 16,
+        LAYER_BLOCK_RULE = 16,
+        LAYER_STATEMENT_RULE = 17,
         FONT_PALETTE_VALUES_RULE = 19,
     };
 

Modified: trunk/Source/WebCore/css/StyleRule.cpp (286656 => 286657)


--- trunk/Source/WebCore/css/StyleRule.cpp	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/css/StyleRule.cpp	2021-12-08 16:55:05 UTC (rev 286657)
@@ -29,7 +29,8 @@
 #include "CSSImportRule.h"
 #include "CSSKeyframeRule.h"
 #include "CSSKeyframesRule.h"
-#include "CSSLayerRule.h"
+#include "CSSLayerBlockRule.h"
+#include "CSSLayerStatementRule.h"
 #include "CSSMediaRule.h"
 #include "CSSNamespaceRule.h"
 #include "CSSPageRule.h"
@@ -99,7 +100,8 @@
     case StyleRuleType::CounterStyle:
         delete downcast<StyleRuleCounterStyle>(this);
         return;
-    case StyleRuleType::Layer:
+    case StyleRuleType::LayerBlock:
+    case StyleRuleType::LayerStatement:
         delete downcast<StyleRuleLayer>(this);
         return;
     case StyleRuleType::Unknown:
@@ -128,7 +130,8 @@
         return downcast<StyleRuleKeyframes>(*this).copy();
     case StyleRuleType::CounterStyle:
         return downcast<StyleRuleCounterStyle>(*this).copy();
-    case StyleRuleType::Layer:
+    case StyleRuleType::LayerBlock:
+    case StyleRuleType::LayerStatement:
         return downcast<StyleRuleLayer>(*this).copy();
     case StyleRuleType::Import:
     case StyleRuleType::Namespace:
@@ -177,9 +180,12 @@
     case StyleRuleType::CounterStyle:
         rule = CSSCounterStyleRule::create(downcast<StyleRuleCounterStyle>(self), parentSheet);
         break;
-    case StyleRuleType::Layer:
-        rule = CSSLayerRule::create(downcast<StyleRuleLayer>(self), parentSheet);
+    case StyleRuleType::LayerBlock:
+        rule = CSSLayerBlockRule::create(downcast<StyleRuleLayer>(self), parentSheet);
         break;
+    case StyleRuleType::LayerStatement:
+        rule = CSSLayerStatementRule::create(downcast<StyleRuleLayer>(self), parentSheet);
+        break;
     case StyleRuleType::Unknown:
     case StyleRuleType::Charset:
     case StyleRuleType::Keyframe:
@@ -479,19 +485,19 @@
 }
 
 StyleRuleLayer::StyleRuleLayer(Vector<CascadeLayerName>&& nameList)
-    : StyleRuleGroup(StyleRuleType::Layer, Vector<RefPtr<StyleRuleBase>> { })
+    : StyleRuleGroup(StyleRuleType::LayerStatement, Vector<RefPtr<StyleRuleBase>> { })
     , m_nameVariant(WTFMove(nameList))
 {
 }
 
 StyleRuleLayer::StyleRuleLayer(CascadeLayerName&& name, Vector<RefPtr<StyleRuleBase>>&& rules)
-    : StyleRuleGroup(StyleRuleType::Layer, WTFMove(rules))
+    : StyleRuleGroup(StyleRuleType::LayerBlock, WTFMove(rules))
     , m_nameVariant(WTFMove(name))
 {
 }
 
 StyleRuleLayer::StyleRuleLayer(CascadeLayerName&& name, std::unique_ptr<DeferredStyleGroupRuleList>&& rules)
-    : StyleRuleGroup(StyleRuleType::Layer, WTFMove(rules))
+    : StyleRuleGroup(StyleRuleType::LayerBlock, WTFMove(rules))
     , m_nameVariant(WTFMove(name))
 {
 }

Modified: trunk/Source/WebCore/css/StyleRule.h (286656 => 286657)


--- trunk/Source/WebCore/css/StyleRule.h	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/css/StyleRule.h	2021-12-08 16:55:05 UTC (rev 286657)
@@ -60,10 +60,10 @@
     bool isMediaRule() const { return type() == StyleRuleType::Media; }
     bool isPageRule() const { return type() == StyleRuleType::Page; }
     bool isStyleRule() const { return type() == StyleRuleType::Style; }
-    bool isGroupRule() const { return type() == StyleRuleType::Media || type() == StyleRuleType::Supports || type() == StyleRuleType::Layer; }
+    bool isGroupRule() const { return type() == StyleRuleType::Media || type() == StyleRuleType::Supports || type() == StyleRuleType::LayerBlock; }
     bool isSupportsRule() const { return type() == StyleRuleType::Supports; }
     bool isImportRule() const { return type() == StyleRuleType::Import; }
-    bool isLayerRule() const { return type() == StyleRuleType::Layer; }
+    bool isLayerRule() const { return type() == StyleRuleType::LayerBlock || type() == StyleRuleType::LayerStatement; }
 
     Ref<StyleRuleBase> copy() const;
 
@@ -298,7 +298,7 @@
     static Ref<StyleRuleLayer> createBlock(CascadeLayerName&&, std::unique_ptr<DeferredStyleGroupRuleList>&&);
     Ref<StyleRuleLayer> copy() const { return adoptRef(*new StyleRuleLayer(*this)); }
 
-    bool isStatement() const { return std::holds_alternative<Vector<CascadeLayerName>>(m_nameVariant); }
+    bool isStatement() const { return type() == StyleRuleType::LayerStatement; }
 
     auto& name() const { return std::get<CascadeLayerName>(m_nameVariant); }
     auto& nameList() const { return std::get<Vector<CascadeLayerName>>(m_nameVariant); }

Modified: trunk/Source/WebCore/css/StyleRuleType.h (286656 => 286657)


--- trunk/Source/WebCore/css/StyleRuleType.h	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/css/StyleRuleType.h	2021-12-08 16:55:05 UTC (rev 286657)
@@ -40,7 +40,8 @@
     Namespace = 10,
     CounterStyle = 11,
     Supports = 12,
-    Layer = 16,
+    LayerBlock = 16,
+    LayerStatement = 17,
     FontPaletteValues = 19,
 };
 

Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (286656 => 286657)


--- trunk/Source/WebCore/css/StyleSheetContents.cpp	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/css/StyleSheetContents.cpp	2021-12-08 16:55:05 UTC (rev 286657)
@@ -458,7 +458,7 @@
         switch (rule->type()) {
         case StyleRuleType::Media:
         case StyleRuleType::Supports:
-        case StyleRuleType::Layer: {
+        case StyleRuleType::LayerBlock: {
             auto* childRules = downcast<StyleRuleGroup>(*rule).childRulesWithoutDeferredParsing();
             if (childRules && traverseRulesInVector(*childRules, handler))
                 return true;
@@ -477,6 +477,7 @@
         case StyleRuleType::Charset:
         case StyleRuleType::CounterStyle:
         case StyleRuleType::Keyframe:
+        case StyleRuleType::LayerStatement:
             break;
         }
     }
@@ -519,7 +520,8 @@
         case StyleRuleType::Charset:
         case StyleRuleType::Keyframe:
         case StyleRuleType::Supports:
-        case StyleRuleType::Layer:
+        case StyleRuleType::LayerBlock:
+        case StyleRuleType::LayerStatement:
         case StyleRuleType::FontPaletteValues:
             return false;
         };

Modified: trunk/Source/WebCore/css/parser/CSSParserImpl.cpp (286656 => 286657)


--- trunk/Source/WebCore/css/parser/CSSParserImpl.cpp	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/css/parser/CSSParserImpl.cpp	2021-12-08 16:55:05 UTC (rev 286657)
@@ -811,7 +811,7 @@
 
         if (m_observerWrapper) {
             unsigned endOffset = m_observerWrapper->endOffset(preludeCopy);
-            m_observerWrapper->observer().startRuleHeader(StyleRuleType::Layer, m_observerWrapper->startOffset(preludeCopy));
+            m_observerWrapper->observer().startRuleHeader(StyleRuleType::LayerStatement, m_observerWrapper->startOffset(preludeCopy));
             m_observerWrapper->observer().endRuleHeader(endOffset);
             m_observerWrapper->observer().startRuleBody(endOffset);
             m_observerWrapper->observer().endRuleBody(endOffset);
@@ -832,7 +832,7 @@
         return StyleRuleLayer::createBlock(WTFMove(*name), makeUnique<DeferredStyleGroupRuleList>(*block, *m_deferredParser));
 
     if (m_observerWrapper) {
-        m_observerWrapper->observer().startRuleHeader(StyleRuleType::Layer, m_observerWrapper->startOffset(preludeCopy));
+        m_observerWrapper->observer().startRuleHeader(StyleRuleType::LayerBlock, m_observerWrapper->startOffset(preludeCopy));
         m_observerWrapper->observer().endRuleHeader(m_observerWrapper->endOffset(preludeCopy));
         m_observerWrapper->observer().startRuleBody(m_observerWrapper->previousTokenStartOffset(*block));
     }

Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (286656 => 286657)


--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2021-12-08 16:55:05 UTC (rev 286657)
@@ -28,7 +28,8 @@
 
 #include "CSSImportRule.h"
 #include "CSSKeyframesRule.h"
-#include "CSSLayerRule.h"
+#include "CSSLayerBlockRule.h"
+#include "CSSLayerStatementRule.h"
 #include "CSSMediaRule.h"
 #include "CSSParser.h"
 #include "CSSParserObserver.h"
@@ -107,7 +108,7 @@
     for (auto& data : dataList) {
         if (data->type == WebCore::StyleRuleType::Style)
             target.append(data.copyRef());
-        else if (data->type == WebCore::StyleRuleType::Media || data->type == WebCore::StyleRuleType::Supports || data->type == WebCore::StyleRuleType::Layer)
+        else if (data->type == WebCore::StyleRuleType::Media || data->type == WebCore::StyleRuleType::Supports || data->type == WebCore::StyleRuleType::LayerBlock)
             flattenSourceData(data->childRules, target);
     }
 }
@@ -426,8 +427,8 @@
     if (is<CSSSupportsRule>(*rule))
         return &downcast<CSSSupportsRule>(*rule).cssRules();
 
-    if (is<CSSLayerRule>(*rule))
-        return &downcast<CSSLayerRule>(*rule).cssRules();
+    if (is<CSSLayerBlockRule>(*rule))
+        return &downcast<CSSLayerBlockRule>(*rule).cssRules();
 
     return nullptr;
 }
@@ -450,11 +451,12 @@
                 ruleGroupingPayloads.append(WTFMove(mediaRulePayload));
             }
         } else if (is<CSSImportRule>(parentRule)) {
-            if (auto& layerName = downcast<CSSImportRule>(parentRule)->cascadeLayerName()) {
+            auto layerName = downcast<CSSImportRule>(parentRule)->layerName();
+            if (!layerName.isNull()) {
                 auto layerRulePayload = Protocol::CSS::Grouping::create()
                     .setType(Protocol::CSS::Grouping::Type::LayerImportRule)
                     .release();
-                layerRulePayload->setText(CSSLayerRule::stringFromCascadeLayerName(*layerName));
+                layerRulePayload->setText(layerName);
                 ruleGroupingPayloads.append(WTFMove(layerRulePayload));
             }
 
@@ -472,12 +474,11 @@
                 .release();
             supportsRulePayload->setText(downcast<CSSSupportsRule>(parentRule)->conditionText());
             ruleGroupingPayloads.append(WTFMove(supportsRulePayload));
-        } else if (is<CSSLayerRule>(parentRule)) {
+        } else if (is<CSSLayerBlockRule>(parentRule)) {
             auto layerRulePayload = Protocol::CSS::Grouping::create()
                 .setType(Protocol::CSS::Grouping::Type::LayerRule)
                 .release();
-            if (auto layerName = downcast<CSSLayerRule>(parentRule)->layerName())
-                layerRulePayload->setText(*layerName);
+            layerRulePayload->setText(downcast<CSSLayerBlockRule>(parentRule)->name());
             ruleGroupingPayloads.append(WTFMove(layerRulePayload));
         }
 

Modified: trunk/Source/WebCore/style/InspectorCSSOMWrappers.cpp (286656 => 286657)


--- trunk/Source/WebCore/style/InspectorCSSOMWrappers.cpp	2021-12-08 16:27:03 UTC (rev 286656)
+++ trunk/Source/WebCore/style/InspectorCSSOMWrappers.cpp	2021-12-08 16:55:05 UTC (rev 286657)
@@ -30,7 +30,8 @@
 #include "InspectorCSSOMWrappers.h"
 
 #include "CSSImportRule.h"
-#include "CSSLayerRule.h"
+#include "CSSLayerBlockRule.h"
+#include "CSSLayerStatementRule.h"
 #include "CSSMediaRule.h"
 #include "CSSRule.h"
 #include "CSSStyleRule.h"
@@ -62,8 +63,8 @@
         case CSSRule::IMPORT_RULE:
             collect(downcast<CSSImportRule>(*cssRule).styleSheet());
             break;
-        case CSSRule::LAYER_RULE:
-            collect(downcast<CSSLayerRule>(cssRule));
+        case CSSRule::LAYER_BLOCK_RULE:
+            collect(downcast<CSSLayerBlockRule>(cssRule));
             break;
         case CSSRule::MEDIA_RULE:
             collect(downcast<CSSMediaRule>(cssRule));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to