mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-27 18:15:10 +00:00
LibWeb: Add a specialized NumericStyleValue::equals()
This allows fast comparison of two NumericStyleValues.
This commit is contained in:
@@ -348,6 +348,13 @@ public:
|
||||
float value() const { return m_value; }
|
||||
String to_string() const override { return String::formatted("{}", m_value); }
|
||||
|
||||
virtual bool equals(StyleValue const& other) const override
|
||||
{
|
||||
if (type() != other.type())
|
||||
return false;
|
||||
return m_value == static_cast<NumericStyleValue const&>(other).m_value;
|
||||
}
|
||||
|
||||
private:
|
||||
explicit NumericStyleValue(float value)
|
||||
: StyleValue(Type::Numeric)
|
||||
|
||||
Reference in New Issue
Block a user