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

LibWeb: Truncate oversized grid spans

If a span makes a CSS Grid item overflow vertically, then it should be
truncated as done on other web engines.
This commit is contained in:
martinfalisse 2022-09-24 17:43:34 +02:00 committed by Andreas Kling
parent f3bf01f265
commit db19570b94

View file

@ -1130,8 +1130,10 @@ void GridFormattingContext::run(Box const& box, LayoutMode, AvailableSpace const
child_box_state.offset = { x_start, y_start };
};
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);
for (auto& positioned_box : positioned_boxes) {
auto resolved_span = positioned_box.row + positioned_box.row_span > static_cast<int>(grid_rows.size()) ? static_cast<int>(grid_rows.size()) - positioned_box.row : positioned_box.row_span;
layout_box(positioned_box.row, positioned_box.row + resolved_span, positioned_box.column, positioned_box.column + positioned_box.column_span, positioned_box.box);
}
float total_y = 0;
for (auto& grid_row : grid_rows)