mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 22:15:06 +00:00
LibHTML: Divide the "line spacing" evenly between lines of text
Before this patch, all of the excess spacing caused by line-height was "padding" the line boxes below the text. To fix this, we make line box fragments use the font height as their height, and then let the inline layout algorithm adjust the Y positions to distribute the vertical space.
This commit is contained in:
parent
10d67879c3
commit
847b232680
2 changed files with 5 additions and 5 deletions
|
@ -67,6 +67,7 @@ void LayoutBlock::layout_inline_children()
|
|||
}
|
||||
|
||||
float min_line_height = style().line_height();
|
||||
float line_spacing = min_line_height - style().font().glyph_height();
|
||||
float content_height = 0;
|
||||
|
||||
// FIXME: This should be done by the CSS parser!
|
||||
|
@ -121,7 +122,7 @@ void LayoutBlock::layout_inline_children()
|
|||
// Vertically align everyone's bottom to the line.
|
||||
// FIXME: Support other kinds of vertical alignment.
|
||||
fragment.rect().set_x(roundf(x_offset + fragment.rect().x()));
|
||||
fragment.rect().set_y(y() + content_height + (max_height - fragment.rect().height()));
|
||||
fragment.rect().set_y(y() + content_height + (max_height - fragment.rect().height()) - (line_spacing / 2));
|
||||
|
||||
if (text_align == CSS::ValueID::Justify) {
|
||||
if (fragment.is_justifiable_whitespace()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue