Skip to content

Commit

Permalink
[@container] Keep duplicate container names in computed value
Browse files Browse the repository at this point in the history
Per resolution [1], don't remove duplicate container names from the
computed value.

[1] w3c/csswg-drafts#7181

Bug: 1145970
Change-Id: I3950c9dafefe952cbbe90cec4e1df09d8e9382e3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3663167
Reviewed-by: Anders Hartvoll Ruud <andruud@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1007289}
NOKEYCHECK=True
GitOrigin-RevId: d793fb60b8ba4f9a2270a6b7879100d9953da807
  • Loading branch information
Rune Lillesveen authored and copybara-github committed May 25, 2022
1 parent c623d06 commit cc53fd9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
9 changes: 2 additions & 7 deletions blink/renderer/core/css/resolver/style_builder_converter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2292,20 +2292,15 @@ ScrollbarGutter StyleBuilderConverter::ConvertScrollbarGutter(
Vector<AtomicString> StyleBuilderConverter::ConvertContainerName(
StyleResolverState& state,
const CSSValue& value) {
HashSet<AtomicString> seen;
Vector<AtomicString> names;

if (auto* ident = DynamicTo<CSSIdentifierValue>(value)) {
DCHECK_EQ(To<CSSIdentifierValue>(value).GetValueID(), CSSValueID::kNone);
return names;
}

for (const auto& item : To<CSSValueList>(value)) {
const AtomicString& value = To<CSSCustomIdentValue>(item.Get())->Value();
if (!seen.insert(value).is_new_entry)
continue;
names.push_back(value);
}
for (const auto& item : To<CSSValueList>(value))
names.push_back(To<CSSCustomIdentValue>(item.Get())->Value());

return names;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
</script>

0 comments on commit cc53fd9

Please sign in to comment.