LibWeb/CSS: Parse the container-type property

This applies size, inline-size, and style containment in some cases.
There are other WPT tests for that, but we seem to not implement enough
of containment for this to have an effect so I've not imported those.

Gets us 35 WPT subtests.
This commit is contained in:
Sam Atkins 2025-09-30 14:48:55 +01:00 committed by Tim Ledbetter
commit 3916e33276
Notes: github-actions[bot] 2025-09-30 21:07:12 +00:00
17 changed files with 355 additions and 7 deletions

View file

@ -1887,6 +1887,38 @@ Containment ComputedProperties::contain() const
return containment;
}
ContainerType ComputedProperties::container_type() const
{
ContainerType container_type {};
auto const& value = property(PropertyID::Contain);
if (value.to_keyword() == Keyword::Normal)
return container_type;
if (value.is_value_list()) {
auto& values = value.as_value_list().values();
for (auto const& item : values) {
switch (item->to_keyword()) {
case Keyword::Size:
container_type.is_size_container = true;
break;
case Keyword::InlineSize:
container_type.is_inline_size_container = true;
break;
case Keyword::ScrollState:
container_type.is_scroll_state_container = true;
break;
default:
dbgln("`{}` is not supported in `container-type` (yet?)", item->to_string(SerializationMode::Normal));
break;
}
}
}
return container_type;
}
MixBlendMode ComputedProperties::mix_blend_mode() const
{
auto const& value = property(PropertyID::MixBlendMode);