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

LibWeb: Paint an element's foreground before painting its children

The current implementation is missing the emphasized text of the
following rule in the painting order spec:

    7. Otherwise: *first for the element*, then for all its in-flow,
       non-positioned, block-level descendants in tree order...

This ensures the foreground is painted for the current element before
descending into its children.
This commit is contained in:
Timothy Flynn 2021-05-11 09:40:47 -04:00 committed by Andreas Kling
parent ecdb6a11b7
commit 227ccfc61a

View file

@ -85,6 +85,7 @@ void StackingContext::paint(PaintContext& context)
// Draw the non-positioned floats (step 5)
paint_descendants(context, m_box, StackingContextPaintPhase::Floats);
// Draw inline content, replaced content, etc. (steps 6, 7)
m_box.paint(context, PaintPhase::Foreground);
paint_descendants(context, m_box, StackingContextPaintPhase::Foreground);
// Draw other positioned descendants (steps 8, 9)
for (auto* child : m_children) {