From c55909f1755ae85d03cf27d09d40a3c97a3c3926 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 21 Sep 2021 11:31:03 +0200 Subject: [PATCH] LibWeb: Add a specialized BorderRadiusStyleValue::equals() This allows fast comparison of two BorderRadiusStyleValues. --- Userland/Libraries/LibWeb/CSS/StyleValue.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h index 1205753016..367d1f8111 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h @@ -822,6 +822,16 @@ public: return String::formatted("{} / {}", m_horizontal_radius.to_string(), m_vertical_radius.to_string()); } + virtual bool equals(StyleValue const& other) const override + { + if (type() != other.type()) + return false; + auto& other_value = static_cast(other); + return m_is_elliptical == other_value.m_is_elliptical + && m_horizontal_radius == other_value.m_horizontal_radius + && m_vertical_radius == other_value.m_vertical_radius; + } + private: BorderRadiusStyleValue(Length const& horizontal_radius, Length const& vertical_radius) : StyleValue(Type::BorderRadius)