mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:28:10 +00:00
LibWeb: Handle CSS "ex" lengths (relative to font x-height)
These are pretty rare, but they do come up in some places and it's not hard to support. The Gfx::Font information is approximate (and bad) but we can fix that separately.
This commit is contained in:
parent
0bbced444b
commit
498845ea2f
3 changed files with 9 additions and 1 deletions
|
@ -33,6 +33,8 @@ namespace Web::CSS {
|
|||
float Length::relative_length_to_px(const LayoutNode& layout_node) const
|
||||
{
|
||||
switch (m_type) {
|
||||
case Type::Ex:
|
||||
return m_value * layout_node.specified_style().font().x_height();
|
||||
case Type::Em:
|
||||
return m_value * layout_node.font_size();
|
||||
case Type::Rem:
|
||||
|
@ -49,6 +51,8 @@ const char* Length::unit_name() const
|
|||
return "px";
|
||||
case Type::Pt:
|
||||
return "pt";
|
||||
case Type::Ex:
|
||||
return "ex";
|
||||
case Type::Em:
|
||||
return "em";
|
||||
case Type::Rem:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue