diff options
author | Andreas Kling <kling@serenityos.org> | 2021-10-28 17:34:06 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-28 17:34:37 +0200 |
commit | 88c32836d858564a8664f0fc85f8fd36021945bf (patch) | |
tree | 69c2c9d2cf03e2ffc2114ad3d1a7d503d20a0f6e /Userland/Libraries/LibWeb | |
parent | ec49c8fefd594e4c1393f5026896828634b86cf0 (diff) | |
download | serenity-88c32836d858564a8664f0fc85f8fd36021945bf.zip |
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.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/StyleProperties.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp index c060f9de5d..69eb6d6937 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp @@ -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()); 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; } |