diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2023-04-26 17:37:57 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-04-29 16:23:50 +0200 |
commit | 4a191875a934e9c246a18dc4d944270db1ba888f (patch) | |
tree | 057572158e741ecde9fd209a62e84911ec40f856 | |
parent | 7add4f2d2f7f34491001b2c7ee4d929c07b9282d (diff) | |
download | serenity-4a191875a934e9c246a18dc4d944270db1ba888f.zip |
LibWeb: Categorize relative length units
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/Length.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Length.h b/Userland/Libraries/LibWeb/CSS/Length.h index 41524c9c51..0b7d977294 100644 --- a/Userland/Libraries/LibWeb/CSS/Length.h +++ b/Userland/Libraries/LibWeb/CSS/Length.h @@ -70,20 +70,29 @@ public: || m_type == Type::Px; } - bool is_relative() const + bool is_font_relative() const { return m_type == Type::Em || m_type == Type::Rem || m_type == Type::Ex || m_type == Type::Ch || m_type == Type::Lh - || m_type == Type::Rlh - || m_type == Type::Vw + || m_type == Type::Rlh; + } + + bool is_viewport_relative() const + { + return m_type == Type::Vw || m_type == Type::Vh || m_type == Type::Vmin || m_type == Type::Vmax; } + bool is_relative() const + { + return is_font_relative() || is_viewport_relative(); + } + Type type() const { return m_type; } float raw_value() const { return m_value; } |