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

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
parent 0e78037c68
commit d9c842a83f

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;