mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
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:
parent
9470169317
commit
cb04a5c52c
Notes:
sideshowbarker
2024-07-19 01:00:56 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/cb04a5c52cb
1 changed files with 4 additions and 0 deletions
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue