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

LibWeb: Hang StackingContext off of the paint boxes

Stacking contexts have nothing to do with layout and everything with
painting, so let's keep them in Painting::Box.
This commit is contained in:
Andreas Kling 2022-03-10 10:38:13 +01:00
parent cc8e429126
commit 9f5cbcaad3
10 changed files with 39 additions and 38 deletions

View file

@ -217,21 +217,6 @@ bool Box::is_body() const
return dom_node() && dom_node() == document().body();
}
Painting::StackingContext* Box::enclosing_stacking_context()
{
for (auto* ancestor = parent(); ancestor; ancestor = ancestor->parent()) {
if (!is<Box>(ancestor))
continue;
auto& ancestor_box = verify_cast<Box>(*ancestor);
if (!ancestor_box.establishes_stacking_context())
continue;
VERIFY(ancestor_box.stacking_context());
return ancestor_box.stacking_context();
}
// We should always reach the Layout::InitialContainingBlock stacking context.
VERIFY_NOT_REACHED();
}
void Box::before_children_paint(PaintContext& context, Painting::PaintPhase phase)
{
NodeWithStyleAndBoxModelMetrics::before_children_paint(context, phase);