LibHTML: Respect the line-height property if set

It's now possible to override the line-height via CSS. It will still
default to 1.4 if not specified.
This commit is contained in:
Andreas Kling 2019-11-18 16:54:20 +01:00
parent a14cc573b0
commit b7a840fd0d
Notes: sideshowbarker 2024-07-19 11:09:23 +09:00

View file

@ -103,6 +103,9 @@ void StyleProperties::load_font() const
float StyleProperties::line_height() const
{
auto line_height_length = length_or_fallback(CSS::PropertyID::LineHeight, {});
if (line_height_length.is_absolute())
return (float)font().glyph_height() * line_height_length.to_px();
return (float)font().glyph_height() * 1.4f;
}