Seed SVG partial relayout root from fragments tree - #11125
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughPartial relayout now passes layout roots without old paintables. Boundary selection uses Sequence Diagram(s)sequenceDiagram
participant Document
participant LayoutRustBridge
participant FormattingContext
participant LayoutNodeArena
participant CommitSink
Document->>LayoutRustBridge: relayout subtree root
LayoutRustBridge->>FormattingContext: compute layout(root)
FormattingContext->>LayoutNodeArena: restore saved committed geometry
FormattingContext->>CommitSink: commit replacement(root)
CommitSink->>CommitSink: resolve and replace paintable
Merge Risk: ⚪ Minimal · up to This change is merge-ready after normal checks and review; no actionable merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Partial relayout of an SVG root seeds the pass by reading the previous paintable's committed geometry back through an FFI callback, which is the one place layout still consumes the paint tree. Record the same scalars in a generation-checked arena side table instead, captured during the commit walk straight from the SVG root's fragment link, following the saved-abspos-layout-inputs pattern: a presence flag on NodeData keeps the table and flags consistent, free() wipes the slot, and the tree builder carries the entry to the replacement box when an SVG root is rebuilt in place. Nothing reads the table yet; switching the subtree-relayout seed over comes next.
Switch the subtree-relayout seed for in-flow SVG roots from the read_paintable_geometry callback to the arena side table the previous commit introduced, so the seed no longer reads the old paint tree. The in-flow SVG arm of is_partial_relayout_boundary now also requires the saved-geometry flag, which moves the "has this root ever committed" check from boundary collection time to registration time: an SVG root that never committed refuses registration up front and lets the invalidation reach an outer boundary, instead of aborting the whole partial attempt at collect time, so partial-vs-full pass counts can shift for such roots. The old paintable handed to the pass entry is now used only as the commit splice target.
Nothing reads it since the partial relayout seed switched to the arena side table; this removes the last geometry read-back from Rust layout into the paint tree. FfiPaintableGeometry stays on as the side table's payload type.
The paintable a partial relayout replaces was resolved during boundary collection and threaded through every layer down to begin_commit, which could already resolve it from the commit root on its own. Do that: begin_commit takes the root's paintable and falls back to the one the DOM node still references (and the paint tree keeps alive) when the tree builder rebuilt the root's box, and the paintable parameter disappears from relayout_subtree, the bridge entry points, the Rust pass entries, and drain_and_commit_entry_pass. The splice-target existence requirement folds into is_partial_relayout_boundary as the same paintable-or-DOM-referenced check, replacing the RequireExistingPaintable knob: the rebuilt-box caller that passed No qualifies through the DOM-referenced arm, and registration-time callers now also accept a box whose old paintable only survives through its DOM node, which collection previously had to re-discover.
3c8c29a to
72f599d
Compare
ba71d78
into
LadybirdBrowser:master
This is a step towards deprecating paintable tree to replace it with fragments tree