Title: [288576] trunk
Revision
288576
Author
an...@apple.com
Date
2022-01-25 12:36:51 -0800 (Tue, 25 Jan 2022)

Log Message

[CSS Container Queries] Parsing support for container shorthand property
https://bugs.webkit.org/show_bug.cgi?id=235582

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-contain/container-queries/container-computed-expected.txt:

Source/WebCore:

https://drafts.csswg.org/css-contain-3/#container-shorthand

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/CSSProperties.json:
* css/parser/CSSPropertyParser.cpp:
(WebCore::CSSPropertyParser::consumeContainerShorthand):
(WebCore::CSSPropertyParser::parseShorthand):
* css/parser/CSSPropertyParser.h:

Modified Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (288575 => 288576)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-01-25 20:32:40 UTC (rev 288575)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-01-25 20:36:51 UTC (rev 288576)
@@ -1,3 +1,12 @@
+2022-01-25  Antti Koivisto  <an...@apple.com>
+
+        [CSS Container Queries] Parsing support for container shorthand property
+        https://bugs.webkit.org/show_bug.cgi?id=235582
+
+        Reviewed by Darin Adler.
+
+        * web-platform-tests/css/css-contain/container-queries/container-computed-expected.txt:
+
 2022-01-25  Yusuke Suzuki  <ysuz...@apple.com>
 
         [JSC] Wasm module import should be done in sync when WebAssembly.instantiate gets module

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-computed-expected.txt (288575 => 288576)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-computed-expected.txt	2022-01-25 20:32:40 UTC (rev 288575)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-computed-expected.txt	2022-01-25 20:36:51 UTC (rev 288576)
@@ -1,16 +1,16 @@
 
-FAIL Property container value 'initial' assert_true: container doesn't seem to be supported in the computed style expected true got false
-FAIL Property container value 'inherit' assert_true: container doesn't seem to be supported in the computed style expected true got false
-FAIL Property container value 'unset' assert_true: container doesn't seem to be supported in the computed style expected true got false
-FAIL Property container value 'inline-size' assert_true: container doesn't seem to be supported in the computed style expected true got false
-FAIL Property container value 'size' assert_true: container doesn't seem to be supported in the computed style expected true got false
-FAIL Property container value 'inline-size / inline-size' assert_true: container doesn't seem to be supported in the computed style expected true got false
-FAIL Property container value 'size / block-size' assert_true: container doesn't seem to be supported in the computed style expected true got false
-FAIL Property container value 'size style / name' assert_true: container doesn't seem to be supported in the computed style expected true got false
-FAIL Property container value 'inline-size state style/ name' assert_true: container doesn't seem to be supported in the computed style expected true got false
-FAIL Property container value 'inline-size / foo' assert_true: container doesn't seem to be supported in the computed style expected true got false
-FAIL Property container value 'inline-size /foo' assert_true: container doesn't seem to be supported in the computed style expected true got false
-FAIL Property container value 'inline-size/ foo' assert_true: container doesn't seem to be supported in the computed style expected true got false
-FAIL Property container value 'inline-size/foo' assert_true: container doesn't seem to be supported in the computed style expected true got false
-FAIL Property container value 'size / FoO' assert_true: container doesn't seem to be supported in the computed style expected true got false
+PASS Property container value 'initial'
+PASS Property container value 'inherit'
+PASS Property container value 'unset'
+PASS Property container value 'inline-size'
+PASS Property container value 'size'
+PASS Property container value 'inline-size / inline-size'
+PASS Property container value 'size / block-size'
+FAIL Property container value 'size style / name' assert_true: 'size style / name' is a supported value for container. expected true got false
+FAIL Property container value 'inline-size state style/ name' assert_true: 'inline-size state style/ name' is a supported value for container. expected true got false
+PASS Property container value 'inline-size / foo'
+PASS Property container value 'inline-size /foo'
+PASS Property container value 'inline-size/ foo'
+PASS Property container value 'inline-size/foo'
+PASS Property container value 'size / FoO'
 

Modified: trunk/Source/WebCore/ChangeLog (288575 => 288576)


