Title: [292759] trunk
Revision
292759
Author
an...@apple.com
Date
2022-04-11 20:43:50 -0700 (Mon, 11 Apr 2022)

Log Message

[CSS Container Queries] Update container shorthand order
https://bugs.webkit.org/show_bug.cgi?id=239065

Reviewed by Alan Bujtas.

LayoutTests/imported/w3c:

Update from WPT repo.

* resources/resource-files.json:
* web-platform-tests/css/css-contain/container-queries/at-container-parsing-expected.txt:
* web-platform-tests/css/css-contain/container-queries/at-container-parsing.html:
* web-platform-tests/css/css-contain/container-queries/container-computed-expected.txt:
* web-platform-tests/css/css-contain/container-queries/container-computed.html:
* web-platform-tests/css/css-contain/container-queries/container-name-parsing-expected.txt:
* web-platform-tests/css/css-contain/container-queries/container-name-parsing.html:
* web-platform-tests/css/css-contain/container-queries/container-parsing-expected.txt:
* web-platform-tests/css/css-contain/container-queries/container-parsing.html:
* web-platform-tests/css/css-contain/container-queries/container-selection.html:
* web-platform-tests/css/css-contain/container-queries/container-type-parsing.html:
* web-platform-tests/css/css-contain/container-queries/crashtests/canvas-as-container-crash.html:
* web-platform-tests/css/css-contain/container-queries/crashtests/chrome-bug-1289718-000-crash.html:
* web-platform-tests/css/css-contain/container-queries/crashtests/chrome-bug-1289718-001-crash.html:
* web-platform-tests/css/css-contain/container-queries/crashtests/chrome-quotes-crash.html: Added.
* web-platform-tests/css/css-contain/container-queries/crashtests/force-sibling-style-crash.html: Added.
* web-platform-tests/css/css-contain/container-queries/crashtests/w3c-import.log:

Source/WebCore:

The format is now 'name / type' instead of 'type / name'.

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

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
* css/StyleProperties.cpp:
(WebCore::isNoneValue):
(WebCore::isValueID):
(WebCore::StyleProperties::getPropertyValue const):

Also make "foo / none" serialize as "foo".

