LibWeb: Resolve block height correctly after line break with clear: ..

If a block with inline children ends with a line break clearing any
floats, we not only need to take the introduced clearance into account
for the next line box, but the containing block needs to set the correct
height as well.

Since the spec calls for using the last line box' bottom as the resolved
height (if treated as auto), we now correctly apply the clearance to the
previous line box' bottom coordinate.

Fixes #4058.
This commit is contained in:
Jelle Raaijmakers 2025-04-01 11:01:15 +02:00
commit 6d911a6baa
Notes: github-actions[bot] 2025-04-01 14:03:58 +00:00
7 changed files with 85 additions and 16 deletions

View file

@ -282,8 +282,7 @@ void InlineFormattingContext::generate_line_boxes()
if (item.node) {
auto introduce_clearance = parent().clear_floating_boxes(*item.node, *this);
if (introduce_clearance == BlockFormattingContext::DidIntroduceClearance::Yes) {
if (vertical_float_clearance() > line_builder.current_block_offset())
line_builder.set_current_block_offset(vertical_float_clearance());
line_builder.did_introduce_clearance(vertical_float_clearance());
parent().reset_margin_state();
}
}