LibWeb: Return used values for grid tracks in getComputedStyle()

That's awkward, but getComputedStyle needs to return used track values
for gridTemplateColumns and gridTemplateRows properties. This change
implements it by saving style values with used values into layout state,
so it could be assigned to paintables during LayoutState::commit() and
later accessed by style_value_for_property().

I haven't seen it used in the wild, but WPT grid tests extensively use
it. For example this change helps to go from 0/10 to 8/10 on this test:
https://wpt.live/css/css-grid/layout-algorithm/grid-fit-content-percentage.html
This commit is contained in:
Aliaksandr Kalenik 2024-09-09 12:15:49 +02:00 committed by Andreas Kling
commit 68fcc37531
Notes: github-actions[bot] 2024-09-09 10:48:59 +00:00
7 changed files with 74 additions and 0 deletions

View file

@ -278,6 +278,11 @@ void LayoutState::commit(Box& root)
auto& svg_geometry_paintable = static_cast<Painting::SVGPathPaintable&>(paintable_box);
svg_geometry_paintable.set_computed_path(move(*used_values.computed_svg_path()));
}
if (node.display().is_grid_inside()) {
paintable_box.set_used_values_for_grid_template_columns(used_values.grid_template_columns());
paintable_box.set_used_values_for_grid_template_rows(used_values.grid_template_rows());
}
}
}