LibWeb: Add missing equals() function for ConicGradientStyleValue

Also, tidy up the one for LinearGradientStyleValue.
This commit is contained in:
MacDue 2022-11-07 19:02:00 +01:00 committed by Sam Atkins
parent 22a7611e1c
commit d1b06af307
Notes: sideshowbarker 2024-07-17 03:49:59 +09:00

View File

@ -1821,19 +1821,10 @@ bool LinearGradientStyleValue::equals(StyleValue const& other_) const
if (type() != other_.type())
return false;
auto& other = other_.as_linear_gradient();
if (m_gradient_type != other.m_gradient_type
|| m_repeating != other.m_repeating
|| m_direction != other.m_direction
|| m_color_stop_list.size() != other.m_color_stop_list.size()) {
return false;
}
for (size_t i = 0; i < m_color_stop_list.size(); i++) {
if (m_color_stop_list[i] != other.m_color_stop_list[i])
return false;
}
return true;
return (m_gradient_type == other.m_gradient_type
&& m_repeating == other.m_repeating
&& m_direction == other.m_direction
&& m_color_stop_list == other.m_color_stop_list);
}
float LinearGradientStyleValue::angle_degrees(Gfx::FloatSize const& gradient_size) const
@ -2183,9 +2174,15 @@ void ConicGradientStyleValue::paint(PaintContext& context, Gfx::IntRect const& d
Painting::paint_conic_gradient(context, dest_rect, m_resolved->data, m_resolved->position.to_rounded<int>());
}
bool ConicGradientStyleValue::equals(StyleValue const&) const
bool ConicGradientStyleValue::equals(StyleValue const& other) const
{
return false;
if (type() != other.type())
return false;
auto& other_gradient = other.as_conic_gradient();
return (m_from_angle == other_gradient.m_from_angle
&& m_position == other_gradient.m_position
&& m_color_stop_list == other_gradient.m_color_stop_list
&& m_repeating == other_gradient.m_repeating);
}
float ConicGradientStyleValue::angle_degrees() const