mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +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:
parent
c9a7853fef
commit
71ca857b67
4 changed files with 30 additions and 10 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue