mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-19 16:59:47 +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
|
|
@ -139,6 +139,12 @@ struct LayoutState {
|
|||
void set_computed_svg_transforms(Painting::SVGGraphicsPaintable::ComputedTransforms const& computed_transforms) { m_computed_svg_transforms = computed_transforms; }
|
||||
auto const& computed_svg_transforms() const { return m_computed_svg_transforms; }
|
||||
|
||||
void set_grid_template_columns(RefPtr<CSS::GridTrackSizeListStyleValue> used_values_for_grid_template_columns) { m_grid_template_columns = move(used_values_for_grid_template_columns); }
|
||||
auto const& grid_template_columns() const { return m_grid_template_columns; }
|
||||
|
||||
void set_grid_template_rows(RefPtr<CSS::GridTrackSizeListStyleValue> used_values_for_grid_template_rows) { m_grid_template_rows = move(used_values_for_grid_template_rows); }
|
||||
auto const& grid_template_rows() const { return m_grid_template_rows; }
|
||||
|
||||
private:
|
||||
AvailableSize available_width_inside() const;
|
||||
AvailableSize available_height_inside() const;
|
||||
|
|
@ -166,6 +172,9 @@ struct LayoutState {
|
|||
|
||||
Optional<Gfx::Path> m_computed_svg_path;
|
||||
Optional<Painting::SVGGraphicsPaintable::ComputedTransforms> m_computed_svg_transforms;
|
||||
|
||||
RefPtr<CSS::GridTrackSizeListStyleValue> m_grid_template_columns;
|
||||
RefPtr<CSS::GridTrackSizeListStyleValue> m_grid_template_rows;
|
||||
};
|
||||
|
||||
// Commits the used values produced by layout and builds a paintable tree.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue