summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorMacDue <macdue@dueutil.tech>2023-02-12 23:25:14 +0000
committerSam Atkins <atkinssj@gmail.com>2023-02-17 16:22:56 +0000
commit9337892ce03eab90decfe4307785df6a566ceae4 (patch)
tree9ec6e55ab5c97ed52c9e0c03e5c6f633e069b460 /Userland
parentd00a6ca11f5c4fe23c87141e2de32db7a72002d1 (diff)
downloadserenity-9337892ce03eab90decfe4307785df6a566ceae4.zip
LibWeb: Use default equality operators for StyleValue helper structs
Co-authored-by: kleines Filmröllchen <filmroellchen@serenityos.org>
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleValue.cpp30
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleValue.h9
2 files changed, 8 insertions, 31 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp
index ca42cb4d2b..1ae996f905 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleValue.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleValue.cpp
@@ -1306,31 +1306,6 @@ ErrorOr<String> FilterValueListStyleValue::to_string() const
return builder.to_string();
}
-static bool operator==(Filter::Blur const& a, Filter::Blur const& b)
-{
- return a.radius == b.radius;
-}
-
-static bool operator==(Filter::DropShadow const& a, Filter::DropShadow const& b)
-{
- return a.offset_x == b.offset_x && a.offset_y == b.offset_y && a.radius == b.radius && a.color == b.color;
-}
-
-static bool operator==(Filter::HueRotate::Zero const&, Filter::HueRotate::Zero const&)
-{
- return true;
-}
-
-static bool operator==(Filter::Color const& a, Filter::Color const& b)
-{
- return a.operation == b.operation && a.amount == b.amount;
-}
-
-static bool operator==(Filter::HueRotate const& a, Filter::HueRotate const& b)
-{
- return a.angle == b.angle;
-}
-
bool FilterValueListStyleValue::equals(StyleValue const& other) const
{
if (type() != other.type())
@@ -1848,11 +1823,6 @@ ErrorOr<String> LinearGradientStyleValue::to_string() const
return builder.to_string();
}
-static bool operator==(EdgeRect const& a, EdgeRect const& b)
-{
- return a.top_edge == b.top_edge && a.right_edge == b.right_edge && a.bottom_edge == b.bottom_edge && a.left_edge == b.left_edge;
-}
-
bool LinearGradientStyleValue::equals(StyleValue const& other_) const
{
if (type() != other_.type())
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h
index 71086ac8f8..024bc354dd 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleValue.h
+++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h
@@ -143,6 +143,7 @@ struct EdgeRect {
Length bottom_edge;
Length left_edge;
Gfx::FloatRect resolved(Layout::Node const&, Gfx::FloatRect) const;
+ bool operator==(EdgeRect const&) const = default;
};
namespace Filter {
@@ -150,6 +151,7 @@ namespace Filter {
struct Blur {
Optional<Length> radius {};
float resolved_radius(Layout::Node const&) const;
+ bool operator==(Blur const&) const = default;
};
struct DropShadow {
@@ -164,13 +166,17 @@ struct DropShadow {
Color color;
};
Resolved resolved(Layout::Node const&) const;
+ bool operator==(DropShadow const&) const = default;
};
struct HueRotate {
- struct Zero { };
+ struct Zero {
+ bool operator==(Zero const&) const = default;
+ };
using AngleOrZero = Variant<Angle, Zero>;
Optional<AngleOrZero> angle {};
float angle_degrees() const;
+ bool operator==(HueRotate const&) const = default;
};
struct Color {
@@ -185,6 +191,7 @@ struct Color {
} operation;
Optional<NumberPercentage> amount {};
float resolved_amount() const;
+ bool operator==(Color const&) const = default;
};
};