LibWeb: Implement partial layout tree updates

DOM nodes now have two additional flags:

- Needs layout tree update
- Child needs layout tree update

These work similarly to the needs-style-update flags, but instead signal
the need to rebuild the corresponding part of the layout tree.

When a specific DOM node needs a layout tree update, we try to create
a new subtree starting at that node, and then replace the subtree in the
old layout tree with the newly created subtree.

This required some refactoring in TreeBuilder so that we can skip over
entire subtrees during a tree update.

Note that no partial updates happen yet (as of this commit) since we
always invalidate the full layout tree still. That will change in the
next commit.
This commit is contained in:
Andreas Kling
2025-01-13 12:23:40 +01:00
committed by Andreas Kling
parent b41a490e40
commit c01d810e5a
6 changed files with 152 additions and 59 deletions

View File

@@ -502,6 +502,9 @@ public:
bool needs_full_style_update() const { return m_needs_full_style_update; }
void set_needs_full_style_update(bool b) { m_needs_full_style_update = b; }
[[nodiscard]] bool needs_full_layout_tree_update() const { return m_needs_full_layout_tree_update; }
void set_needs_full_layout_tree_update(bool b) { m_needs_full_layout_tree_update = b; }
void set_needs_to_refresh_scroll_state(bool b);
bool has_active_favicon() const { return m_active_favicon; }
@@ -936,6 +939,7 @@ private:
bool m_needs_layout { false };
bool m_needs_full_style_update { false };
bool m_needs_full_layout_tree_update { false };
bool m_needs_animated_style_update { false };