mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:08:10 +00:00
LibWeb: Separate layout tree rendering into phases
CSS defines a very specific paint order. This patch starts steering us towards respecting that by introducing the PaintPhase enum with values: - Background - Border - Foreground - Overlay (internal overlays used by inspector) Basically, to get the right visual result, we have to render the page multiple times, going one phase at a time.
This commit is contained in:
parent
abe811104f
commit
cfab53903f
22 changed files with 109 additions and 95 deletions
|
@ -47,17 +47,17 @@ StackingContext::StackingContext(LayoutBox& box, StackingContext* parent)
|
|||
}
|
||||
}
|
||||
|
||||
void StackingContext::render(RenderingContext& context)
|
||||
void StackingContext::render(RenderingContext& context, LayoutNode::PaintPhase phase)
|
||||
{
|
||||
if (!m_box.is_root()) {
|
||||
m_box.render(context);
|
||||
m_box.render(context, phase);
|
||||
} else {
|
||||
// NOTE: LayoutDocument::render() merely calls StackingContext::render()
|
||||
// so we call its base class instead.
|
||||
to<LayoutDocument>(m_box).LayoutBlock::render(context);
|
||||
to<LayoutDocument>(m_box).LayoutBlock::render(context, phase);
|
||||
}
|
||||
for (auto* child : m_children) {
|
||||
child->render(context);
|
||||
child->render(context, phase);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue