[layout box merge] Layout boxes as private bases of renderers (refactor)
Component: WebCore layout | cd25d8a
Source/WebCore/layout/integration/LayoutIntegrationBoxTreeUpdater.cpp
Source/WebCore/layout/integration/LayoutIntegrationBoxTreeUpdater.cpp
Since WebKit's LFC (Layout Formatting Context) integration, inline and grid formatting contexts have run on a separate Layout::Box tree that BoxTreeUpdater built from the render tree, copying style and text and keeping both in sync, while line layouts held references into that box tree. This commit makes Layout::ElementBox and Layout::InlineTextBox private bases of RenderElement and RenderText: every renderer is its own layout box, box navigation reads render-tree links directly, RenderObject::layoutBox() is never null, and null checks give way to isInLiveFormattingContext() / isLaidOutByIntegration() flags on the formatting-context root box.
Significance
Release arm64 element renderer+box shrinks from 304 to 176 bytes and text renderer+box from 256 to 208, removing a whole parallel tree and its sync logic. Element renderers outside inline or grid contexts grow by 24 bytes, and the security-relevant shift is that any stale reference to a box is now a stale reference to a renderer.
Audit directions
Narrow: the renderer-to-box conversion goes through a private base with a memory-unsafe-cast suppression, and fromLayoutBox() computes the same offset in both arms, so correctness rests on the caller's type invariant — check every Box-to-RenderElement/RenderText conversion, especially the initial containing block, the one standalone ElementBox that is not a renderer. Renderer and box now have separate CheckedPtr counters, both checked at deletion; look for holders keeping a Layout::Box reference past renderer destruction. Wider: the commit says some removal paths now destroy the line layout referring to the box (invalidateLineLayout, destroyLineLayoutReferringTo, detachFromRenderElement, dropAnonymousBoxChild); audit the other removal and re-parenting paths for the same gap — first-letter, list markers, slot reassignment, iframe/replaced content in inline contexts, the RenderButton inner renderer, RenderListBox/RenderMenuList. Missed updates to the live-context flags in LineLayout/GridLayout constructors and destructors would make dead content look live, and style now lives in the box, so check reads after willBeDestroyed. The included tests are no-crash only, so fuzz DOM removal, display:none, slot changes and mixed replaced content with immediate renderer destruction on and off.