LibWeb: Update HTMLSlotElement subtree during partial layout tree build

Before this change, the layout tree for slots was only updated after
creating a layout node for the slot itself. This was not enough to
account for partial layout tree rebuilds when the slot content changed.
With this change, we always recurse into the slot content.

Fixes expanding and collapsing of nodes in DOM tree inspector broken in
9b26f7eb0f
This commit is contained in:
Aliaksandr Kalenik 2025-03-12 22:57:26 +01:00 committed by Jelle Raaijmakers
commit 76aa99a626
Notes: github-actions[bot] 2025-03-13 03:30:24 +00:00
3 changed files with 60 additions and 15 deletions

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<head>
<style>
details {
margin: 10px 0;
padding: 10px;
background-color: magenta;
}
details details {
background-color: mediumaquamarine;
margin-left: 20px;
}
</style>
<script src="../include.js"></script>
</head>
<body>
<details id="outer-details"><summary>outer title</summary>
<div>outer title</div>
<details id="inner-details">
<summary>inner title</summary>
<p id="nested-details-content">inner content</p>
</details>
</details>
</body>
<script>
test(() => {
const nestedDetailsContent = document.getElementById('nested-details-content');
println(nestedDetailsContent.getBoundingClientRect().width);
const outerDetails = document.getElementById('outer-details');
outerDetails.open = true;
println(nestedDetailsContent.getBoundingClientRect().width);
const innerDetails = document.getElementById('inner-details');
innerDetails.open = true;
println(nestedDetailsContent.getBoundingClientRect().width);
});
</script>
</html>