mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:48:11 +00:00
LibHTML: Replaced elements should not break lines at start of line
If the current line box already has zero width, there's no point in inserting a line break to make space, since we'll just be at x=0 after breaking as well. This removes an ugly unnecessary line break before images wider than their containing block. :^)
This commit is contained in:
parent
a5f3f332ed
commit
762f20944c
1 changed files with 1 additions and 1 deletions
|
@ -18,7 +18,7 @@ void LayoutReplaced::split_into_lines(LayoutBlock& container)
|
|||
layout();
|
||||
|
||||
auto* line_box = &container.ensure_last_line_box();
|
||||
if (line_box->width() + width() > container.width())
|
||||
if (line_box->width() > 0 && line_box->width() + width() > container.width())
|
||||
line_box = &container.add_line_box();
|
||||
line_box->add_fragment(*this, 0, 0, width(), height());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue