From 70b74d2e07ccc5b2fc29118c209522e3d50f9b0a Mon Sep 17 00:00:00 2001 From: Anders Hartvoll Ruud Date: Thu, 30 Jun 2022 04:09:07 -0700 Subject: [PATCH] [@container] Change initial value of container-type to 'normal' Per recent CSSWG resolution [1], the initial value is now 'normal'. The function StyleBuilderConverter::ConvertFlags had hard-coded handling of CSSValueID::kNone which interpreted that to mean "flags=0". Since we now also need kNormal to mean "flags=0", this CL adds a template parameter to indicate which CSSValueID we should treat as zero. This CL also disallows the following values from the of the container-name property: - normal, which was clearly intended from reading the discussion in [1]. - auto, which is not explicitly mentioned in [1] as something to disallow, but it's aligned with the ambition to disallow none/normal/auto from in general [2]. [1] https://github.com/w3c/csswg-drafts/issues/7402 [2] https://github.com/w3c/csswg-drafts/issues/7431 Fixed: 1340859 Change-Id: I841303e2b5673c65d69d97522a0a3661e5d1ec24 --- .../container-queries/at-container-parsing.html | 4 ++++ .../container-queries/container-computed.html | 1 + .../container-queries/container-inheritance.html | 2 +- .../container-queries/container-name-parsing.html | 2 ++ .../container-queries/container-parsing.html | 12 +++++++++--- .../container-queries/container-type-computed.html | 5 +++-- .../container-queries/container-type-parsing.html | 12 +++++++----- .../container-units-invalidation.html | 8 ++++---- .../properties/container-type.html | 2 +- 9 files changed, 32 insertions(+), 16 deletions(-) diff --git a/css/css-contain/container-queries/at-container-parsing.html b/css/css-contain/container-queries/at-container-parsing.html index 5b2ed7f31c9b5ce..6278f88216f314b 100644 --- a/css/css-contain/container-queries/at-container-parsing.html +++ b/css/css-contain/container-queries/at-container-parsing.html @@ -166,6 +166,10 @@ 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'); diff --git a/css/css-contain/container-queries/container-computed.html b/css/css-contain/container-queries/container-computed.html index b38b0d83dbe361d..d83f3616400518b 100644 --- a/css/css-contain/container-queries/container-computed.html +++ b/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/css/css-contain/container-queries/container-inheritance.html b/css/css-contain/container-queries/container-inheritance.html index efc09983c0ddc97..b333b691fd78789 100644 --- a/css/css-contain/container-queries/container-inheritance.html +++ b/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/css/css-contain/container-queries/container-name-parsing.html b/css/css-contain/container-queries/container-name-parsing.html index b253ee8573fe29c..217a73fb68cb60a 100644 --- a/css/css-contain/container-queries/container-name-parsing.html +++ b/css/css-contain/container-queries/container-name-parsing.html @@ -21,6 +21,8 @@ test_valid_value('container-name', 'foo foo'); test_valid_value('container-name', '\\!escaped'); +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'); diff --git a/css/css-contain/container-queries/container-parsing.html b/css/css-contain/container-queries/container-parsing.html index b8ac6929671536a..9f1293f51cc7dfc 100644 --- a/css/css-contain/container-queries/container-parsing.html +++ b/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/css/css-contain/container-queries/container-type-computed.html b/css/css-contain/container-queries/container-type-computed.html index cd5f1cbb789e2ee..0b5e033a0f302e9 100644 --- a/css/css-contain/container-queries/container-type-computed.html +++ b/css/css-contain/container-queries/container-type-computed.html @@ -10,8 +10,9 @@ diff --git a/css/css-contain/container-queries/container-type-parsing.html b/css/css-contain/container-queries/container-type-parsing.html index cce8aa3b90630da..34023cbc4f2ad02 100644 --- a/css/css-contain/container-queries/container-type-parsing.html +++ b/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/css/css-contain/container-queries/container-units-invalidation.html b/css/css-contain/container-queries/container-units-invalidation.html index 0cb5b15f4a8e366..1bc708dc88b0c20 100644 --- a/css/css-contain/container-queries/container-units-invalidation.html +++ b/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/css/css-typed-om/the-stylepropertymap/properties/container-type.html b/css/css-typed-om/the-stylepropertymap/properties/container-type.html index d52915492390dc0..c823ffb759894f1 100644 --- a/css/css-typed-om/the-stylepropertymap/properties/container-type.html +++ b/css/css-typed-om/the-stylepropertymap/properties/container-type.html @@ -12,7 +12,7 @@ 'use strict'; runPropertyTests('container-type', [ - { syntax: 'none' }, + { syntax: 'normal' }, { syntax: 'size' }, { syntax: 'inline-size' }, { syntax: 'style' },