LibWeb: Set radial gradients' ending shape corners correctly

Previously, the corner was always set to the top right, except if the
top left turned out to be closest, in which case it would be left
default-initialized instead.
This commit is contained in:
Zaggy1024 2023-09-01 17:23:28 -05:00 committed by Alexander Kalenik
commit d9c842a83f
Notes: sideshowbarker 2024-07-18 03:35:30 +09:00

View file

@ -85,16 +85,17 @@ Gfx::FloatSize RadialGradientStyleValue::resolve_size(Layout::Node const& node,
auto bottom_right_distance = size.bottom_right().distance_from(center);
auto bottom_left_distance = size.bottom_left().distance_from(center);
auto distance = top_left_distance;
corner = size.top_left();
if (distance_compare(top_right_distance, distance)) {
corner = size.top_right();
distance = top_right_distance;
}
if (distance_compare(bottom_right_distance, distance)) {
corner = size.top_right();
corner = size.bottom_right();
distance = bottom_right_distance;
}
if (distance_compare(bottom_left_distance, distance)) {
corner = size.top_right();
corner = size.bottom_left();
distance = bottom_left_distance;
}
return distance;