1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:38:12 +00:00

LubWeb: Call before_children_paint for positioned descendants

Add before_children_paint and after_children_paint calls for
positioned descendants with z-index: auto during painting
This commit is contained in:
Aliaksandr Kalenik 2022-11-12 17:45:48 +03:00 committed by Andreas Kling
parent f3d57e1157
commit adf0262b54

View file

@ -177,6 +177,10 @@ void StackingContext::paint_internal(PaintContext& context) const
// At this point, `paint_box` is a positioned descendant with z-index: auto
// but no stacking context of its own.
// FIXME: This is basically duplicating logic found elsewhere in this same function. Find a way to make this more elegant.
auto parent = paint_box.layout_node().parent();
auto* paintable = parent ? parent->paintable() : nullptr;
if (paintable)
paintable->before_children_paint(context, PaintPhase::Foreground);
paint_node(paint_box.layout_box(), context, PaintPhase::Background);
paint_node(paint_box.layout_box(), context, PaintPhase::Border);
paint_descendants(context, paint_box.layout_box(), StackingContextPaintPhase::BackgroundAndBorders);
@ -187,6 +191,8 @@ void StackingContext::paint_internal(PaintContext& context) const
paint_node(paint_box.layout_box(), context, PaintPhase::FocusOutline);
paint_node(paint_box.layout_box(), context, PaintPhase::Overlay);
paint_descendants(context, paint_box.layout_box(), StackingContextPaintPhase::FocusAndOverlay);
if (paintable)
paintable->after_children_paint(context, PaintPhase::Foreground);
return TraversalDecision::Continue;
});