LibWeb: Forget floating boxes once we've gone past them

Once we've generated enough lines to make it past all the floating
boxes on either side, just forget those boxes. This simplifies the
available space computation since we don't have to consider boxes
that can't vertically intersect the current line anyway.
This commit is contained in:
Andreas Kling 2020-12-06 21:11:28 +01:00
parent 9470169317
commit cb04a5c52c
Notes: sideshowbarker 2024-07-19 01:00:56 +09:00

View file

@ -671,6 +671,8 @@ void BlockFormattingContext::layout_floating_child(Box& box, Box& containing_blo
} else {
// This box does not touch another floating box, go all the way to the left.
x = 0;
// Also, forget all previous left-floating boxes while we're here since they're no longer relevant.
m_left_floating_boxes.clear();
}
} else {
// This is the first left-floating box. Go all the way to the left.
@ -687,6 +689,8 @@ void BlockFormattingContext::layout_floating_child(Box& box, Box& containing_blo
} else {
// This box does not touch another floating box, go all the way to the right.
x = containing_block.width() - box.width();
// Also, forget all previous right-floating boxes while we're here since they're no longer relevant.
m_right_floating_boxes.clear();
}
} else {
// This is the first right-floating box. Go all the way to the right.