LibWeb/CSS: Implement CSSNumericType.equals()

This commit is contained in:
Sam Atkins 2025-08-22 12:53:15 +01:00 committed by Andreas Kling
parent d29084997e
commit 7be645a091
Notes: github-actions[bot] 2025-08-29 09:58:23 +00:00
22 changed files with 181 additions and 16 deletions

View file

@ -25,6 +25,9 @@ struct CSSNumericType {
Optional<Bindings::CSSNumericBaseType> percent_hint;
};
// https://drafts.css-houdini.org/css-typed-om-1/#typedefdef-cssnumberish
using CSSNumberish = Variant<double, GC::Root<CSSNumericValue>>;
// https://drafts.css-houdini.org/css-typed-om-1/#cssnumericvalue
class CSSNumericValue : public CSSStyleValue {
WEB_PLATFORM_OBJECT(CSSNumericValue, CSSStyleValue);
@ -39,6 +42,9 @@ public:
};
virtual ~CSSNumericValue() override = default;
bool equals_for_bindings(Vector<CSSNumberish>) const;
virtual bool is_equal_numeric_value(GC::Ref<CSSNumericValue> other) const = 0;
CSSNumericType type_for_bindings() const;
NumericType const& type() const { return m_type; }
@ -55,9 +61,6 @@ protected:
NumericType m_type;
};
// https://drafts.css-houdini.org/css-typed-om-1/#typedefdef-cssnumberish
using CSSNumberish = Variant<double, GC::Root<CSSNumericValue>>;
GC::Ref<CSSNumericValue> rectify_a_numberish_value(JS::Realm&, CSSNumberish const&, Optional<FlyString> unit = {});
}