LibWeb: Build stacking context tree lazily

There's no actual need to build the stacking context tree before
performing layout. Instead, make it lazy and build the tree when it's
actually needed for something.

This avoids a bunch of work in situations where multiple synchronous
layouts are forced (typically by JavaScript) without painting or hit
testing taking place in between.

It also opens up for style invalidations that only target the stacking
context tree.
This commit is contained in:
Andreas Kling 2022-03-21 10:56:02 +01:00
commit 59afdb959f
Notes: sideshowbarker 2024-07-17 17:00:08 +09:00
5 changed files with 23 additions and 8 deletions

View file

@ -585,8 +585,6 @@ void Document::update_layout()
root_formatting_context.run(*m_layout_root, Layout::LayoutMode::Normal);
formatting_state.commit();
m_layout_root->build_stacking_context_tree();
browsing_context()->set_needs_display();
if (browsing_context()->is_top_level()) {