From eef7b414f2845e82c4c0d0067f45b0279421b804 Mon Sep 17 00:00:00 2001 From: Antti Koivisto Date: Mon, 4 Jul 2022 07:31:37 -0700 Subject: [PATCH] [CSS Container Queries] Rename container-type value 'none' to 'normal' https://bugs.webkit.org/show_bug.cgi?id=242311 Reviewed by Alan Bujtas. Implement https://github.com/w3c/csswg-drafts/issues/7402 Also exclude some values from container-name (per https://drafts.csswg.org/css-contain-3/#container-name). Also re-import container query WPT tests. * LayoutTests/imported/w3c/resources/import-expectations.json: * LayoutTests/imported/w3c/resources/resource-files.json: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-parsing-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-parsing.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-serialization-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-serialization.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-style-serialization-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-style-serialization.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/calc-evaluation-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/calc-evaluation.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-001.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-002.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-003.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-004.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/column-spanner-in-container-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/column-spanner-in-container.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-computed-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-computed.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-inheritance-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-inheritance.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-name-parsing-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-name-parsing.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-parsing-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-parsing.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-size-nested-invalidation-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-size-nested-invalidation.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-computed-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-computed.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-parsing-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-parsing.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-dynamic-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-dynamic.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-fallback-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-fallback.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-invalidation-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-invalidation.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/columns-in-table-002-crash.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/w3c-import.log: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-calc-dynamic-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-calc-dynamic.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-units-dynamic-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-units-dynamic.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-container-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-container.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-item-container-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-item-container.html: Added. * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/w3c-import.log: * Source/WebCore/css/CSSComputedStyleDeclaration.cpp: (WebCore::hasValidStyleForProperty): (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): * Source/WebCore/css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ContainerType const): * Source/WebCore/css/CSSValueKeywords.in: * Source/WebCore/css/StyleProperties.cpp: (WebCore::isCSSWideValueKeyword): Drive-by fix. (WebCore::isNormalValue): (WebCore::StyleProperties::getPropertyValue const): * Source/WebCore/css/parser/CSSParserFastPaths.cpp: (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): * Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::consumeSingleContainerName): * Source/WebCore/dom/Document.cpp: (WebCore::Document::updateLayoutIfDimensionsOutOfDate): * Source/WebCore/rendering/RenderBox.cpp: (WebCore::RenderBox::willBeDestroyed): (WebCore::RenderBox::styleWillChange): * Source/WebCore/rendering/style/RenderStyle.h: (WebCore::RenderStyle::initialContainerType): * Source/WebCore/rendering/style/RenderStyleConstants.h: * Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::effectiveContainment const): * Source/WebCore/style/ContainerQueryEvaluator.cpp: (WebCore::Style::ContainerQueryEvaluator::selectContainer): (WebCore::Style::ContainerQueryEvaluator::evaluateSizeFeature const): * Source/WebCore/style/StyleScope.cpp: (WebCore::Style::Scope::updateQueryContainerState): * Source/WebCore/style/StyleSharingResolver.cpp: (WebCore::Style::SharingResolver::canShareStyleWithElement const): * Source/WebCore/style/StyleTreeResolver.cpp: (WebCore::Style::TreeResolver::pushParent): (WebCore::Style::TreeResolver::resolveComposedTree): (WebCore::Style::TreeResolver::determineQueryContainerAction): Canonical link: https://commits.webkit.org/252116@main --- .../w3c/resources/import-expectations.json | 1 + .../w3c/resources/resource-files.json | 2 + .../at-container-parsing-expected.txt | 27 ++++ .../at-container-parsing.html | 30 ++++ .../at-container-serialization-expected.txt | 1 + .../at-container-serialization.html | 7 +- ...container-style-serialization-expected.txt | 8 + .../at-container-style-serialization.html | 34 ++++ .../calc-evaluation-expected.txt | 3 + .../container-queries/calc-evaluation.html | 32 ++++ .../canvas-as-container-001.html | 6 +- .../canvas-as-container-002.html | 6 +- .../canvas-as-container-003.html | 6 +- .../canvas-as-container-004.html | 6 +- .../column-spanner-in-container-expected.txt | 5 + .../column-spanner-in-container.html | 41 +++++ .../container-computed-expected.txt | 1 + .../container-queries/container-computed.html | 1 + .../container-inheritance-expected.txt | 2 +- .../container-inheritance.html | 2 +- .../container-name-parsing-expected.txt | 9 +- .../container-name-parsing.html | 10 +- .../container-parsing-expected.txt | 12 +- .../container-queries/container-parsing.html | 12 +- ...iner-size-nested-invalidation-expected.txt | 3 + .../container-size-nested-invalidation.html | 62 ++++++++ .../container-type-computed-expected.txt | 1 + .../container-type-computed.html | 5 +- .../container-type-parsing-expected.txt | 12 +- .../container-type-parsing.html | 12 +- ...units-in-at-container-dynamic-expected.txt | 4 + ...ntainer-units-in-at-container-dynamic.html | 37 +++++ ...ntainer-units-in-at-container-expected.txt | 22 +++ ...nits-in-at-container-fallback-expected.txt | 4 + ...tainer-units-in-at-container-fallback.html | 68 ++++++++ .../container-units-in-at-container.html | 111 +++++++++++++ .../container-units-invalidation-expected.txt | 4 +- .../container-units-invalidation.html | 8 +- .../columns-in-table-002-crash.html | 8 +- .../table-in-columns-004-crash.html | 16 ++ .../table-in-columns-005-crash.html | 8 + .../crashtests/w3c-import.log | 2 + .../font-relative-calc-dynamic-expected.txt | 3 + .../font-relative-calc-dynamic.html | 35 ++++ .../font-relative-units-dynamic-expected.txt | 12 +- .../font-relative-units-dynamic.html | 150 ++++++++++++++---- .../grid-container-expected.txt | 3 + .../container-queries/grid-container.html | 29 ++++ .../grid-item-container-expected.txt | 3 + .../grid-item-container.html | 38 +++++ .../container-queries/w3c-import.log | 10 ++ .../css/CSSComputedStyleDeclaration.cpp | 4 +- .../WebCore/css/CSSPrimitiveValueMappings.h | 10 +- Source/WebCore/css/CSSValueKeywords.in | 2 +- Source/WebCore/css/StyleProperties.cpp | 9 +- .../WebCore/css/parser/CSSParserFastPaths.cpp | 2 +- .../css/parser/CSSPropertyParserHelpers.cpp | 16 +- Source/WebCore/dom/Document.cpp | 2 +- Source/WebCore/rendering/RenderBox.cpp | 6 +- Source/WebCore/rendering/style/RenderStyle.h | 2 +- .../rendering/style/RenderStyleConstants.h | 2 +- .../style/StyleRareNonInheritedData.cpp | 2 +- .../WebCore/style/ContainerQueryEvaluator.cpp | 4 +- Source/WebCore/style/StyleScope.cpp | 2 +- Source/WebCore/style/StyleSharingResolver.cpp | 2 +- Source/WebCore/style/StyleTreeResolver.cpp | 6 +- 66 files changed, 899 insertions(+), 106 deletions(-) create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-style-serialization-expected.txt create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-style-serialization.html create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/calc-evaluation-expected.txt create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/calc-evaluation.html create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/column-spanner-in-container-expected.txt create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/column-spanner-in-container.html create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-size-nested-invalidation-expected.txt create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-size-nested-invalidation.html create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-dynamic-expected.txt create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-dynamic.html create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-expected.txt create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-fallback-expected.txt create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-fallback.html create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container.html create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/table-in-columns-004-crash.html create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/table-in-columns-005-crash.html create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-calc-dynamic-expected.txt create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-calc-dynamic.html create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-container-expected.txt create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-container.html create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-item-container-expected.txt create mode 100644 LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-item-container.html diff --git a/LayoutTests/imported/w3c/resources/import-expectations.json b/LayoutTests/imported/w3c/resources/import-expectations.json index be0e01f56d0de..b5384018c29df 100644 --- a/LayoutTests/imported/w3c/resources/import-expectations.json +++ b/LayoutTests/imported/w3c/resources/import-expectations.json @@ -110,6 +110,7 @@ "web-platform-tests/css/css-color": "import", "web-platform-tests/css/css-conditional": "import", "web-platform-tests/css/css-contain": "import", + "web-platform-tests/css/css-contain/container-queries": "import", "web-platform-tests/css/css-content": "import", "web-platform-tests/css/css-counter-styles": "import", "web-platform-tests/css/css-display": "import", diff --git a/LayoutTests/imported/w3c/resources/resource-files.json b/LayoutTests/imported/w3c/resources/resource-files.json index 6f67353bdb328..00975384f3228 100644 --- a/LayoutTests/imported/w3c/resources/resource-files.json +++ b/LayoutTests/imported/w3c/resources/resource-files.json @@ -696,6 +696,8 @@ "web-platform-tests/css/css-contain/container-queries/crashtests/table-in-columns-001-crash.html", "web-platform-tests/css/css-contain/container-queries/crashtests/table-in-columns-002-crash.html", "web-platform-tests/css/css-contain/container-queries/crashtests/table-in-columns-003-crash.html", + "web-platform-tests/css/css-contain/container-queries/crashtests/table-in-columns-004-crash.html", + "web-platform-tests/css/css-contain/container-queries/crashtests/table-in-columns-005-crash.html", "web-platform-tests/css/css-contain/container-queries/display-in-container-ref.html", "web-platform-tests/css/css-contain/container-queries/fieldset-legend-change-ref.html", "web-platform-tests/css/css-contain/container-queries/flex-in-columns-000-crash.html", diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-parsing-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-parsing-expected.txt index f5325fb13ec7a..29dae852411ce 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-parsing-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-parsing-expected.txt @@ -40,6 +40,13 @@ PASS (100px <= width < 200px) PASS (100px > width > 200px) PASS (100px > width >= 200px) PASS (100px >= width > 200px) +PASS (width: calc(10px)) +PASS (width: calc(10em)) +PASS (width: calc(10px + 10em)) +PASS (width < calc(10px + 10em)) +PASS (width < max(10px, 10em)) +PASS (calc(10px + 10em) < width) +PASS (calc(10px + 10em) < width < max(30px, 30em)) PASS foo(width) PASS size(width) PASS (asdf) @@ -83,4 +90,24 @@ PASS Container selector: "foo" PASS Container selector: "inherit" PASS Container selector: none PASS Container selector: None +PASS Container selector: normal +PASS Container selector: Normal +PASS Container selector: auto +PASS Container selector: Auto +PASS Container selector: and +PASS Container selector: or +PASS Container selector: not +PASS Container selector: And +PASS Container selector: oR +PASS Container selector: nOt +FAIL style(--my-prop: foo) assert_equals: expected "true" but got "" +FAIL style(--my-prop: foo - bar ()) assert_equals: expected "true" but got "" +FAIL style(not ((--foo: calc(10px + 2em)) and ((--foo: url(x))))) assert_equals: expected "true" but got "" +FAIL style((--foo: bar) or (--bar: 10px)) assert_equals: expected "true" but got "" +FAIL style(--foo: bar !important) assert_equals: expected "true" but got "" +FAIL style(--my-prop:) assert_equals: expected "true" but got "" +FAIL style(--my-prop: ) assert_equals: expected "true" but got "" +PASS style(--foo: bar;) +PASS style(--foo) +PASS style(style(--foo: bar)) diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-parsing.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-parsing.html index c308fb46a5eff..6278f88216f31 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-parsing.html +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-parsing.html @@ -112,6 +112,14 @@ test_query_known('(100px > width >= 200px)'); test_query_known('(100px >= width > 200px)'); + test_query_known('(width: calc(10px))'); + test_query_known('(width: calc(10em))'); + test_query_known('(width: calc(10px + 10em))'); + test_query_known('(width < calc(10px + 10em))'); + test_query_known('(width < max(10px, 10em))'); + test_query_known('(calc(10px + 10em) < width)'); + test_query_known('(calc(10px + 10em) < width < max(30px, 30em))'); + test_query_unknown('foo(width)'); test_query_unknown('size(width)'); test_query_unknown('(asdf)'); @@ -158,4 +166,26 @@ test_container_selector_invalid('"inherit"'); test_container_selector_invalid('none'); test_container_selector_invalid('None'); + test_container_selector_invalid('normal'); + test_container_selector_invalid('Normal'); + test_container_selector_invalid('auto'); + test_container_selector_invalid('Auto'); + test_container_selector_invalid('and'); + test_container_selector_invalid('or'); + test_container_selector_invalid('not'); + test_container_selector_invalid('And'); + test_container_selector_invalid('oR'); + test_container_selector_invalid('nOt'); + + test_query_known('style(--my-prop: foo)'); + test_query_known('style(--my-prop: foo - bar ())'); + test_query_known('style(not ((--foo: calc(10px + 2em)) and ((--foo: url(x)))))'); + test_query_known('style((--foo: bar) or (--bar: 10px))'); + test_query_known('style(--foo: bar !important)'); + test_query_known('style(--my-prop:)'); + test_query_known('style(--my-prop: )'); + + test_query_unknown('style(--foo: bar;)'); + test_query_unknown('style(--foo)'); + test_query_unknown('style(style(--foo: bar))'); diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-serialization-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-serialization-expected.txt index a29e585cef174..0c78279b3d9a8 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-serialization-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-serialization-expected.txt @@ -5,4 +5,5 @@ PASS Serialization of nested @container rule PASS Serialization of boolean condition syntax PASS Serialization of colon condition syntax PASS Serialization of range condition syntax +PASS Serialization of calc() diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-serialization.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-serialization.html index ef31473c8122a..e1c4710b36972 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-serialization.html +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-serialization.html @@ -24,6 +24,7 @@ @container (10px <= width <= 100px) { } @container (100px>WIDTH>10px) { } @container ( 100px >= width >= 10px ) { } + @container (calc(1em + 1px) >= width >= max(10em, 10px)) { } diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-style-serialization-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-style-serialization-expected.txt new file mode 100644 index 0000000000000..7bf0cdd92595d --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-style-serialization-expected.txt @@ -0,0 +1,8 @@ + +FAIL Normalize spaces assert_equals: expected "style(--foo: bar)" but got "style( --foo:bar)" +FAIL Empty declaration value - spaces assert_equals: expected "style(--foo: )" but got "STyle(--foo: )" +FAIL Empty declaration value assert_equals: expected "style(--foo: )" but got "STyle(--foo:)" +PASS Missing declaration value +FAIL Unknown CSS property after 'or' assert_equals: expected "style((--FOO: BAR) or ( prop: val ))" but got "style( ( --FOO: BAR) OR ( prop: val ) )" +FAIL Not a style function with space before '(' assert_equals: expected "(--foo: bar)" but got "(--foo: )" + diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-style-serialization.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-style-serialization.html new file mode 100644 index 0000000000000..a498c4a7e6c20 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-style-serialization.html @@ -0,0 +1,34 @@ + +CSS Container Queries: style() conditionText serialization + + + + + + + diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/calc-evaluation-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/calc-evaluation-expected.txt new file mode 100644 index 0000000000000..59046787bc55c --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/calc-evaluation-expected.txt @@ -0,0 +1,3 @@ + +PASS em relative inline-size + diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/calc-evaluation.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/calc-evaluation.html new file mode 100644 index 0000000000000..71a5e23764ed3 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/calc-evaluation.html @@ -0,0 +1,32 @@ + +CSS Container Queries Test: calc() + + + + + + +
+
+
+ diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-001.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-001.html index 2f0c5f4827cad..f904d1fe249bb 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-001.html +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-001.html @@ -21,5 +21,9 @@
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-002.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-002.html index 0638d1e648656..689feeb5fffdc 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-002.html +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-002.html @@ -22,5 +22,9 @@
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-003.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-003.html index 7c2651ff46915..74199cc72b7e6 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-003.html +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-003.html @@ -24,5 +24,9 @@
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-004.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-004.html index d9b661c0f95e9..b23846382b743 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-004.html +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-004.html @@ -25,5 +25,9 @@
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/column-spanner-in-container-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/column-spanner-in-container-expected.txt new file mode 100644 index 0000000000000..e1db70cad88b7 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/column-spanner-in-container-expected.txt @@ -0,0 +1,5 @@ + +PASS #spanner matching container with column-width 300px, getting column-span:all +PASS Reducing #multicol width means #spanner no longer gets column-span:all +PASS Back to matching 300px and column-span:all + diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/column-spanner-in-container.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/column-spanner-in-container.html new file mode 100644 index 0000000000000..d494e28504fb6 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/column-spanner-in-container.html @@ -0,0 +1,41 @@ + +CSS Container Queries Test: Column-spanner depending on container in column + + + + + +
+
+
+ diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-computed-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-computed-expected.txt index 334a368e83cc6..7b2648d51857e 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-computed-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-computed-expected.txt @@ -14,4 +14,5 @@ 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' +PASS Property container value 'foo / normal' diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-computed.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-computed.html index b38b0d83dbe36..d83f361640051 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-computed.html +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-computed.html @@ -26,4 +26,5 @@ 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'); +test_computed_value('container', 'foo / normal', 'foo'); diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-inheritance-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-inheritance-expected.txt index 3ce3267873410..ea8e9782c30a5 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-inheritance-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-inheritance-expected.txt @@ -1,6 +1,6 @@ PASS Property container-name has initial value none PASS Property container-name does not inherit -PASS Property container-type has initial value none +PASS Property container-type has initial value normal PASS Property container-type does not inherit diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-inheritance.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-inheritance.html index efc09983c0ddc..b333b691fd787 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-inheritance.html +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-inheritance.html @@ -14,5 +14,5 @@ setup(() => assert_implements_container_queries()); assert_not_inherited('container-name', 'none', 'foo'); -assert_not_inherited('container-type', 'none', 'inline-size'); +assert_not_inherited('container-type', 'normal', 'inline-size'); diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-name-parsing-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-name-parsing-expected.txt index a2952dc64a00c..abb76b6d0ccc5 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-name-parsing-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-name-parsing-expected.txt @@ -9,7 +9,8 @@ PASS e.style['container-name'] = "BAR" should set the property value 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'] = "auto" should not set the property value +PASS e.style['container-name'] = "normal" should not 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 @@ -21,4 +22,10 @@ PASS e.style['container-name'] = "\"unset\"" should not set the property value PASS e.style['container-name'] = "\"revert\"" should not set the property value PASS e.style['container-name'] = "\"none\"" should not set the property value PASS e.style['container-name'] = "\"foo\"" should not set the property value +PASS e.style['container-name'] = "not" should not set the property value +PASS e.style['container-name'] = "and" should not set the property value +PASS e.style['container-name'] = "or" should not set the property value +PASS e.style['container-name'] = "Not" should not set the property value +PASS e.style['container-name'] = "aNd" should not set the property value +PASS e.style['container-name'] = "oR" should not set the property value diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-name-parsing.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-name-parsing.html index c8ae73ad778cb..217a73fb68cb6 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-name-parsing.html +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-name-parsing.html @@ -20,8 +20,9 @@ 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', 'auto'); +test_invalid_value('container-name', 'normal'); test_invalid_value('container-name', 'none none'); test_invalid_value('container-name', 'foo, bar'); test_invalid_value('container-name', '#fff'); @@ -34,4 +35,11 @@ test_invalid_value('container-name', '"revert"'); test_invalid_value('container-name', '"none"'); test_invalid_value('container-name', '"foo"'); + +test_invalid_value('container-name', 'not'); +test_invalid_value('container-name', 'and'); +test_invalid_value('container-name', 'or'); +test_invalid_value('container-name', 'Not'); +test_invalid_value('container-name', 'aNd'); +test_invalid_value('container-name', 'oR'); diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-parsing-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-parsing-expected.txt index e64d963a6db6f..e1185ecfce3ed 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-parsing-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-parsing-expected.txt @@ -4,7 +4,7 @@ PASS e.style['container'] = "inherit" should set the property value 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 -PASS e.style['container'] = "none / none" should set the property value +PASS e.style['container'] = "none / normal" should set the property value PASS e.style['container'] = "inline-size" should set the property value PASS e.style['container'] = "none / inline-size" should set the property value PASS e.style['container'] = "size" should set the property value @@ -13,20 +13,26 @@ PASS e.style['container'] = "inline-size / inline-size" should set the property PASS e.style['container'] = "size / size" 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 / normal" 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 bar / normal" 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'] = "none / inline-size none" should not set the property value +PASS e.style['container'] = "none / inline-size normal" 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'] = "none, normal" should not set the property value +PASS e.style['container'] = "none / none" should not set the property value +PASS e.style['container'] = "none / auto" should not set the property value +PASS e.style['container'] = "normal / size" should not set the property value +PASS e.style['container'] = "auto / size" 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 diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-parsing.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-parsing.html index b8ac692967153..9f1293f51cc7d 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-parsing.html +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-parsing.html @@ -16,7 +16,7 @@ test_valid_value('container', 'unset'); test_valid_value('container', 'revert'); test_valid_value('container', 'none'); -test_valid_value('container', 'none / none', 'none'); +test_valid_value('container', 'none / normal', 'none'); test_valid_value('container', 'inline-size'); test_valid_value('container', 'none / inline-size', 'none / inline-size'); test_valid_value('container', 'size'); @@ -25,9 +25,9 @@ test_valid_value('container', 'size / size'); 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 / normal', 'foo'); test_valid_value('container', 'foo bar / size'); -test_valid_value('container', 'foo bar / none', 'foo bar'); +test_valid_value('container', 'foo bar / normal', 'foo bar'); test_valid_value('container', 'FOO / size'); test_valid_value('container', 'FOO/size', 'FOO / size'); test_valid_value('container', ' FOO /size', 'FOO / size'); @@ -35,11 +35,17 @@ test_invalid_value('container', 'none none'); test_invalid_value('container', 'none inline-size'); test_invalid_value('container', 'none / inline-size none'); +test_invalid_value('container', 'none / inline-size normal'); 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', 'none, normal'); +test_invalid_value('container', 'none / none'); +test_invalid_value('container', 'none / auto'); +test_invalid_value('container', 'normal / size'); +test_invalid_value('container', 'auto / size'); test_invalid_value('container', 'none / foo'); test_invalid_value('container', 'none / foo, bar'); test_invalid_value('container', '#fff'); diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-size-nested-invalidation-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-size-nested-invalidation-expected.txt new file mode 100644 index 0000000000000..e46faab4a3308 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-size-nested-invalidation-expected.txt @@ -0,0 +1,3 @@ + +PASS Queries that skip a container are invalidated correctly + diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-size-nested-invalidation.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-size-nested-invalidation.html new file mode 100644 index 0000000000000..a549f6d84820f --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-size-nested-invalidation.html @@ -0,0 +1,62 @@ + +Nested @container-dependent elements respond to outer container size changes + + + + + +
+
+
+
+
+
+ diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-computed-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-computed-expected.txt index db6b6125eb68d..6fb4fbead1773 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-computed-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-computed-expected.txt @@ -3,4 +3,5 @@ PASS Property container-type value 'initial' PASS Property container-type value 'unset' PASS Property container-type value 'inline-size' PASS Property container-type value 'size' +PASS Property container-type value 'normal' diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-computed.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-computed.html index cd5f1cbb789e2..0b5e033a0f302 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-computed.html +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-computed.html @@ -10,8 +10,9 @@ diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-parsing-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-parsing-expected.txt index 78907986effaf..800d0985f5a36 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-parsing-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-parsing-expected.txt @@ -3,23 +3,25 @@ PASS e.style['container-type'] = "initial" should set the property value PASS e.style['container-type'] = "inherit" should set the property value PASS e.style['container-type'] = "unset" should set the property value PASS e.style['container-type'] = "revert" should set the property value -PASS e.style['container-type'] = "none" should set the property value +PASS e.style['container-type'] = "normal" should set the property value FAIL e.style['container-type'] = "style" should set the property value assert_not_equals: property should be set got disallowed value "" PASS e.style['container-type'] = "size" should set the property value PASS e.style['container-type'] = "inline-size" should set the property value FAIL e.style['container-type'] = "inline-size style" should set the property value assert_not_equals: property should be set got disallowed value "" FAIL e.style['container-type'] = "style inline-size" should set the property value assert_not_equals: property should be set got disallowed value "" FAIL e.style['container-type'] = "style size" should set the property value assert_not_equals: property should be set got disallowed value "" +PASS e.style['container-type'] = "none" should not set the property value +PASS e.style['container-type'] = "auto" should not set the property value PASS e.style['container-type'] = "block-size" should not set the property value -PASS e.style['container-type'] = "none none" should not set the property value -PASS e.style['container-type'] = "none inline-size" should not set the property value -PASS e.style['container-type'] = "inline-size none" should not set the property value +PASS e.style['container-type'] = "normal normal" should not set the property value +PASS e.style['container-type'] = "normal inline-size" should not set the property value +PASS e.style['container-type'] = "inline-size normal" should not set the property value PASS e.style['container-type'] = "inline-size inline-size" should not set the property value PASS e.style['container-type'] = "inline-size block-size" should not set the property value PASS e.style['container-type'] = "block-size inline-size" should not set the property value PASS e.style['container-type'] = "size inline-size" should not set the property value PASS e.style['container-type'] = "inline-size size" should not set the property value -PASS e.style['container-type'] = "none, none" should not set the property value +PASS e.style['container-type'] = "normal, normal" should not set the property value PASS e.style['container-type'] = "foo" should not set the property value PASS e.style['container-type'] = "\"foo\"" should not set the property value PASS e.style['container-type'] = "foo, bar" should not set the property value diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-parsing.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-parsing.html index cce8aa3b90630..34023cbc4f2ad 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-parsing.html +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-parsing.html @@ -14,7 +14,7 @@ test_valid_value('container-type', 'inherit'); test_valid_value('container-type', 'unset'); test_valid_value('container-type', 'revert'); -test_valid_value('container-type', 'none'); +test_valid_value('container-type', 'normal'); test_valid_value('container-type', 'style'); test_valid_value('container-type', 'size'); test_valid_value('container-type', 'inline-size'); @@ -23,16 +23,18 @@ test_valid_value('container-type', 'style inline-size'); test_valid_value('container-type', 'style size'); +test_invalid_value('container-type', 'none'); +test_invalid_value('container-type', 'auto'); test_invalid_value('container-type', 'block-size'); -test_invalid_value('container-type', 'none none'); -test_invalid_value('container-type', 'none inline-size'); -test_invalid_value('container-type', 'inline-size none'); +test_invalid_value('container-type', 'normal normal'); +test_invalid_value('container-type', 'normal inline-size'); +test_invalid_value('container-type', 'inline-size normal'); test_invalid_value('container-type', 'inline-size inline-size'); test_invalid_value('container-type', 'inline-size block-size'); test_invalid_value('container-type', 'block-size inline-size'); test_invalid_value('container-type', 'size inline-size'); test_invalid_value('container-type', 'inline-size size'); -test_invalid_value('container-type', 'none, none'); +test_invalid_value('container-type', 'normal, normal'); test_invalid_value('container-type', 'foo'); test_invalid_value('container-type', '"foo"'); test_invalid_value('container-type', 'foo, bar'); diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-dynamic-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-dynamic-expected.txt new file mode 100644 index 0000000000000..7b9ae9f76ed12 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-dynamic-expected.txt @@ -0,0 +1,4 @@ +Test + +FAIL Query with container-relative units are responsive to changes assert_equals: expected "true" but got "" + diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-dynamic.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-dynamic.html new file mode 100644 index 0000000000000..c1f929241ca70 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-dynamic.html @@ -0,0 +1,37 @@ + +Container Relative Units: in @container prelude (dynamic) + + + + + + +
+
+
Test
+
+
+ + diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-expected.txt new file mode 100644 index 0000000000000..292d4f7f42938 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-expected.txt @@ -0,0 +1,22 @@ +Test1 +Test1 + +FAIL cqw unit resolves against appropriate container assert_equals: expected "true" but got "" +FAIL cqh unit resolves against appropriate container assert_equals: expected "true" but got "" +FAIL cqi unit resolves against appropriate container assert_equals: expected "true" but got "" +FAIL cqb unit resolves against appropriate container assert_equals: expected "true" but got "" +FAIL cqmin unit resolves against appropriate container assert_equals: expected "true" but got "" +FAIL cqmax unit resolves against appropriate container assert_equals: expected "true" but got "" +FAIL cqw unit resolves against appropriate container (vertical writing-mode on subject) assert_equals: expected "true" but got "" +FAIL cqh unit resolves against appropriate container (vertical writing-mode on subject) assert_equals: expected "true" but got "" +FAIL cqi unit resolves against appropriate container (vertical writing-mode on subject) assert_equals: expected "true" but got "" +FAIL cqb unit resolves against appropriate container (vertical writing-mode on subject) assert_equals: expected "true" but got "" +FAIL cqmin unit resolves against appropriate container (vertical writing-mode on subject) assert_equals: expected "true" but got "" +FAIL cqmax unit resolves against appropriate container (vertical writing-mode on subject) assert_equals: expected "true" but got "" +FAIL cqw unit resolves against appropriate container (vertical writing-mode on container) assert_equals: expected "true" but got "" +FAIL cqh unit resolves against appropriate container (vertical writing-mode on container) assert_equals: expected "true" but got "" +FAIL cqi unit resolves against appropriate container (vertical writing-mode on container) assert_equals: expected "true" but got "" +FAIL cqb unit resolves against appropriate container (vertical writing-mode on container) assert_equals: expected "true" but got "" +FAIL cqmin unit resolves against appropriate container (vertical writing-mode on container) assert_equals: expected "true" but got "" +FAIL cqmax unit resolves against appropriate container (vertical writing-mode on container) assert_equals: expected "true" but got "" + diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-fallback-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-fallback-expected.txt new file mode 100644 index 0000000000000..84f9e8ea646dc --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-fallback-expected.txt @@ -0,0 +1,4 @@ + + +FAIL Use small viewport size as fallback assert_equals: expected "rgb(0, 0, 255)" but got "rgb(0, 128, 0)" + diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-fallback.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-fallback.html new file mode 100644 index 0000000000000..3784499c387cc --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-fallback.html @@ -0,0 +1,68 @@ + +Container Relative Units: container relative units fall back to small viewport + + + + + + + diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container.html new file mode 100644 index 0000000000000..9ddca55ec1522 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container.html @@ -0,0 +1,111 @@ + +Container Relative Units: in @container prelude + + + + + + +
+
+
+
Test1
+
+
+
+ +
+
+
+
Test1
+
+
+
+ + diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-invalidation-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-invalidation-expected.txt index 392aa23ec34d8..f5704f3f503bf 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-invalidation-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-invalidation-expected.txt @@ -1,7 +1,7 @@ Test -PASS cqi respond when selected container changes type (inline-size -> none) -PASS cqb respond when selected container changes type (size -> none) +PASS cqi respond when selected container changes type (inline-size -> normal) +PASS cqb respond when selected container changes type (size -> normal) PASS cqb respond when intermediate container changes type (inline-size -> size) PASS cqi respond when selected container changes inline-size PASS cqb respond when selected container changes block-size diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-invalidation.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-invalidation.html index 0cb5b15f4a8e3..1bc708dc88b0c 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-invalidation.html +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-invalidation.html @@ -39,27 +39,27 @@ assert_cqi_equals(child, '30px'); try { - inline.style.containerType = 'none'; + inline.style.containerType = 'normal'; assert_cqi_equals(child, '50px'); } finally { inline.style = ''; } assert_cqi_equals(child, '30px'); - }, `cqi respond when selected container changes type (inline-size -> none)`); + }, `cqi respond when selected container changes type (inline-size -> normal)`); test(function() { assert_cqb_equals(child, '40px'); try { - size.style.containerType = 'none'; + size.style.containerType = 'normal'; assert_cqb_equals(child, '60px'); } finally { size.style = ''; } assert_cqb_equals(child, '40px'); - }, `cqb respond when selected container changes type (size -> none)`); + }, `cqb respond when selected container changes type (size -> normal)`); test(function() { assert_cqb_equals(child, '40px'); diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/columns-in-table-002-crash.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/columns-in-table-002-crash.html index 8062c91d5c80d..24b9f1aab20b5 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/columns-in-table-002-crash.html +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/columns-in-table-002-crash.html @@ -3,7 +3,13 @@

Pass if test does not crash.

-
+
+ diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/table-in-columns-004-crash.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/table-in-columns-004-crash.html new file mode 100644 index 0000000000000..daed42f00945b --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/table-in-columns-004-crash.html @@ -0,0 +1,16 @@ + +CSS Container Queries Crash Test + +

Pass if no crash

+
+ + + +
+ +
+
+
+
diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/table-in-columns-005-crash.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/table-in-columns-005-crash.html new file mode 100644 index 0000000000000..60d6f9d3a1f7e --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/table-in-columns-005-crash.html @@ -0,0 +1,8 @@ + +CSS Container Queries Crash Test + +
  • + +
    +
    +
  • diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/w3c-import.log index 896645234a5a0..d31ff46bd9a5c 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/w3c-import.log +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/w3c-import.log @@ -47,3 +47,5 @@ List of files: /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/table-in-columns-001-crash.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/table-in-columns-002-crash.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/table-in-columns-003-crash.html +/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/table-in-columns-004-crash.html +/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/crashtests/table-in-columns-005-crash.html diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-calc-dynamic-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-calc-dynamic-expected.txt new file mode 100644 index 0000000000000..8762d4686689b --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-calc-dynamic-expected.txt @@ -0,0 +1,3 @@ + +FAIL font-relative calc() is responsive to container font-size changes assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)" + diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-calc-dynamic.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-calc-dynamic.html new file mode 100644 index 0000000000000..54f01d45a396c --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-calc-dynamic.html @@ -0,0 +1,35 @@ + +CSS Container Queries Test: font-relative calc - dynamic + + + + + +
    +
    +
    +
    +
    + diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-units-dynamic-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-units-dynamic-expected.txt index e5f224ee6f1e3..6fcfe76b83dbc 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-units-dynamic-expected.txt +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-units-dynamic-expected.txt @@ -1,10 +1,6 @@ -PASS em relative before change -PASS rem relative before change -PASS ex relative before change -PASS ch relative before change -PASS em relative after change -PASS rem relative after change -PASS ex relative after change -PASS ch relative after change +FAIL em units respond to changes assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)" +PASS rem units respond to changes +FAIL ex units respond to changes assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)" +FAIL ch units respond to changes assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)" diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-units-dynamic.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-units-dynamic.html index 63e17c9a54017..e9f2e1157f3d7 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-units-dynamic.html +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-units-dynamic.html @@ -4,50 +4,130 @@ + + -
    -
    -
    -
    -
    -
    - - document.documentElement.className = "larger"; - document.body.className = "larger"; + + - test(() => assert_equals(getComputedStyle(em_test).color, green), "em relative after change"); - test(() => assert_equals(getComputedStyle(rem_test).color, green), "rem relative after change"); - test(() => assert_equals(getComputedStyle(ex_test).color, green), "ex relative after change"); - test(() => assert_equals(getComputedStyle(ch_test).color, green), "ch relative after change"); + + + + + diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-container-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-container-expected.txt new file mode 100644 index 0000000000000..dc1ade0b0f052 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-container-expected.txt @@ -0,0 +1,3 @@ + +PASS Check that grid items can query grid container + diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-container.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-container.html new file mode 100644 index 0000000000000..60278e09c69f3 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-container.html @@ -0,0 +1,29 @@ + +CSS Container Queries Test: Grid container + + + + + +
    +
    +
    +
    + diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-item-container-expected.txt b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-item-container-expected.txt new file mode 100644 index 0000000000000..191c684a3b747 --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-item-container-expected.txt @@ -0,0 +1,3 @@ + +PASS Check that children can query grid item containers + diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-item-container.html b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-item-container.html new file mode 100644 index 0000000000000..f1c66efc26d9f --- /dev/null +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-item-container.html @@ -0,0 +1,38 @@ + +CSS Container Queries Test: Grid item container + + + + + +
    +
    +
    +
    +
    +
    +
    +
    + diff --git a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/w3c-import.log b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/w3c-import.log index 2111ae7142813..0ffdb74a1f670 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/w3c-import.log +++ b/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/w3c-import.log @@ -21,8 +21,10 @@ List of files: /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/aspect-ratio-feature-evaluation.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-parsing.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-serialization.html +/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/at-container-style-serialization.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/auto-scrollbars.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/backdrop-invalidation.html +/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/calc-evaluation.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-001-expected.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-001.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/canvas-as-container-002-expected.html @@ -38,6 +40,7 @@ List of files: /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/change-display-in-container.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/chrome-legacy-skip-recalc-expected.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/chrome-legacy-skip-recalc.html +/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/column-spanner-in-container.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/conditional-container-status.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-computed.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-for-cue-expected.html @@ -55,6 +58,7 @@ List of files: /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-selection.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-size-invalidation-after-load.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-size-invalidation.html +/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-size-nested-invalidation.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-computed.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-containment.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-type-invalidation.html @@ -68,6 +72,9 @@ List of files: /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-gradient-invalidation.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-gradient-ref.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-gradient.html +/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-dynamic.html +/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container-fallback.html +/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-in-at-container.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-invalidation.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-media-queries.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/container-units-selection.html @@ -92,10 +99,13 @@ List of files: /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/fieldset-legend-change-expected.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/fieldset-legend-change-ref.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/fieldset-legend-change.html +/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-calc-dynamic.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-units-dynamic.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/font-relative-units.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/fragmented-container-001.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/get-animations.html +/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-container.html +/LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/grid-item-container.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/idlharness.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/iframe-in-container-invalidation.html /LayoutTests/imported/w3c/web-platform-tests/css/css-contain/container-queries/iframe-invalidation.html diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp index cf64c23f3b40a..9473102c078c9 100644 --- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp +++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp @@ -2581,7 +2581,7 @@ static inline bool hasValidStyleForProperty(Element& element, CSSPropertyID prop auto isQueryContainer = [&](Element& element) { auto* style = element.renderStyle(); - return style && style->containerType() != ContainerType::None; + return style && style->containerType() != ContainerType::Normal; }; bool isInherited = CSSProperty::isInheritedProperty(propertyID) || isImplicitlyInheritedGridOrFlexProperty(propertyID); @@ -3794,7 +3794,7 @@ RefPtr ComputedStyleExtractor::valueForPropertyInStyle(const RenderSty list->append(cssValuePool.createIdentifierValue(CSSValueNone)); else list->append(propertyValue(CSSPropertyContainerName, DoNotUpdateLayout).releaseNonNull()); - if (style.containerType() != ContainerType::None) + if (style.containerType() != ContainerType::Normal) list->append(propertyValue(CSSPropertyContainerType, DoNotUpdateLayout).releaseNonNull()); return list; } diff --git a/Source/WebCore/css/CSSPrimitiveValueMappings.h b/Source/WebCore/css/CSSPrimitiveValueMappings.h index 6e5da6078a475..4815d2c0cbab8 100644 --- a/Source/WebCore/css/CSSPrimitiveValueMappings.h +++ b/Source/WebCore/css/CSSPrimitiveValueMappings.h @@ -5576,8 +5576,8 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ContainerType containerTy { setPrimitiveUnitType(CSSUnitType::CSS_VALUE_ID); switch (containerType) { - case ContainerType::None: - m_value.valueID = CSSValueNone; + case ContainerType::Normal: + m_value.valueID = CSSValueNormal; break; case ContainerType::Size: m_value.valueID = CSSValueSize; @@ -5592,8 +5592,8 @@ template<> inline CSSPrimitiveValue::operator ContainerType() const { ASSERT(isValueID()); switch (m_value.valueID) { - case CSSValueNone: - return ContainerType::None; + case CSSValueNormal: + return ContainerType::Normal; case CSSValueSize: return ContainerType::Size; case CSSValueInlineSize: @@ -5602,7 +5602,7 @@ template<> inline CSSPrimitiveValue::operator ContainerType() const break; } ASSERT_NOT_REACHED(); - return ContainerType::None; + return ContainerType::Normal; } } diff --git a/Source/WebCore/css/CSSValueKeywords.in b/Source/WebCore/css/CSSValueKeywords.in index 742e530127458..581d130a7124c 100644 --- a/Source/WebCore/css/CSSValueKeywords.in +++ b/Source/WebCore/css/CSSValueKeywords.in @@ -1583,7 +1583,7 @@ paint #endif // container-type -// none +// normal // size inline-size diff --git a/Source/WebCore/css/StyleProperties.cpp b/Source/WebCore/css/StyleProperties.cpp index 7952c6efb6775..c44dab680e32c 100644 --- a/Source/WebCore/css/StyleProperties.cpp +++ b/Source/WebCore/css/StyleProperties.cpp @@ -64,7 +64,7 @@ static size_t sizeForImmutableStylePropertiesWithPropertyCount(unsigned count) static bool isCSSWideValueKeyword(StringView value) { - return value == "initial"_s || value == "inherit"_s || value == "unset"_s || value == "revert"_s; + return value == "initial"_s || value == "inherit"_s || value == "unset"_s || value == "revert"_s || value == "revert-layer"_s; } static bool isNoneValue(const RefPtr& value) @@ -72,6 +72,11 @@ static bool isNoneValue(const RefPtr& value) return value && value->isPrimitiveValue() && downcast(value.get())->isValueID() && downcast(value.get())->valueID() == CSSValueNone; } +static bool isNormalValue(const RefPtr& value) +{ + return value && value->isPrimitiveValue() && downcast(value.get())->isValueID() && downcast(value.get())->valueID() == CSSValueNormal; +} + static bool isValueID(const Ref& value, CSSValueID id) { return value->isPrimitiveValue() && downcast(value.get()).isValueID() && downcast(value.get()).valueID() == id; @@ -265,7 +270,7 @@ String StyleProperties::getPropertyValue(CSSPropertyID propertyID, Document* doc return getShorthandValue(columnsShorthand()); case CSSPropertyContainer: if (auto type = getPropertyCSSValue(CSSPropertyContainerType)) { - if (isNoneValue(type)) { + if (isNormalValue(type)) { if (auto name = getPropertyCSSValue(CSSPropertyContainerName)) return name->cssText(); return { }; diff --git a/Source/WebCore/css/parser/CSSParserFastPaths.cpp b/Source/WebCore/css/parser/CSSParserFastPaths.cpp index 3eed38885bf24..a609cbf2307bf 100644 --- a/Source/WebCore/css/parser/CSSParserFastPaths.cpp +++ b/Source/WebCore/css/parser/CSSParserFastPaths.cpp @@ -901,7 +901,7 @@ bool CSSParserFastPaths::isValidKeywordPropertyAndValue(CSSPropertyID propertyId return valueID == CSSValueAuto || valueID == CSSValueNone || valueID == CSSValueAll; case CSSPropertyContainerType: // FIXME: Support 'style'. It will require parsing the value as a list. - return valueID == CSSValueNone || valueID == CSSValueSize || valueID == CSSValueInlineSize; + return valueID == CSSValueNormal || valueID == CSSValueSize || valueID == CSSValueInlineSize; default: ASSERT_NOT_REACHED(); return false; diff --git a/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp b/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp index 98b5832bbc903..a424545093c5c 100644 --- a/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp +++ b/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp @@ -4291,11 +4291,19 @@ AtomString consumeCounterStyleNameInPrelude(CSSParserTokenRange& prelude) RefPtr consumeSingleContainerName(CSSParserTokenRange& range) { - if (range.peek().id() == CSSValueNone) + switch (range.peek().id()) { + case CSSValueNormal: + case CSSValueNone: + case CSSValueAuto: + case CSSValueAnd: + case CSSValueOr: + case CSSValueNot: return nullptr; - if (auto ident = consumeCustomIdent(range)) - return ident; - return nullptr; + default: + if (auto ident = consumeCustomIdent(range)) + return ident; + return nullptr; + } } std::optional consumeFontVariantCSS21Raw(CSSParserTokenRange& range) diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp index 841a241dd2303..05577fe6fb65f 100644 --- a/Source/WebCore/dom/Document.cpp +++ b/Source/WebCore/dom/Document.cpp @@ -2372,7 +2372,7 @@ bool Document::updateLayoutIfDimensionsOutOfDate(Element& element, DimensionsChe previousBox = currentBox; currentBox = downcast(currRenderer); - if (currentBox->style().containerType() != ContainerType::None) { + if (currentBox->style().containerType() != ContainerType::Normal) { requireFullLayout = true; break; } diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp index 68a8621401df9..14877f50bd9bf 100644 --- a/Source/WebCore/rendering/RenderBox.cpp +++ b/Source/WebCore/rendering/RenderBox.cpp @@ -176,7 +176,7 @@ void RenderBox::willBeDestroyed() if (hasInitializedStyle()) { if (style().hasSnapPosition()) view().unregisterBoxWithScrollSnapPositions(*this); - if (style().containerType() != ContainerType::None) + if (style().containerType() != ContainerType::Normal) view().unregisterContainerQueryBox(*this); } @@ -297,9 +297,9 @@ void RenderBox::styleWillChange(StyleDifference diff, const RenderStyle& newStyl view().unregisterBoxWithScrollSnapPositions(*this); } - if (newStyle.containerType() != ContainerType::None) + if (newStyle.containerType() != ContainerType::Normal) view().registerContainerQueryBox(*this); - else if (oldStyle && oldStyle->containerType() != ContainerType::None) + else if (oldStyle && oldStyle->containerType() != ContainerType::Normal) view().unregisterContainerQueryBox(*this); RenderBoxModelObject::styleWillChange(diff, newStyle); diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h index 06b17e5366253..7c2e50e016036 100644 --- a/Source/WebCore/rendering/style/RenderStyle.h +++ b/Source/WebCore/rendering/style/RenderStyle.h @@ -1718,7 +1718,7 @@ class RenderStyle { static OptionSet initialContainment() { return OptionSet { }; } static OptionSet strictContainment() { return OptionSet { Containment::Size, Containment::Layout, Containment::Paint, Containment::Style }; } static OptionSet contentContainment() { return OptionSet { Containment::Layout, Containment::Paint, Containment::Style }; } - static ContainerType initialContainerType() { return ContainerType::None; } + static ContainerType initialContainerType() { return ContainerType::Normal; } static Vector initialContainerNames() { return { }; } static double initialAspectRatioWidth() { return 1.0; } static double initialAspectRatioHeight() { return 1.0; } diff --git a/Source/WebCore/rendering/style/RenderStyleConstants.h b/Source/WebCore/rendering/style/RenderStyleConstants.h index 111c5de3af6f1..a23668fc2d50a 100644 --- a/Source/WebCore/rendering/style/RenderStyleConstants.h +++ b/Source/WebCore/rendering/style/RenderStyleConstants.h @@ -1205,7 +1205,7 @@ enum class Containment : uint8_t { }; enum class ContainerType : uint8_t { - None, + Normal, Size, InlineSize, }; diff --git a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp index 5f655ead62e6b..955315d4f85d2 100644 --- a/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp +++ b/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp @@ -370,7 +370,7 @@ OptionSet StyleRareNonInheritedData::effectiveContainment() const auto containment = contain; switch (static_cast(containerType)) { - case ContainerType::None: + case ContainerType::Normal: break; case ContainerType::Size: containment.add({ Containment::Layout, Containment::Style, Containment::Size }); diff --git a/Source/WebCore/style/ContainerQueryEvaluator.cpp b/Source/WebCore/style/ContainerQueryEvaluator.cpp index 9c6de68875647..8be6d2fdf394d 100644 --- a/Source/WebCore/style/ContainerQueryEvaluator.cpp +++ b/Source/WebCore/style/ContainerQueryEvaluator.cpp @@ -107,7 +107,7 @@ const Element* ContainerQueryEvaluator::selectContainer(OptionSet axes if (axes.contains(CQ::Axis::Block)) return false; return !axes.contains(principalBox->isHorizontalWritingMode() ? CQ::Axis::Height : CQ::Axis::Width); - case ContainerType::None: + case ContainerType::Normal: return false; } RELEASE_ASSERT_NOT_REACHED(); @@ -245,7 +245,7 @@ auto ContainerQueryEvaluator::evaluateSizeFeature(const CQ::SizeFeature& sizeFea return renderer.shouldApplyInlineSizeContainment(); case ContainerType::Size: return renderer.shouldApplySizeContainment(); - case ContainerType::None: + case ContainerType::Normal: return true; } RELEASE_ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/style/StyleScope.cpp b/Source/WebCore/style/StyleScope.cpp index 645b3b85a3cd3..1fac3ef376dcb 100644 --- a/Source/WebCore/style/StyleScope.cpp +++ b/Source/WebCore/style/StyleScope.cpp @@ -816,7 +816,7 @@ bool Scope::updateQueryContainerState(QueryContainerUpdateContext& context) return size.width() != oldSize.width(); case ContainerType::Size: return size != oldSize; - case ContainerType::None: + case ContainerType::Normal: RELEASE_ASSERT_NOT_REACHED(); } RELEASE_ASSERT_NOT_REACHED(); diff --git a/Source/WebCore/style/StyleSharingResolver.cpp b/Source/WebCore/style/StyleSharingResolver.cpp index 33c282657f358..6efd511a4ad64 100644 --- a/Source/WebCore/style/StyleSharingResolver.cpp +++ b/Source/WebCore/style/StyleSharingResolver.cpp @@ -261,7 +261,7 @@ bool SharingResolver::canShareStyleWithElement(const Context& context, const Sty if (candidateElement.isLink() && context.elementLinkState != style->insideLink()) return false; - if (style->containerType() != ContainerType::None) + if (style->containerType() != ContainerType::Normal) return false; if (candidateElement.elementData() != element.elementData()) { diff --git a/Source/WebCore/style/StyleTreeResolver.cpp b/Source/WebCore/style/StyleTreeResolver.cpp index 614ebfcd796b1..c839313952f60 100644 --- a/Source/WebCore/style/StyleTreeResolver.cpp +++ b/Source/WebCore/style/StyleTreeResolver.cpp @@ -629,7 +629,7 @@ ElementUpdate TreeResolver::createAnimatedElementUpdate(std::unique_ptrcontainerType() : ContainerType::None; + auto previousContainerType = style ? style->containerType() : ContainerType::Normal; auto resolutionType = determineResolutionType(element, parent.descendantsToResolve, parent.change); if (resolutionType) { @@ -889,7 +889,7 @@ auto TreeResolver::determineQueryContainerAction(const Element& element, const R // FIXME: Render tree needs to be updated before proceeding to children also if we have a former query container // because container unit resolution for descendants relies on it being up-to-date. - if (style->containerType() == ContainerType::None && previousContainerType == ContainerType::None) + if (style->containerType() == ContainerType::Normal && previousContainerType == ContainerType::Normal) return QueryContainerAction::None; if (m_resolvedQueryContainers.contains(element))