* css/parser/CSSParserFastPaths.cpp:
(WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
* css/parser/CSSPropertyParser.cpp:
(WebCore::consumeContainerName):
(WebCore::CSSPropertyParser::consumeContainerShorthand):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (292758 => 292759)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2022-04-12 03:43:50 UTC (rev 292759)
@@ -1,3 +1,30 @@
+2022-04-11  Antti Koivisto  <an...@apple.com>
+
+        [CSS Container Queries] Update container shorthand order
+        https://bugs.webkit.org/show_bug.cgi?id=239065
+
+        Reviewed by Alan Bujtas.
+
+        Update from WPT repo.
+
+        * resources/resource-files.json:
+        * web-platform-tests/css/css-contain/container-queries/at-container-parsing-expected.txt:
+        * web-platform-tests/css/css-contain/container-queries/at-container-parsing.html:
+        * web-platform-tests/css/css-contain/container-queries/container-computed-expected.txt:
+        * web-platform-tests/css/css-contain/container-queries/container-computed.html:
+        * web-platform-tests/css/css-contain/container-queries/container-name-parsing-expected.txt:
+        * web-platform-tests/css/css-contain/container-queries/container-name-parsing.html:
+        * web-platform-tests/css/css-contain/container-queries/container-parsing-expected.txt:
+        * web-platform-tests/css/css-contain/container-queries/container-parsing.html:
+        * web-platform-tests/css/css-contain/container-queries/container-selection.html:
+        * web-platform-tests/css/css-contain/container-queries/container-type-parsing.html:
+        * web-platform-tests/css/css-contain/container-queries/crashtests/canvas-as-container-crash.html:
+        * web-platform-tests/css/css-contain/container-queries/crashtests/chrome-bug-1289718-000-crash.html:
+        * web-platform-tests/css/css-contain/container-queries/crashtests/chrome-bug-1289718-001-crash.html:
+        * web-platform-tests/css/css-contain/container-queries/crashtests/chrome-quotes-crash.html: Added.
+        * web-platform-tests/css/css-contain/container-queries/crashtests/force-sibling-style-crash.html: Added.
+        * web-platform-tests/css/css-contain/container-queries/crashtests/w3c-import.log:
+
 2022-04-11  Nikolaos Mouchtaris  <nmouchta...@apple.com>
 
         calc(): Propogate nan for min, max, clamp, and hypot

Modified: trunk/LayoutTests/imported/w3c/resources/resource-files.json (292758 => 292759)


--- trunk/LayoutTests/imported/w3c/resources/resource-files.json	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/LayoutTests/imported/w3c/resources/resource-files.json	2022-04-12 03:43:50 UTC (rev 292759)
@@ -663,6 +663,7 @@
         "web-platform-tests/css/css-contain/container-queries/crashtests/canvas-as-container-crash.html",
         "web-platform-tests/css/css-contain/container-queries/crashtests/chrome-bug-1289718-000-crash.html",
         "web-platform-tests/css/css-contain/container-queries/crashtests/chrome-bug-1289718-001-crash.html",
+        "web-platform-tests/css/css-contain/container-queries/crashtests/chrome-quotes-crash.html",
         "web-platform-tests/css/css-contain/container-queries/crashtests/columns-in-table-001-crash.html",
         "web-platform-tests/css/css-contain/container-queries/crashtests/container-type-change-chrome-legacy-crash.html",
         "web-platform-tests/css/css-contain/container-queries/crashtests/flex-in-columns-000-crash.html",
@@ -670,6 +671,7 @@
         "web-platform-tests/css/css-contain/container-queries/crashtests/flex-in-columns-002-crash.html",
         "web-platform-tests/css/css-contain/container-queries/crashtests/flex-in-columns-003-crash.html",
         "web-platform-tests/css/css-contain/container-queries/crashtests/focus-inside-content-visibility-crash.html",
+        "web-platform-tests/css/css-contain/container-queries/crashtests/force-sibling-style-crash.html",
         "web-platform-tests/css/css-contain/container-queries/crashtests/grid-in-columns-000-crash.html",
         "web-platform-tests/css/css-contain/container-queries/crashtests/grid-in-columns-001-crash.html",
         "web-platform-tests/css/css-contain/container-queries/crashtests/grid-in-columns-002-crash.html",

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-parsing-expected.txt (292758 => 292759)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-parsing-expected.txt	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-parsing-expected.txt	2022-04-12 03:43:50 UTC (rev 292759)
@@ -19,10 +19,27 @@
 PASS ((width: 100px))
 PASS (not (width: 100px))
 PASS ((width: 100px) and (height: 100px))
-PASS ((width: 50px) or (height: 100px))
+PASS (((width: 40px) or (width: 50px)) and (height: 100px))
+PASS ((width: 100px) and ((height: 40px) or (height: 50px)))
+PASS (((width: 40x) and (height: 50px)) or (height: 100px))
+PASS ((width: 50px) or ((width: 40px) and (height: 50px)))
+PASS ((width: 100px) and (not (height: 100px)))
 PASS (width < 100px)
+PASS (width <= 100px)
+PASS (width = 100px)
+PASS (width > 100px)
+PASS (width >= 100px)
 PASS (100px < width)
+PASS (100px <= width)
+PASS (100px = width)
+PASS (100px > width)
+PASS (100px >= width)
 PASS (100px < width < 200px)
+PASS (100px < width <= 200px)
+PASS (100px <= width < 200px)
+PASS (100px > width > 200px)
+PASS (100px > width >= 200px)
+PASS (100px >= width > 200px)
 PASS foo(width)
 PASS size(width)
 PASS (asdf)
@@ -33,6 +50,14 @@
 PASS (color-index >= 1)
 PASS size(grid)
 PASS (grid)
+PASS (width == 100px)
+FAIL (100px == width) assert_equals: expected 2 but got 0
+FAIL (100px = width = 200px) assert_equals: expected "" but got "true"
+FAIL (100px < width > 200px) assert_equals: expected "" but got "true"
+FAIL (100px <= width >= 200px) assert_equals: expected "" but got "true"
+FAIL (100px <= width > 200px) assert_equals: expected "" but got "true"
+FAIL (100px < width >= 200px) assert_equals: expected "" but got "true"
+FAIL (100px : width : 200px) assert_equals: expected 2 but got 0
 PASS screen
 PASS print
 PASS not print
@@ -42,6 +67,10 @@
 PASS not screen and (width: 100px)
 PASS not screen or (width: 100px)
 PASS (width: 100px), (height: 100px)
+PASS (width: 100px) and (height: 100px)
+PASS (width: 100px) or (height: 100px)
+PASS not (width: 100px)
+PASS foo (width: 100px)
 PASS Container selector: foo
 PASS Container selector:  foo
 PASS Container selector:  foo

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-parsing.html (292758 => 292759)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-parsing.html	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-parsing.html	2022-04-12 03:43:50 UTC (rev 292759)
@@ -4,7 +4,7 @@
 <script src=""
 <script src=""
 <script src=""
-<div style="container:size; width:100px; height:100px">
+<div style="container-name:name;container-type:size; width:100px; height:100px">
   <main id=main></main>
 </div>
 <script>
@@ -25,7 +25,7 @@
   function test_query_invalid(query) {
     test(t => {
       t.add_cleanup(cleanup_main);
-      let style = set_style(`@container ${query} {}`);
+      let style = set_style(`@container name ${query} {}`);
       assert_equals(style.sheet.rules.length, 0);
     }, query);
   }
@@ -36,8 +36,8 @@
     test(t => {
       t.add_cleanup(cleanup_main);
       let style = set_style(`
-        @container ${query} {}
-        @container (${query} or (not ${query})) { main { --match:true; } }
+        @container name ${query} {}
+        @container name (${query} or (not ${query})) { main { --match:true; } }
       `);
       assert_equals(style.sheet.rules.length, 2);
       const expected = unknown ? '' : 'true';
@@ -90,10 +90,27 @@
   test_query_known('((width: 100px))');
   test_query_known('(not (width: 100px))');
   test_query_known('((width: 100px) and (height: 100px))');
-  test_query_known('((width: 50px) or (height: 100px))');
+  test_query_known('(((width: 40px) or (width: 50px)) and (height: 100px))');
+  test_query_known('((width: 100px) and ((height: 40px) or (height: 50px)))');
+  test_query_known('(((width: 40x) and (height: 50px)) or (height: 100px))');
+  test_query_known('((width: 50px) or ((width: 40px) and (height: 50px)))');
+  test_query_known('((width: 100px) and (not (height: 100px)))');
   test_query_known('(width < 100px)');
+  test_query_known('(width <= 100px)');
+  test_query_known('(width = 100px)');
+  test_query_known('(width > 100px)');
+  test_query_known('(width >= 100px)');
   test_query_known('(100px < width)');
+  test_query_known('(100px <= width)');
+  test_query_known('(100px = width)');
+  test_query_known('(100px > width)');
+  test_query_known('(100px >= width)');
   test_query_known('(100px < width < 200px)');
+  test_query_known('(100px < width <= 200px)');
+  test_query_known('(100px <= width < 200px)');
+  test_query_known('(100px > width > 200px)');
+  test_query_known('(100px > width >= 200px)');
+  test_query_known('(100px >= width > 200px)');
 
   test_query_unknown('foo(width)');
   test_query_unknown('size(width)');
@@ -105,6 +122,14 @@
   test_query_unknown('(color-index >= 1)');
   test_query_unknown('size(grid)');
   test_query_unknown('(grid)');
+  test_query_unknown('(width == 100px)');
+  test_query_unknown('(100px == width)');
+  test_query_unknown('(100px = width = 200px)');
+  test_query_unknown('(100px < width > 200px)');
+  test_query_unknown('(100px <= width >= 200px)');
+  test_query_unknown('(100px <= width > 200px)');
+  test_query_unknown('(100px < width >= 200px)');
+  test_query_unknown('(100px : width : 200px)');
 
   test_query_invalid('screen');
   test_query_invalid('print');
@@ -115,6 +140,10 @@
   test_query_invalid('not screen and (width: 100px)');
   test_query_invalid('not screen or (width: 100px)');
   test_query_invalid('(width: 100px), (height: 100px)');
+  test_query_invalid('(width: 100px) and (height: 100px)');
+  test_query_invalid('(width: 100px) or (height: 100px)');
+  test_query_invalid('not (width: 100px)');
+  test_query_invalid('foo (width: 100px)');
 
   test_container_selector_valid('foo');
   test_container_selector_valid(' foo');

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


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-computed-expected.txt	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-computed-expected.txt	2022-04-12 03:43:50 UTC (rev 292759)
@@ -2,16 +2,16 @@
 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 'none / inline-size'
+PASS Property container value 'none / 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 style/ name' assert_true: 'inline-size 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'
-PASS Property container value 'size / foo bar'
+PASS Property container value 'block-size / size'
+FAIL Property container value 'name / size style' assert_true: 'name / size style' is a supported value for container. expected true got false
+FAIL Property container value 'name /inline-size style' assert_true: 'name /inline-size style' is a supported value for container. expected true got false
+PASS Property container value 'foo / inline-size'
+PASS Property container value 'foo /inline-size'
+PASS Property container value 'foo/ inline-size'
+PASS Property container value 'foo/inline-size'
+PASS Property container value 'FoO / size'
+PASS Property container value 'foo bar / size'
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-computed.html (292758 => 292759)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-computed.html	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-computed.html	2022-04-12 03:43:50 UTC (rev 292759)
@@ -14,16 +14,16 @@
 test_computed_value('container', 'initial', 'none');
 test_computed_value('container', 'inherit', 'none');
 test_computed_value('container', 'unset', 'none');
-test_computed_value('container', 'inline-size');
-test_computed_value('container', 'size');
+test_computed_value('container', 'none / inline-size');
+test_computed_value('container', 'none / size');
 test_computed_value('container', 'inline-size / inline-size');
-test_computed_value('container', 'size / block-size');
-test_computed_value('container', 'size style / name', 'style size / name');
-test_computed_value('container', 'inline-size style/ name', 'style inline-size / name');
-test_computed_value('container', 'inline-size / foo');
-test_computed_value('container', 'inline-size /foo', 'inline-size / foo');
-test_computed_value('container', 'inline-size/ foo', 'inline-size / foo');
-test_computed_value('container', 'inline-size/foo', 'inline-size / foo');
-test_computed_value('container', 'size / FoO', 'size / FoO');
-test_computed_value('container', 'size / foo bar', 'size / foo bar');
+test_computed_value('container', 'block-size / size');
+test_computed_value('container', 'name / size style', 'name / style size');
+test_computed_value('container', 'name /inline-size style', 'name / style inline-size');
+test_computed_value('container', 'foo / inline-size');
+test_computed_value('container', 'foo /inline-size', 'foo / inline-size');
+test_computed_value('container', 'foo/ inline-size', 'foo / inline-size');
+test_computed_value('container', 'foo/inline-size', 'foo / inline-size');
+test_computed_value('container', 'FoO / size');
+test_computed_value('container', 'foo bar / size', 'foo bar / size');
 </script>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-name-parsing-expected.txt (292758 => 292759)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-name-parsing-expected.txt	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-name-parsing-expected.txt	2022-04-12 03:43:50 UTC (rev 292759)
@@ -9,6 +9,7 @@
 PASS e.style['container-name'] = "foo bar" should set the property value
 PASS e.style['container-name'] = "foo foo" should set the property value
 PASS e.style['container-name'] = "\\!escaped" should set the property value
+PASS e.style['container-name'] = "not" should set the property value
 PASS e.style['container-name'] = "none none" should not set the property value
 PASS e.style['container-name'] = "foo, bar" should not set the property value
 PASS e.style['container-name'] = "#fff" should not set the property value

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-name-parsing.html (292758 => 292759)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-name-parsing.html	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-name-parsing.html	2022-04-12 03:43:50 UTC (rev 292759)
@@ -20,6 +20,7 @@
 test_valid_value('container-name', 'foo bar');
 test_valid_value('container-name', 'foo foo');
 test_valid_value('container-name', '\\!escaped');
+test_valid_value('container-name', 'not');
 
 test_invalid_value('container-name', 'none none');
 test_invalid_value('container-name', 'foo, bar');

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-parsing-expected.txt (292758 => 292759)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-parsing-expected.txt	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-parsing-expected.txt	2022-04-12 03:43:50 UTC (rev 292759)
@@ -4,36 +4,41 @@
 PASS e.style['container'] = "unset" should set the property value
 PASS e.style['container'] = "revert" should set the property value
 PASS e.style['container'] = "none" should set the property value
-FAIL e.style['container'] = "none / none" should set the property value assert_equals: serialization should be canonical expected "none" but got "none / none"
+PASS e.style['container'] = "none / none" should set the property value
 PASS e.style['container'] = "inline-size" should set the property value
-FAIL e.style['container'] = "inline-size / none" should set the property value assert_equals: serialization should be canonical expected "inline-size" but got "inline-size / none"
+PASS e.style['container'] = "none / inline-size" should set the property value
 PASS e.style['container'] = "size" should set the property value
-PASS e.style['container'] = "size / block-size" should set the property value
+PASS e.style['container'] = "block-size / size" should set the property value
 PASS e.style['container'] = "inline-size / inline-size" should set the property value
 PASS e.style['container'] = "size / size" should set the property value
-FAIL e.style['container'] = "size style / none" should set the property value assert_not_equals: property should be set got disallowed value ""
-PASS e.style['container'] = "size / foo" should set the property value
-PASS e.style['container'] = "size / foo bar" should set the property value
+FAIL e.style['container'] = "none / size style" should set the property value assert_not_equals: property should be set got disallowed value ""
+PASS e.style['container'] = "foo" should set the property value
+PASS e.style['container'] = "foo / none" should set the property value
+PASS e.style['container'] = "foo bar / size" should set the property value
+PASS e.style['container'] = "foo bar / none" should set the property value
+PASS e.style['container'] = "FOO / size" should set the property value
+PASS e.style['container'] = "FOO/size" should set the property value
+PASS e.style['container'] = "  FOO  /size" should set the property value
 PASS e.style['container'] = "none none" should not set the property value
 PASS e.style['container'] = "none inline-size" should not set the property value
-PASS e.style['container'] = "inline-size none" should not set the property value
-PASS e.style['container'] = "inline-size inline-size" should not set the property value
-PASS e.style['container'] = "inline-size block-size unknown" should not set the property value
-PASS e.style['container'] = "inline-size block-size" should not set the property value
-PASS e.style['container'] = "size block-size" should not set the property value
+PASS e.style['container'] = "none / inline-size none" should not set the property value
+PASS e.style['container'] = "none / inline-size inline-size" should not set the property value
+PASS e.style['container'] = "none / inline-size block-size unknown" should not set the property value
+PASS e.style['container'] = "none / inline-size block-size" should not set the property value
+PASS e.style['container'] = "none / size block-size" should not set the property value
 PASS e.style['container'] = "none, none" should not set the property value
-PASS e.style['container'] = "foo" should not set the property value
-PASS e.style['container'] = "foo, bar" should not set the property value
+PASS e.style['container'] = "none / foo" should not set the property value
+PASS e.style['container'] = "none / foo, bar" should not set the property value
 PASS e.style['container'] = "#fff" should not set the property value
 PASS e.style['container'] = "1px" should not set the property value
 PASS e.style['container'] = "default" should not set the property value
-PASS e.style['container'] = "inline-size / 10px" should not set the property value
-PASS e.style['container'] = "inline-size / #fefefe" should not set the property value
-PASS e.style['container'] = "inline-size / calc(3px)" should not set the property value
+PASS e.style['container'] = "10px / inline-size" should not set the property value
+PASS e.style['container'] = "#fefefe / inline-size" should not set the property value
+PASS e.style['container'] = "calc(3px) / inline-size" should not set the property value
 PASS e.style['container'] = "size 1 / name" should not set the property value
-PASS e.style['container'] = "block-size" should not set the property value
-PASS e.style['container'] = "block-size / name" should not set the property value
-PASS e.style['container'] = "block-size /  NAME" should not set the property value
-PASS e.style['container'] = "block-size/NAME" should not set the property value
+PASS e.style['container'] = "none / block-size" should not set the property value
+PASS e.style['container'] = "name / block-size" should not set the property value
+PASS e.style['container'] = " NAME  / block-size" should not set the property value
+PASS e.style['container'] = "NAME/block-size" should not set the property value
 PASS e.style['container'] = "block-size / block-size" should not set the property value
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-parsing.html (292758 => 292759)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-parsing.html	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-parsing.html	2022-04-12 03:43:50 UTC (rev 292759)
@@ -18,35 +18,40 @@
 test_valid_value('container', 'none');
 test_valid_value('container', 'none / none', 'none');
 test_valid_value('container', 'inline-size');
-test_valid_value('container', 'inline-size / none', 'inline-size');
+test_valid_value('container', 'none / inline-size', 'none / inline-size');
 test_valid_value('container', 'size');
-test_valid_value('container', 'size / block-size');
+test_valid_value('container', 'block-size / size');
 test_valid_value('container', 'inline-size / inline-size');
 test_valid_value('container', 'size / size');
-test_valid_value('container', 'size style / none', 'size style');
-test_valid_value('container', 'size / foo');
-test_valid_value('container', 'size / foo bar');
+test_valid_value('container', 'none / size style', 'none / style size');
+test_valid_value('container', 'foo');
+test_valid_value('container', 'foo / none', 'foo');
+test_valid_value('container', 'foo bar / size');
+test_valid_value('container', 'foo bar / none', 'foo bar');
+test_valid_value('container', 'FOO / size');
+test_valid_value('container', 'FOO/size', 'FOO / size');
+test_valid_value('container', '  FOO  /size', 'FOO / size');
 
 test_invalid_value('container', 'none none');
 test_invalid_value('container', 'none inline-size');
-test_invalid_value('container', 'inline-size none');
-test_invalid_value('container', 'inline-size inline-size');
-test_invalid_value('container', 'inline-size block-size unknown');
-test_invalid_value('container', 'inline-size block-size');
-test_invalid_value('container', 'size block-size');
+test_invalid_value('container', 'none / inline-size none');
+test_invalid_value('container', 'none / inline-size inline-size');
+test_invalid_value('container', 'none / inline-size block-size unknown');
+test_invalid_value('container', 'none / inline-size block-size');
+test_invalid_value('container', 'none / size block-size');
 test_invalid_value('container', 'none, none');
-test_invalid_value('container', 'foo');
-test_invalid_value('container', 'foo, bar');
+test_invalid_value('container', 'none / foo');
+test_invalid_value('container', 'none / foo, bar');
 test_invalid_value('container', '#fff');
 test_invalid_value('container', '1px');
 test_invalid_value('container', 'default');
-test_invalid_value('container', 'inline-size / 10px');
-test_invalid_value('container', 'inline-size / #fefefe');
-test_invalid_value('container', 'inline-size / calc(3px)');
+test_invalid_value('container', '10px / inline-size');
+test_invalid_value('container', '#fefefe / inline-size');
+test_invalid_value('container', 'calc(3px) / inline-size');
 test_invalid_value('container', 'size 1 / name');
-test_invalid_value('container', 'block-size');
-test_invalid_value('container', 'block-size / name');
-test_invalid_value('container', 'block-size /  NAME', 'block-size / NAME');
-test_invalid_value('container', 'block-size/NAME','block-size / NAME');
+test_invalid_value('container', 'none / block-size');
+test_invalid_value('container', 'name / block-size');
+test_invalid_value('container', ' NAME  / block-size', 'NAME / block-size');
+test_invalid_value('container', 'NAME/block-size','NAME / block-size');
 test_invalid_value('container', 'block-size / block-size');
 </script>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-selection.html (292758 => 292759)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-selection.html	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-selection.html	2022-04-12 03:43:50 UTC (rev 292759)
@@ -24,13 +24,13 @@
   .inline { container-type: inline-size; }
   .size { container-type: size; }
 
-  .a-inline { container:  inline-size / a; }
-  .a-size { container:  size / a; }
+  .a-inline { container: a / inline-size; }
+  .a-size { container: a / size; }
 
-  .b-size { container:  inline-size / b; }
-  .b-size { container:  size / b; }
+  .b-size { container: inline- b / size; }
+  .b-size { container: b / size; }
 
-  .ab-size { container: size / a b; }
+  .ab-size { container: a b / size; }
 
   .a { container-name: a; contain: strict; }
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-parsing.html (292758 => 292759)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-parsing.html	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-parsing.html	2022-04-12 03:43:50 UTC (rev 292759)
@@ -19,7 +19,7 @@
 test_valid_value('container-type', 'size');
 test_valid_value('container-type', 'inline-size');
 
-test_valid_value('container-type', 'inline-size style');
+test_valid_value('container-type', 'inline-size style', 'style inline-size');
 test_valid_value('container-type', 'style inline-size');
 test_valid_value('container-type', 'style size');
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/canvas-as-container-crash.html (292758 => 292759)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/canvas-as-container-crash.html	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/canvas-as-container-crash.html	2022-04-12 03:43:50 UTC (rev 292759)
@@ -3,7 +3,7 @@
 <link rel="help" href=""
 <link rel="help" href=""
 <p>Pass if there is no crash.</p>
-<canvas id="canv" style="display:block;position:absolute;container:inline-size"></canvas>
+<canvas id="canv" style="display:block;position:absolute;container-type:inline-size"></canvas>
 <script>
   canv.offsetTop;
   canv.appendChild(document.createElement("span"));

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/chrome-bug-1289718-000-crash.html (292758 => 292759)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/chrome-bug-1289718-000-crash.html	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/chrome-bug-1289718-000-crash.html	2022-04-12 03:43:50 UTC (rev 292759)
@@ -1,6 +1,6 @@
 <!DOCTYPE html>
 <link rel="author" title="Morten Stenshorne" href=""
 <link rel="help" href=""
-<div style="container:inline-size;">
+<div style="container-type:inline-size;">
   <span style="columns:2;"></span>
 </div>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/chrome-bug-1289718-001-crash.html (292758 => 292759)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/chrome-bug-1289718-001-crash.html	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/chrome-bug-1289718-001-crash.html	2022-04-12 03:43:50 UTC (rev 292759)
@@ -1,6 +1,6 @@
 <!DOCTYPE html>
 <link rel="author" title="Morten Stenshorne" href=""
 <link rel="help" href=""
-<div style="container:inline-size;">
+<div style="container-type:inline-size;">
   <video style="columns:2;"></video>
 </div>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/chrome-quotes-crash.html (0 => 292759)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/chrome-quotes-crash.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/chrome-quotes-crash.html	2022-04-12 03:43:50 UTC (rev 292759)
@@ -0,0 +1,11 @@
+<!doctype html>
+<title>Container Queries Test: Quotes update outside container being laid out causes crash</title>
+<link rel="help" href=""
+<style>
+  div { container-type: size }
+</style>
+<div style="float: right">
+  <span></span>
+  <div style="position:absolute"><q></q></div>
+  <q></q>
+</div>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/force-sibling-style-crash.html (0 => 292759)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/force-sibling-style-crash.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/force-sibling-style-crash.html	2022-04-12 03:43:50 UTC (rev 292759)
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<title>getComputedStyle on sibling of style-dirty container</title>
+<link rel="help" href=""
+<link rel="help" href=""
+<div id=ancestor style="--x:foo">
+  <div id=container style="container-type:size;width:100px;">
+    <span>Test</span>
+  </div>
+  <div id=target></div>
+</div>
+<script>
+  ancestor.offsetTop;
+  ancestor.style.setProperty('--x', 'bar');
+  container.style.width = '200px';
+  getComputedStyle(target).getPropertyValue('--x');
+</script>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/w3c-import.log (292758 => 292759)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/w3c-import.log	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/w3c-import.log	2022-04-12 03:43:50 UTC (rev 292759)
@@ -17,6 +17,7 @@
 /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/canvas-as-container-crash.html
 /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/chrome-bug-1289718-000-crash.html
 /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/chrome-bug-1289718-001-crash.html
+/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/chrome-quotes-crash.html
 /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/columns-in-table-001-crash.html
 /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/container-type-change-chrome-legacy-crash.html
 /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/flex-in-columns-000-crash.html
@@ -24,6 +25,7 @@
 /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/flex-in-columns-002-crash.html
 /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/flex-in-columns-003-crash.html
 /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/focus-inside-content-visibility-crash.html
+/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/force-sibling-style-crash.html
 /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/grid-in-columns-000-crash.html
 /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/grid-in-columns-001-crash.html
 /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/grid-in-columns-002-crash.html

Modified: trunk/Source/WebCore/ChangeLog (292758 => 292759)


--- trunk/Source/WebCore/ChangeLog	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/Source/WebCore/ChangeLog	2022-04-12 03:43:50 UTC (rev 292759)
@@ -1,3 +1,29 @@
+2022-04-11  Antti Koivisto  <an...@apple.com>
+
+        [CSS Container Queries] Update container shorthand order
+        https://bugs.webkit.org/show_bug.cgi?id=239065
+
+        Reviewed by Alan Bujtas.
+
+        The format is now 'name / type' instead of 'type / name'.
+
+        https://drafts.csswg.org/css-contain-3/#container-shorthand
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::ComputedStyleExtractor::valueForPropertyInStyle):
+        * css/StyleProperties.cpp:
+        (WebCore::isNoneValue):
+        (WebCore::isValueID):
+        (WebCore::StyleProperties::getPropertyValue const):
+
+        Also make "foo / none" serialize as "foo".
+
+        * css/parser/CSSParserFastPaths.cpp:
+        (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue):
+        * css/parser/CSSPropertyParser.cpp:
+        (WebCore::consumeContainerName):
+        (WebCore::CSSPropertyParser::consumeContainerShorthand):
+
 2022-04-11  Patrick Angle  <pan...@apple.com>
 
         Web Inspector: preserve DOM.NodeId if a node is removed and re-added

Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (292758 => 292759)


--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp	2022-04-12 03:43:50 UTC (rev 292759)
@@ -3743,9 +3743,12 @@
         }
         case CSSPropertyContainer: {
             auto list = CSSValueList::createSlashSeparated();
-            list->append(propertyValue(CSSPropertyContainerType, DoNotUpdateLayout).releaseNonNull());
-            if (!style.containerNames().isEmpty())
+            if (style.containerNames().isEmpty())
+                list->append(cssValuePool.createIdentifierValue(CSSValueNone));
+            else
                 list->append(propertyValue(CSSPropertyContainerName, DoNotUpdateLayout).releaseNonNull());
+            if (style.containerType() != ContainerType::None)
+                list->append(propertyValue(CSSPropertyContainerType, DoNotUpdateLayout).releaseNonNull());
             return list;
         }
         case CSSPropertyContainerType:

Modified: trunk/Source/WebCore/css/CSSProperties.json (292758 => 292759)


--- trunk/Source/WebCore/css/CSSProperties.json	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/Source/WebCore/css/CSSProperties.json	2022-04-12 03:43:50 UTC (rev 292759)
@@ -5286,8 +5286,8 @@
         "container": {
             "codegen-properties": {
                 "longhands": [
-                    "container-type",
-                    "container-name"
+                    "container-name",
+                    "container-type"
                 ]
             },
             "status": {

Modified: trunk/Source/WebCore/css/StyleProperties.cpp (292758 => 292759)


--- trunk/Source/WebCore/css/StyleProperties.cpp	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/Source/WebCore/css/StyleProperties.cpp	2022-04-12 03:43:50 UTC (rev 292759)
@@ -68,6 +68,21 @@
     return value == "initial" || value == "inherit" || value == "unset" || value == "revert";
 }
 
+static bool isNoneValue(const RefPtr<CSSValue>& value)
+{
+    return value && value->isPrimitiveValue() && downcast<CSSPrimitiveValue>(value.get())->isValueID() && downcast<CSSPrimitiveValue>(value.get())->valueID() == CSSValueNone;
+}
+
+static bool isValueID(const Ref<CSSValue>& value, CSSValueID id)
+{
+    return value->isPrimitiveValue() && downcast<CSSPrimitiveValue>(value.get()).isValueID() && downcast<CSSPrimitiveValue>(value.get()).valueID() == id;
+}
+
+static bool isValueID(const RefPtr<CSSValue>& value, CSSValueID id)
+{
+    return value && isValueID(*value, id);
+}
+
 Ref<ImmutableStyleProperties> ImmutableStyleProperties::create(const CSSProperty* properties, unsigned count, CSSParserMode cssParserMode)
 {
     void* slot = ImmutableStylePropertiesMalloc::malloc(sizeForImmutableStylePropertiesWithPropertyCount(count));
@@ -251,6 +266,13 @@
     case CSSPropertyColumns:
         return getShorthandValue(columnsShorthand());
     case CSSPropertyContainer:
+        if (auto type = getPropertyCSSValue(CSSPropertyContainerType)) {
+            if (isNoneValue(type)) {
+                if (auto name = getPropertyCSSValue(CSSPropertyContainerName))
+                    return name->cssText();
+                return { };
+            }
+        }
         return getShorthandValue(containerShorthand(), " / ");
     case CSSPropertyFlex:
         return getShorthandValue(flexShorthand());
@@ -842,21 +864,6 @@
     return result.isEmpty() ? String() : result.toString();
 }
 
-static bool isNoneValue(const RefPtr<CSSValue>& value)
-{
-    return value && value->isPrimitiveValue() && downcast<CSSPrimitiveValue>(value.get())->isValueID() && downcast<CSSPrimitiveValue>(value.get())->valueID() == CSSValueNone;
-}
-
-static bool isValueID(const Ref<CSSValue>& value, CSSValueID id)
-{
-    return value->isPrimitiveValue() && downcast<CSSPrimitiveValue>(value.get()).isValueID() && downcast<CSSPrimitiveValue>(value.get()).valueID() == id;
-}
-
-static bool isValueID(const RefPtr<CSSValue>& value, CSSValueID id)
-{
-    return value && isValueID(*value, id);
-}
-
 String StyleProperties::getGridTemplateValue() const
 {
     StringBuilder result;

Modified: trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp (292758 => 292759)


--- trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp	2022-04-12 03:43:50 UTC (rev 292759)
@@ -899,7 +899,7 @@
     case CSSPropertyTextDecorationSkipInk:
         return valueID == CSSValueAuto || valueID == CSSValueNone || valueID == CSSValueAll;
     case CSSPropertyContainerType:
-        // FIXME: Support 'style', 'state'. Those will require parsing the value as a list.
+        // FIXME: Support 'style'. It will require parsing the value as a list.
         return valueID == CSSValueNone || valueID == CSSValueSize || valueID == CSSValueInlineSize;
     default:
         ASSERT_NOT_REACHED();

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp (292758 => 292759)


--- trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2022-04-12 03:34:04 UTC (rev 292758)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp	2022-04-12 03:43:50 UTC (rev 292759)
@@ -3862,7 +3862,7 @@
     do {
         auto name = consumeSingleContainerName(range);
         if (!name)
-            return nullptr;
+            return list;
         list->append(name.releaseNonNull());
     } while (!range.atEnd());
 
@@ -6211,28 +6211,28 @@
 
 bool CSSPropertyParser::consumeContainerShorthand(bool important)
 {
-    auto type = parseSingleValue(CSSPropertyContainerType);
-    if (!type)
+    auto name = consumeContainerName(m_range);
+    if (!name)
         return false;
 
     bool sawSlash = false;
 
-    auto consumeSlashName = [&]() -> RefPtr<CSSValue> {
+    auto consumeSlashType = [&]() -> RefPtr<CSSValue> {
         if (m_range.atEnd())
             return nullptr;
         if (!consumeSlashIncludingWhitespace(m_range))
             return nullptr;
         sawSlash = true;
-        return parseSingleValue(CSSPropertyContainerName);
+        return parseSingleValue(CSSPropertyContainerType);
     };
 
-    auto name = consumeSlashName();
+    auto type = consumeSlashType();
 
-    if (!m_range.atEnd() || (sawSlash && !name))
+    if (!m_range.atEnd() || (sawSlash && !type))
         return false;
 
-    addProperty(CSSPropertyContainerType, CSSPropertyContainer, type.releaseNonNull(), important);
-    addPropertyWithImplicitDefault(CSSPropertyContainerName, CSSPropertyContainer, WTFMove(name), CSSValuePool::singleton().createImplicitInitialValue(), important);
+    addProperty(CSSPropertyContainerName, CSSPropertyContainer, name.releaseNonNull(), important);
+    addPropertyWithImplicitDefault(CSSPropertyContainerType, CSSPropertyContainer, WTFMove(type), CSSValuePool::singleton().createImplicitInitialValue(), important);
     return true;
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to