Просмотр исходного кода

LibWeb: Categorize relative length units

Sam Atkins 2 лет назад
Родитель
Сommit
4a191875a9
1 измененных файлов с 12 добавлено и 3 удалено
  1. 12 3
      Userland/Libraries/LibWeb/CSS/Length.h

+ 12 - 3
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; }