Browse Source

LibWeb: Add NumberPercentage CSS type

This type is used quite a bit in CSS filters.
MacDue 2 năm trước cách đây
mục cha
commit
84d9a226e6
1 tập tin đã thay đổi với 9 bổ sung0 xóa
  1. 9 0
      Userland/Libraries/LibWeb/CSS/Percentage.h

+ 9 - 0
Userland/Libraries/LibWeb/CSS/Percentage.h

@@ -11,6 +11,7 @@
 #include <LibWeb/CSS/Angle.h>
 #include <LibWeb/CSS/Frequency.h>
 #include <LibWeb/CSS/Length.h>
+#include <LibWeb/CSS/Number.h>
 #include <LibWeb/CSS/Time.h>
 
 namespace Web::CSS {
@@ -209,6 +210,14 @@ public:
     virtual Time resolve_calculated(NonnullRefPtr<CalculatedStyleValue> const&, Layout::Node const&, Time const& reference_value) const override;
 };
 
+struct NumberPercentage : public PercentageOr<Number> {
+public:
+    using PercentageOr<Number>::PercentageOr;
+
+    bool is_number() const { return is_t(); }
+    Number const& number() const { return get_t(); }
+};
+
 }
 
 template<>