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.
This commit is contained in:
Andreas Kling 2022-03-20 13:29:01 +01:00
parent 159d4d772a
commit 96db8d64f6
Notes: sideshowbarker 2024-07-17 17:03:35 +09:00

View file

@ -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);