LibWeb: Retain display: contents in ancestor stack for continuations

When restructuring inline nodes because of a block element insertion
during the layout tree build, we might end up with a `display: contents`
element in the ancestor stack that is not part of the actual layout
tree, since it's never actually used as a parent for any node. Because
we were only rewinding the ancestor stack with actual new layout nodes,
it became corrupted and layout nodes were added to the wrong parent.

This new logic leaves the ancestor stack intact, only replacing layout
nodes whenever a new one is created.

Fixes the sidebar on https://reddit.com.
Fixes #3590.
This commit is contained in:
Jelle Raaijmakers 2025-02-18 16:51:38 +01:00 committed by Jelle Raaijmakers
commit de7ca7b157
Notes: github-actions[bot] 2025-02-18 22:32:41 +00:00
3 changed files with 13 additions and 12 deletions

View file

@ -18,5 +18,7 @@
<b>foo</b><div><b>bar</b></div><b>baz</b>
<hr>
<span>foo</span><div>bar</div>
<hr>
<b>foo</b><div><b>bar</b></div><b>baz</b>
</body>
</html>