From 89fd8dfaaddda76e3ec1a0fda0f5cb901a2f3147 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Tue, 5 Dec 2023 22:26:13 +0100 Subject: [PATCH] LibWeb: Fix duplicated clip overflow in child stacking contexts `StackingContext::paint_child()` does not have to clip overflow because callers of this method already do that. --- .../Libraries/LibWeb/Painting/StackingContext.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp index 7a2c90e897..d4ef5a37f4 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp @@ -181,17 +181,11 @@ void StackingContext::paint_child(PaintContext& context, StackingContext const& auto parent_paintable = child.paintable_box().parent(); if (parent_paintable) parent_paintable->before_children_paint(context, PaintPhase::Foreground); - auto containing_block = child.paintable_box().containing_block(); - auto* containing_block_paintable = containing_block ? containing_block->paintable() : nullptr; - if (containing_block_paintable) - containing_block_paintable->apply_clip_overflow_rect(context, PaintPhase::Foreground); child.paint(context); if (parent_paintable) parent_paintable->after_children_paint(context, PaintPhase::Foreground); - if (containing_block_paintable) - containing_block_paintable->clear_clip_overflow_rect(context, PaintPhase::Foreground); } void StackingContext::paint_internal(PaintContext& context) const @@ -259,8 +253,14 @@ void StackingContext::paint_internal(PaintContext& context) const for (auto* child : m_children) { if (!child->paintable_box().is_positioned()) continue; + auto containing_block = child->paintable_box().containing_block(); + auto const* containing_block_paintable = containing_block ? containing_block->paintable() : nullptr; + if (containing_block_paintable) + containing_block_paintable->apply_clip_overflow_rect(context, PaintPhase::Foreground); if (child->paintable_box().computed_values().z_index().has_value() && child->paintable_box().computed_values().z_index().value() >= 1) paint_child(context, *child); + if (containing_block_paintable) + containing_block_paintable->clear_clip_overflow_rect(context, PaintPhase::Foreground); } paint_node(paintable_box(), context, PaintPhase::Outline);