LibWeb: Skip positioned children in paint_descendants()

Positioned descendants are now handled entirely by paint_internal()
so we can just skip over positioned children in paint_descendants().
This avoids drawing the same boxes multiple times.
This commit is contained in:
Andreas Kling 2022-10-23 23:31:08 +02:00
parent 8bf0e71c0c
commit 8aab33de5f
Notes: sideshowbarker 2024-07-17 06:51:40 +09:00

View file

@ -78,6 +78,13 @@ void StackingContext::paint_descendants(PaintContext& context, Layout::Node cons
// If `child` establishes its own stacking context, skip over it.
if (is<Layout::Box>(child) && child.paintable() && static_cast<Layout::Box const&>(child).paint_box()->stacking_context())
return;
// If `child` is positioned with a z-index of `0` or `auto`, skip over it.
if (child.is_positioned()) {
auto const& z_index = child.computed_values().z_index();
if (!z_index.has_value() || z_index.value() == 0)
return;
}
bool child_is_inline_or_replaced = child.is_inline() || is<Layout::ReplacedBox>(child);
switch (phase) {
case StackingContextPaintPhase::BackgroundAndBorders: