1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:07:46 +00:00

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
This commit is contained in:
K-Adam 2021-08-01 16:24:59 +02:00 committed by Andreas Kling
parent 566702ffa2
commit eb1578e7c8

View file

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