LibWeb: Implement anchor-size(..) function parsing

This parses `anchor-size(..)` functions in CSS, but does not yet result
in a useful `Size`: we need style & layout interleaving similar to
container queries for this, since the resulting value depends on layout
results.

Not supported yet: `anchor-size()` appearing inside a `calc()` node.

Adds 4280 WPT subtest passes in `css/css-anchor-position`.
This commit is contained in:
Jelle Raaijmakers 2025-07-30 14:14:53 +02:00 committed by Tim Ledbetter
commit c4f5e7bee3
Notes: github-actions[bot] 2025-07-30 17:15:09 +00:00
16 changed files with 318 additions and 3 deletions

View file

@ -293,7 +293,7 @@ Optional<Parser::PropertyAndValue> Parser::parse_css_value_for_properties(Readon
auto transaction = tokens.begin_transaction();
if (property_accepts_type(*property, ValueType::Percentage)) {
if (auto value = parse_length_percentage_value(tokens)) {
if (value->is_calculated()) {
if (value->is_calculated() || value->is_anchor_size()) {
transaction.commit();
return PropertyAndValue { *property, value };
}
@ -308,7 +308,7 @@ Optional<Parser::PropertyAndValue> Parser::parse_css_value_for_properties(Readon
}
}
if (auto value = parse_length_value(tokens)) {
if (value->is_calculated()) {
if (value->is_calculated() || value->is_anchor_size()) {
transaction.commit();
return PropertyAndValue { *property, value };
}