From 96db8d64f66b38cc7f8956ee19769b7428bf783b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 20 Mar 2022 13:29:01 +0100 Subject: [PATCH] LibWeb: Include entire border box when painting stacking context layer For stacking contexts that have opacity between 0 and 1, and also contexts with a 2D transform, we first paint them into a temporary layer buffer. Then we blend that buffer with the contents in one go. Before this patch, we were only drawing the content box of the stacking context into this layer buffer, which led to padding and borders missing from elements painted this way. --- Userland/Libraries/LibWeb/Painting/StackingContext.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp index 808b3fc315..844e91c7e9 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp @@ -263,7 +263,8 @@ void StackingContext::paint(PaintContext& context) const // FIXME: Use the transform origin specified in CSS or SVG auto transform_origin = m_box.paint_box()->absolute_position(); - auto source_rect = m_box.paint_box()->absolute_rect().translated(-transform_origin); + auto source_rect = m_box.paint_box()->absolute_border_box_rect().translated(-transform_origin); + auto transformed_destination_rect = affine_transform.map(source_rect).translated(transform_origin); source_rect.translate_by(transform_origin); context.painter().draw_scaled_bitmap(Gfx::rounded_int_rect(transformed_destination_rect), *bitmap, source_rect, opacity, Gfx::Painter::ScalingMode::BilinearBlend);