1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +00:00

LibWeb: Add equals() for LengthStyleValue and ColorStyleValue

The default equals() does to_string() on both sides which is pretty
silly when they are of the same type.
This commit is contained in:
Andreas Kling 2020-12-15 19:39:33 +01:00
parent 58bade25dd
commit 30685a7714
2 changed files with 24 additions and 0 deletions

View file

@ -154,6 +154,16 @@ public:
return String::format("[%g %s]", m_value, unit_name());
}
bool operator==(const Length& other) const
{
return m_type == other.m_type && m_value == other.m_value;
}
bool operator!=(const Length& other) const
{
return !(*this == other);
}
private:
float relative_length_to_px(const Layout::Node&) const;