mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-01 07:52:50 +00:00
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:
parent
34fdd0d44f
commit
68fcc37531
Notes:
github-actions[bot]
2024-09-09 10:48:59 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 68fcc37531
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1342
7 changed files with 74 additions and 0 deletions
|
@ -250,6 +250,16 @@ RefPtr<CSSStyleValue const> ResolvedCSSStyleDeclaration::style_value_for_propert
|
|||
return style_value_for_shadow(layout_node.computed_values().box_shadow());
|
||||
case PropertyID::Color:
|
||||
return CSSColorValue::create_from_color(layout_node.computed_values().color());
|
||||
// For grid-template-columns and grid-template-rows the resolved value is the used value.
|
||||
// https://www.w3.org/TR/css-grid-2/#resolved-track-list-standalone
|
||||
case PropertyID::GridTemplateColumns: {
|
||||
auto const& paintable_box = verify_cast<Painting::PaintableBox const>(*layout_node.paintable());
|
||||
return paintable_box.used_values_for_grid_template_columns();
|
||||
}
|
||||
case PropertyID::GridTemplateRows: {
|
||||
auto const& paintable_box = verify_cast<Painting::PaintableBox const>(*layout_node.paintable());
|
||||
return paintable_box.used_values_for_grid_template_rows();
|
||||
}
|
||||
case PropertyID::OutlineColor:
|
||||
return CSSColorValue::create_from_color(layout_node.computed_values().outline_color());
|
||||
case PropertyID::TextDecorationColor:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue