From eb1578e7c8ca52d8de3222ebab16b352b670de4e Mon Sep 17 00:00:00 2001 From: K-Adam Date: Sun, 1 Aug 2021 16:24:59 +0200 Subject: [PATCH] LibWeb: Call before/after children_paint on parent in StackingContext When it is called inside `box.for_each_child`, then it may not be called for the root element. By missing `SVGSVGBox::before_children_paint` the svg context is not created --- Userland/Libraries/LibWeb/Painting/StackingContext.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp index 2559d40d32..0ddc27942f 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp @@ -31,6 +31,9 @@ StackingContext::StackingContext(Box& box, StackingContext* parent) void StackingContext::paint_descendants(PaintContext& context, Node& box, StackingContextPaintPhase phase) { + if (phase == StackingContextPaintPhase::Foreground) + box.before_children_paint(context, PaintPhase::Foreground); + box.for_each_child([&](auto& child) { if (child.establishes_stacking_context()) return; @@ -55,9 +58,7 @@ void StackingContext::paint_descendants(PaintContext& context, Node& box, Stacki case StackingContextPaintPhase::Foreground: if (!child.is_positioned()) { child.paint(context, PaintPhase::Foreground); - child.before_children_paint(context, PaintPhase::Foreground); paint_descendants(context, child, phase); - child.after_children_paint(context, PaintPhase::Foreground); } break; case StackingContextPaintPhase::FocusAndOverlay: @@ -69,6 +70,9 @@ void StackingContext::paint_descendants(PaintContext& context, Node& box, Stacki break; } }); + + if (phase == StackingContextPaintPhase::Foreground) + box.after_children_paint(context, PaintPhase::Foreground); } void StackingContext::paint_internal(PaintContext& context)