mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 09:17:35 +00:00
LibWeb: Make non-absolute values for line-height fall back to font-size
When using bitmap fonts, the computed *font* that we're using may be smaller than the font-size property asked for. We can still honor the font-size value in layout calculations.
This commit is contained in:
parent
ec49c8fefd
commit
88c32836d8
1 changed files with 4 additions and 1 deletions
|
@ -98,7 +98,10 @@ float StyleProperties::line_height(const Layout::Node& layout_node) const
|
||||||
{
|
{
|
||||||
auto line_height_length = length_or_fallback(CSS::PropertyID::LineHeight, Length::make_auto());
|
auto line_height_length = length_or_fallback(CSS::PropertyID::LineHeight, Length::make_auto());
|
||||||
if (line_height_length.is_absolute())
|
if (line_height_length.is_absolute())
|
||||||
return (float)line_height_length.to_px(layout_node);
|
return line_height_length.to_px(layout_node);
|
||||||
|
auto font_size = length_or_fallback(CSS::PropertyID::FontSize, Length::make_auto());
|
||||||
|
if (font_size.is_absolute())
|
||||||
|
return font_size.to_px(layout_node);
|
||||||
return (float)computed_font().glyph_height() * 1.4f;
|
return (float)computed_font().glyph_height() * 1.4f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue