1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:47:45 +00:00

LibWeb: Categorize relative length units

This commit is contained in:
Sam Atkins 2023-04-26 17:37:57 +01:00 committed by Andreas Kling
parent 7add4f2d2f
commit 4a191875a9

View file

@ -70,20 +70,29 @@ public:
|| m_type == Type::Px; || m_type == Type::Px;
} }
bool is_relative() const bool is_font_relative() const
{ {
return m_type == Type::Em return m_type == Type::Em
|| m_type == Type::Rem || m_type == Type::Rem
|| m_type == Type::Ex || m_type == Type::Ex
|| m_type == Type::Ch || m_type == Type::Ch
|| m_type == Type::Lh || m_type == Type::Lh
|| m_type == Type::Rlh || m_type == Type::Rlh;
|| m_type == Type::Vw }
bool is_viewport_relative() const
{
return m_type == Type::Vw
|| m_type == Type::Vh || m_type == Type::Vh
|| m_type == Type::Vmin || m_type == Type::Vmin
|| m_type == Type::Vmax; || m_type == Type::Vmax;
} }
bool is_relative() const
{
return is_font_relative() || is_viewport_relative();
}
Type type() const { return m_type; } Type type() const { return m_type; }
float raw_value() const { return m_value; } float raw_value() const { return m_value; }