--- trunk/Source/WebCore/ChangeLog	2022-01-25 20:32:40 UTC (rev 288575)
+++ trunk/Source/WebCore/ChangeLog	2022-01-25 20:36:51 UTC (rev 288576)
@@ -1,3 +1,20 @@
+2022-01-25  Antti Koivisto  <an...@apple.com>
+
+        [CSS Container Queries] Parsing support for container shorthand property
+        https://bugs.webkit.org/show_bug.cgi?id=235582
+
+        Reviewed by Darin Adler.
+
+        https://drafts.csswg.org/css-contain-3/#container-shorthand
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
+        * css/CSSProperties.json:
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::CSSPropertyParser::consumeContainerShorthand):
+        (WebCore::CSSPropertyParser::parseShorthand):
+        * css/parser/CSSPropertyParser.h:
+
 2022-01-25  Antoine Quint  <grao...@webkit.org>
 
         Deduplication for @keyframes rules should account for animation-composition

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (288575 => 288576)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2022-01-25 20:32:40 UTC (rev 288575)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2022-01-25 20:36:51 UTC (rev 288576)
@@ -3625,6 +3625,13 @@
                 list->append(cssValuePool.createIdentifierValue(CSSValuePaint));
             return list;
         }
+        case CSSPropertyContainer: {
+            auto list = CSSValueList::createSlashSeparated();
+            list->append(propertyValue(CSSPropertyContainerType, DoNotUpdateLayout).releaseNonNull());
+            if (!style.containerNames().isEmpty())
+                list->append(propertyValue(CSSPropertyContainerName, DoNotUpdateLayout).releaseNonNull());
+            return list;
+        }
         case CSSPropertyContainerType:
             return CSSPrimitiveValue::create(style.containerType());
         case CSSPropertyContainerName: {

Modified: trunk/Source/WebCore/css/CSSProperties.json (288575 => 288576)


--- trunk/Source/WebCore/css/CSSProperties.json	2022-01-25 20:32:40 UTC (rev 288575)
+++ trunk/Source/WebCore/css/CSSProperties.json	2022-01-25 20:36:51 UTC (rev 288576)
@@ -5221,6 +5221,21 @@
                 "url": "https://drafts.csswg.org/css-contain-1/"
             }
         },
+        "container": {
+            "codegen-properties": {
+                "longhands": [
+                    "container-type",
+                    "container-name"
+                ]
+            },
+            "status": {
+                "status": "experimental"
+            },
+            "specification": {
+                "category": "css-contain",
+                "url": "https://drafts.csswg.org/css-contain-3/#container-queries"
+            }
+        },
         "container-name": {
             "codegen-properties": {
                 "settings-flag": "cssContainerQueriesEnabled",

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (288575 => 288576)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2022-01-25 20:32:40 UTC (rev 288575)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2022-01-25 20:36:51 UTC (rev 288576)
@@ -6151,6 +6151,33 @@
     return true;
 }
 
+bool CSSPropertyParser::consumeContainerShorthand(bool important)
+{
+    auto type = parseSingleValue(CSSPropertyContainerType);
+    if (!type)
+        return false;
+
+    bool sawSlash = false;
+
+    auto consumeSlashName = [&]() -> RefPtr<CSSValue> {
+        if (m_range.atEnd())
+            return nullptr;
+        if (!consumeSlashIncludingWhitespace(m_range))
+            return nullptr;
+        sawSlash = true;
+        return parseSingleValue(CSSPropertyContainerName);
+    };
+
+    auto name = consumeSlashName();
+
+    if (!m_range.atEnd() || (sawSlash && !name))
+        return false;
+
+    addProperty(CSSPropertyContainerType, CSSPropertyContainer, type.releaseNonNull(), important);
+    addPropertyWithImplicitDefault(CSSPropertyContainerName, CSSPropertyContainer, WTFMove(name), CSSValuePool::singleton().createImplicitInitialValue(), important);
+    return true;
+}
+
 bool CSSPropertyParser::parseShorthand(CSSPropertyID property, bool important)
 {
     switch (property) {
@@ -6384,6 +6411,8 @@
         return consumePlaceSelfShorthand(important);
     case CSSPropertyTextDecorationSkip:
         return consumeTextDecorationSkip(important);
+    case CSSPropertyContainer:
+        return consumeContainerShorthand(important);
     default:
         return false;
     }

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.h (288575 => 288576)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.h	2022-01-25 20:32:40 UTC (rev 288575)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.h	2022-01-25 20:36:51 UTC (rev 288576)
@@ -123,6 +123,8 @@
 
     bool consumeOverscrollBehaviorShorthand(bool important);
 
+    bool consumeContainerShorthand(bool important);
+
 private:
     // Inputs:
     CSSParserTokenRange m_range;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to