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

LibHTML: Don't insert unnecessary line breaks at start of text lines

Basically the same exact fix as I did for replaced elements. There's no
point in inserting a line break at the start of a line if all you're
trying to achieve is make more horizontal space for something.
This commit is contained in:
Andreas Kling 2019-10-19 21:34:15 +02:00
parent 884ae80699
commit 8b07025145

View file

@ -180,7 +180,7 @@ void LayoutText::split_into_lines(LayoutBlock& container)
else
word_width = font.width(word.view) + font.glyph_spacing();
if (word_width > available_width) {
if (line_boxes.last().width() > 0 && word_width > available_width) {
line_boxes.append(LineBox());
available_width = container.width();
}