LibWeb/Layout: Properly remove layout nodes
Some checks are pending
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

This properly remove the old layout node subtree when no new layout
node is created during layout update.
This commit is contained in:
Glenn Skrzypczak 2025-03-26 19:14:14 +01:00 committed by Alexander Kalenik
parent 24e2c402f5
commit 1022566bff
Notes: github-actions[bot] 2025-03-31 17:20:51 +00:00
2 changed files with 23 additions and 0 deletions

View file

@ -448,6 +448,10 @@ void TreeBuilder::update_layout_tree(DOM::Node& dom_node, TreeBuilder::Context&
dom_node.for_each_in_inclusive_subtree([&](auto& node) {
node.set_needs_layout_tree_update(false);
node.set_child_needs_layout_tree_update(false);
auto layout_node = node.layout_node();
if (layout_node && layout_node->parent()) {
layout_node->remove();
}
node.detach_layout_node({});
node.clear_paintable();
if (is<DOM::Element>(node))

View file

@ -0,0 +1,19 @@
<html class="test-wait">
<body>
<div aria-owns="id1"></div>
<video>
<mark>
<span id='id1'></span>
</mark>
</video>
</body>
<script>
window.onload = () => {
requestAnimationFrame(() => {
requestAnimationFrame(() => {
document.documentElement.style.display = 'none';
document.documentElement.className = '';
});
});
}
</script>