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

LibWeb: Remove empty trailing line boxes

Sometimes we end up with an empty line box at the bottom of a block.
Instead of worrying about this in all the places we split into lines,
just remove the trailing box (if any) after splitting is finshed.
This commit is contained in:
Andreas Kling 2020-06-25 12:40:07 +02:00
parent 58f76ed11f
commit 232e41a238

View file

@ -185,6 +185,10 @@ void LayoutBlock::layout_inline_children(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 (!m_line_boxes.is_empty() && m_line_boxes.last().fragments().is_empty())
m_line_boxes.take_last();
auto text_align = style().text_align();
float min_line_height = specified_style().line_height(*this);
float line_spacing = min_line_height - specified_style().font().glyph_height();