1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:38:11 +00:00

LibWeb: Don't do horizontal inline line layout twice for last line

After pruning empty last line boxes, we now avoid re-running the
horizontal fragment positioning step, since that would be wasted work.
This commit is contained in:
Andreas Kling 2022-01-22 10:32:49 +01:00
parent b1fd801436
commit 70a56d21dc
4 changed files with 27 additions and 8 deletions

View file

@ -201,9 +201,7 @@ void InlineFormattingContext::generate_line_boxes(LayoutMode layout_mode)
line_box.trim_trailing_whitespace();
}
// If there's an empty line box at the bottom, just remove it instead of giving it height.
if (!containing_block().line_boxes().is_empty() && containing_block().line_boxes().last().fragments().is_empty())
containing_block().line_boxes().take_last();
line_builder.remove_last_line_if_empty();
}
}