LibWeb: Ensure floats are correctly placed under the preceding float

Previously floats would be placed next to the highest float that
fitted the new float on its line. However, this violates the rule
that floats should be placed under the preceding float if it does
not fit next to it.
This commit is contained in:
Ruben 2025-05-18 19:03:57 +02:00 committed by Jelle Raaijmakers
parent 3bf7f94150
commit 09f5ce42f6
Notes: github-actions[bot] 2025-05-23 08:59:19 +00:00
5 changed files with 94 additions and 17 deletions

View file

@ -1147,6 +1147,7 @@ void BlockFormattingContext::layout_floating_box(Box const& box, BlockContainer
.margin_box_rect_in_root_coordinate_space = margin_box_rect_in_ancestor_coordinate_space(box_state, root()),
}));
side_data.current_boxes.append(*side_data.all_boxes.last());
m_last_inserted_float = *side_data.all_boxes.last();
if (side == FloatSide::Left) {
side_data.current_width = offset_from_edge + box_state.content_width() + box_state.margin_box_right();