LibWeb: Fix calculation of bitmap size in paint_outer_box_shadow

Correctly compute the maximum possible width and height for
shadow_bitmap_rect by considering all pair combinations of corners.

Fixes https://github.com/SerenityOS/serenity/issues/20205
This commit is contained in:
Aliaksandr Kalenik 2023-07-27 04:36:45 +02:00 committed by Andreas Kling
parent 72e959d753
commit 9a90bf7d12

View file

@ -172,13 +172,17 @@ static void paint_outer_box_shadow(PaintContext& context, CSSPixelRect const& co
auto shadow_bitmap_rect = DevicePixelRect(
0, 0,
max(
top_left_corner_size.width() + top_right_corner_size.width(),
bottom_left_corner_size.width() + bottom_right_corner_size.width())
max(max(
top_left_corner_size.width() + top_right_corner_size.width(),
bottom_left_corner_size.width() + bottom_right_corner_size.width()),
max(top_left_corner_size.width() + bottom_right_corner_size.width(),
bottom_left_corner_size.width() + top_right_corner_size.width()))
+ 1 + blurred_edge_thickness,
max(
top_left_corner_size.height() + bottom_left_corner_size.height(),
top_right_corner_size.height() + bottom_right_corner_size.height())
max(max(
top_left_corner_size.height() + bottom_left_corner_size.height(),
top_right_corner_size.height() + bottom_right_corner_size.height()),
max(top_left_corner_size.height() + bottom_right_corner_size.height(),
bottom_left_corner_size.height() + top_right_corner_size.height()))
+ 1 + blurred_edge_thickness);
auto top_left_corner_rect = DevicePixelRect {