display: contents via a container query
Same ToT content_shell binary, same repro HTML, sandbox off,
headless. For before the fix commit was reverted with
git reset --hard HEAD~1 and the shell rebuilt. Captured on Linux
(Debian bookworm, X11). Platforms other than Linux Blink may not hit this path:
the bug is in a Linux-observed ordering of the top-layer OOF walk and style
reattach; macOS/Windows have not been confirmed to reproduce. The raw crash
log is at crash.log.
<div id="outer" popover="manual"
style="container-type: inline-size; width: 600px">
<div id="wrap">
<div id="inner" popover="manual">inner</div>
</div>
</div>
<style>
@container (width >= 500px) { #wrap { display: contents; } }
</style>
<script>
outer.showPopover();
inner.showPopover();
</script>
OutOfFlowLayoutPart::Run()'s root top-layer loop walks
LayoutView's children with FirstChild()/NextSibling().
Laying out a top-layer size container triggers an interleaved style and
layout-tree rebuild that destroys an earlier top-layer sibling's already-added
fragment and inserts a fresh un-laid-out LayoutBox for it
before the cursor. The forward-only walk never revisits it; paint
dereferences a fragment pointing at a destroyed LayoutObject.
Loop the scan until no new top-layer box is laid out (HeapHashSet
of handled boxes) and prune children with destroyed LayoutObjects
from the FragmentBuilder between passes. WPT crashtest added.