瀏覽代碼

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.
Andreas Kling 3 年之前
父節點
當前提交
96db8d64f6
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      Userland/Libraries/LibWeb/Painting/StackingContext.cpp

+ 2 - 1
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);