LibWeb: Enable partial layout tree update in a bunch of cases

These common cases now cause us to invalidate the layout tree starting
at the relevant parent node instead of invalidating the entire tree.

- DOM node insertion
- DOM node removal
- innerHTML setter
- textContent setter

This makes a lot of dynamic content much faster. For example, demos
on shadertoy.com go from ~18 fps to ~28 fps on my machine.
This commit is contained in:
Andreas Kling 2025-01-16 00:44:35 +01:00 committed by Andreas Kling
commit e5d521bef8
Notes: github-actions[bot] 2025-01-18 20:01:59 +00:00
2 changed files with 5 additions and 6 deletions

View file

@ -808,7 +808,7 @@ WebIDL::ExceptionOr<void> Element::set_inner_html(StringView value)
if (context->is_connected()) {
// NOTE: Since the DOM has changed, we have to rebuild the layout tree.
context->document().invalidate_layout_tree();
context->set_needs_layout_tree_update(true);
}
}