mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
LibWeb: Break lines until we have enough space between floats
Before this change, we'd always insert one line box fragment, even when a float was taking up too much space on the line, and the fragment didn't actually fit. We now perform line breaks until we have enough space between floats. This fixes many page layouts where we'd previously see small fragments of inline content outside the right edge of the containing block.
This commit is contained in:
@@ -297,4 +297,12 @@ void InlineFormattingContext::generate_line_boxes(LayoutMode layout_mode)
|
||||
}
|
||||
}
|
||||
|
||||
bool InlineFormattingContext::any_floats_intrude_at_y(float y) const
|
||||
{
|
||||
auto box_in_root_rect = content_box_rect_in_ancestor_coordinate_space(containing_block(), parent().root(), m_state);
|
||||
float y_in_root = box_in_root_rect.y() + y;
|
||||
auto space = parent().space_used_by_floats(y_in_root);
|
||||
return space.left > 0 || space.right > 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user