mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 15:45:25 +00:00
LibWeb: Start fleshing out support for relative CSS units
This patch introduces support for more than just "absolute px" units in our Length class. It now also supports "em" and "rem", which are units relative to the font-size of the current layout node and the <html> element's layout node respectively.
This commit is contained in:
@@ -172,11 +172,11 @@ void StyleProperties::load_font() const
|
||||
return;
|
||||
}
|
||||
|
||||
float StyleProperties::line_height() const
|
||||
float StyleProperties::line_height(const LayoutNode& layout_node) const
|
||||
{
|
||||
auto line_height_length = length_or_fallback(CSS::PropertyID::LineHeight, {});
|
||||
if (line_height_length.is_absolute())
|
||||
return (float)line_height_length.to_px();
|
||||
return (float)line_height_length.to_px(layout_node);
|
||||
return (float)font().glyph_height() * 1.4f;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user