1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:37:35 +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:
Andreas Kling 2020-08-07 20:30:27 +02:00
parent 0bbced444b
commit 498845ea2f
3 changed files with 9 additions and 1 deletions

View file

@ -39,6 +39,7 @@ public:
Auto,
Px,
Pt,
Ex,
Em,
Rem,
};
@ -84,7 +85,7 @@ public:
bool is_percentage() const { return m_type == Type::Percentage; }
bool is_auto() const { return m_type == Type::Auto; }
bool is_absolute() const { return m_type == Type::Px || m_type == Type::Pt; }
bool is_relative() const { return m_type == Type::Em || m_type == Type::Rem; }
bool is_relative() const { return m_type == Type::Ex || m_type == Type::Em || m_type == Type::Rem; }
float raw_value() const { return m_value; }
ALWAYS_INLINE float to_px(const LayoutNode& layout_node) const