mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:07:45 +00:00
LibWeb: Add a specialized NumericStyleValue::equals()
This allows fast comparison of two NumericStyleValues.
This commit is contained in:
parent
3e4fffec26
commit
ae7bbd93b8
1 changed files with 7 additions and 0 deletions
|
@ -348,6 +348,13 @@ public:
|
||||||
float value() const { return m_value; }
|
float value() const { return m_value; }
|
||||||
String to_string() const override { return String::formatted("{}", 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:
|
private:
|
||||||
explicit NumericStyleValue(float value)
|
explicit NumericStyleValue(float value)
|
||||||
: StyleValue(Type::Numeric)
|
: StyleValue(Type::Numeric)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue