From cc53fd9e59ad9085ee961bdcfba3f0860b647d53 Mon Sep 17 00:00:00 2001 From: Rune Lillesveen Date: Wed, 25 May 2022 08:42:58 +0000 Subject: [PATCH] [@container] Keep duplicate container names in computed value Per resolution [1], don't remove duplicate container names from the computed value. [1] https://github.com/w3c/csswg-drafts/issues/7181 Bug: 1145970 Change-Id: I3950c9dafefe952cbbe90cec4e1df09d8e9382e3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3663167 Reviewed-by: Anders Hartvoll Ruud Commit-Queue: Rune Lillesveen Cr-Commit-Position: refs/heads/main@{#1007289} NOKEYCHECK=True GitOrigin-RevId: d793fb60b8ba4f9a2270a6b7879100d9953da807 --- .../core/css/resolver/style_builder_converter.cc | 9 ++------- .../container-queries/container-name-computed.html | 6 +++--- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/blink/renderer/core/css/resolver/style_builder_converter.cc b/blink/renderer/core/css/resolver/style_builder_converter.cc index 87c44bf5a21..ca8a3571847 100644 --- a/blink/renderer/core/css/resolver/style_builder_converter.cc +++ b/blink/renderer/core/css/resolver/style_builder_converter.cc @@ -2292,7 +2292,6 @@ ScrollbarGutter StyleBuilderConverter::ConvertScrollbarGutter( Vector StyleBuilderConverter::ConvertContainerName( StyleResolverState& state, const CSSValue& value) { - HashSet seen; Vector names; if (auto* ident = DynamicTo(value)) { @@ -2300,12 +2299,8 @@ Vector StyleBuilderConverter::ConvertContainerName( return names; } - for (const auto& item : To(value)) { - const AtomicString& value = To(item.Get())->Value(); - if (!seen.insert(value).is_new_entry) - continue; - names.push_back(value); - } + for (const auto& item : To(value)) + names.push_back(To(item.Get())->Value()); return names; } diff --git a/blink/web_tests/external/wpt/css/css-contain/container-queries/container-name-computed.html b/blink/web_tests/external/wpt/css/css-contain/container-queries/container-name-computed.html index 94e173730f1..f58d54744e4 100644 --- a/blink/web_tests/external/wpt/css/css-contain/container-queries/container-name-computed.html +++ b/blink/web_tests/external/wpt/css/css-contain/container-queries/container-name-computed.html @@ -16,8 +16,8 @@ test_computed_value('container-name', 'FoO'); test_computed_value('container-name', 'foo bar'); test_computed_value('container-name', 'bar foo'); -test_computed_value('container-name', 'foo foo bar', 'foo bar'); -test_computed_value('container-name', 'foo bar foo', 'foo bar'); -test_computed_value('container-name', 'bar foo foo', 'bar foo'); +test_computed_value('container-name', 'foo foo bar'); +test_computed_value('container-name', 'foo bar foo'); +test_computed_value('container-name', 'bar foo foo'); test_computed_value('container-name', '\\!escaped');