From 9a90bf7d12de1831cf4c8d162e0c90e35430b041 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Thu, 27 Jul 2023 04:36:45 +0200 Subject: [PATCH] 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 --- .../Libraries/LibWeb/Painting/ShadowPainting.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibWeb/Painting/ShadowPainting.cpp b/Userland/Libraries/LibWeb/Painting/ShadowPainting.cpp index f273dd0c2c..32c2264ff8 100644 --- a/Userland/Libraries/LibWeb/Painting/ShadowPainting.cpp +++ b/Userland/Libraries/LibWeb/Painting/ShadowPainting.cpp @@ -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 {