LibWeb: Only set line builder's block offset if clearance increases it

This prevents text from overlapping with each other if a `<br>` with
`clear: ..` is used in between.
This commit is contained in:
Jelle Raaijmakers 2025-03-30 02:17:10 +01:00 committed by Andreas Kling
commit 04ba375cc7
Notes: github-actions[bot] 2025-03-31 07:12:12 +00:00
3 changed files with 47 additions and 1 deletions

View file

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