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

@ -898,6 +898,7 @@ void NodeWithStyle::apply_style(CSS::ComputedProperties const& computed_style)
computed_values.set_mix_blend_mode(computed_style.mix_blend_mode());
computed_values.set_view_transition_name(computed_style.view_transition_name());
computed_values.set_contain(computed_style.contain());
computed_values.set_container_type(computed_style.container_type());
computed_values.set_shape_rendering(computed_values.shape_rendering());
computed_values.set_will_change(computed_style.will_change());
@ -1226,6 +1227,9 @@ bool Node::has_size_containment() const
if (computed_values().contain().size_containment)
return true;
if (computed_values().container_type().is_size_container)
return true;
return false;
}
// https://drafts.csswg.org/css-contain-2/#containment-inline-size
@ -1250,6 +1254,9 @@ bool Node::has_inline_size_containment() const
if (computed_values().contain().inline_size_containment)
return true;
if (computed_values().container_type().is_inline_size_container)
return true;
return false;
}
// https://drafts.csswg.org/css-contain-2/#containment-layout
@ -1289,6 +1296,9 @@ bool Node::has_style_containment() const
if (computed_values().contain().style_containment)
return true;
if (computed_values().container_type().is_size_container || computed_values().container_type().is_inline_size_container)
return true;
// https://drafts.csswg.org/css-contain-2/#valdef-content-visibility-auto
// Changes the used value of the 'contain' property so as to turn on layout containment, style containment, and
// paint containment for the element.