diff --git a/Userland/Libraries/LibWeb/Painting/PaintingCommandExecutorGPU.cpp b/Userland/Libraries/LibWeb/Painting/PaintingCommandExecutorGPU.cpp index bcc9dca56c..08384fda2b 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintingCommandExecutorGPU.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintingCommandExecutorGPU.cpp @@ -90,24 +90,32 @@ CommandResult PaintingCommandExecutorGPU::set_font(Gfx::Font const&) return CommandResult::Continue; } -CommandResult PaintingCommandExecutorGPU::push_stacking_context(float opacity, bool is_fixed_position, Gfx::IntRect const& source_paintable_rect, Gfx::IntPoint post_transform_translation, CSS::ImageRendering, StackingContextTransform, Optional) +CommandResult PaintingCommandExecutorGPU::push_stacking_context(float opacity, bool is_fixed_position, Gfx::IntRect const& source_paintable_rect, Gfx::IntPoint post_transform_translation, CSS::ImageRendering, StackingContextTransform transform, Optional) { painter().save(); if (is_fixed_position) { auto const& translation = painter().transform().translation(); painter().translate(-translation); } + + auto affine_transform = Gfx::extract_2d_affine_transform(transform.matrix); + if (opacity < 1) { auto painter = AccelGfx::Painter::create(); auto canvas = AccelGfx::Canvas::create(source_paintable_rect.size()); painter->set_target_canvas(canvas); painter->translate(-source_paintable_rect.location().to_type()); + + auto source_rect = source_paintable_rect.to_type().translated(-transform.origin); + auto transformed_destination_rect = affine_transform.map(source_rect).translated(transform.origin); + auto destination_rect = transformed_destination_rect.to_rounded(); + stacking_contexts.append({ .canvas = canvas, .painter = move(painter), .opacity = opacity, - .destination = source_paintable_rect }); + .destination = destination_rect }); } else { - painter().translate(post_transform_translation.to_type()); + painter().translate(affine_transform.translation() + post_transform_translation.to_type()); } return CommandResult::Continue; }