1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:27:35 +00:00

LibWeb: Inform the parent context of the grid's size

This commit is contained in:
martinfalisse 2022-09-07 15:54:47 +02:00 committed by Andreas Kling
parent 214329b81c
commit df22f38feb
2 changed files with 13 additions and 0 deletions

View file

@ -369,8 +369,14 @@ void GridFormattingContext::run(Box const& box, LayoutMode)
// FIXME: 4.2. For dense packing:
}
auto& box_state = m_state.get_mutable(box);
for (auto& positioned_box : positioned_boxes) {
auto& child_box_state = m_state.get_mutable(positioned_box.box);
if (child_box_state.content_height() > positioned_box.computed_height)
positioned_box.computed_height = child_box_state.content_height();
(void)layout_inside(positioned_box.box, LayoutMode::Normal);
if (child_box_state.content_height() > positioned_box.computed_height)
positioned_box.computed_height = child_box_state.content_height();
}
// https://drafts.csswg.org/css-grid/#overview-sizing
@ -992,6 +998,11 @@ void GridFormattingContext::run(Box const& box, LayoutMode)
for (auto& positioned_box : positioned_boxes)
layout_box(positioned_box.row, positioned_box.row + positioned_box.row_span, positioned_box.column, positioned_box.column + positioned_box.column_span, positioned_box.box);
float total_y = 0;
for (auto& grid_row : grid_rows)
total_y += grid_row.base_size;
box_state.set_content_height(total_y);
}
}