Skip to content

Seed SVG partial relayout root from fragments tree - #11125

Merged
kalenikaliaksandr merged 4 commits into
LadybirdBrowser:masterfrom
kalenikaliaksandr:arena-seeded-svg-root-relayout
Aug 14, 2026
Merged

Seed SVG partial relayout root from fragments tree#11125
kalenikaliaksandr merged 4 commits into
LadybirdBrowser:masterfrom
kalenikaliaksandr:arena-seeded-svg-root-relayout

Conversation

@kalenikaliaksandr

Copy link
Copy Markdown
Member

This is a step towards deprecating paintable tree to replace it with fragments tree

@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4ad099c3-fd7e-439b-9294-76b1a3667bf1

📥 Commits

Reviewing files that changed from the base of the PR and between 3c8c29a and 72f599d.

📒 Files selected for processing (1)
  • Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • Libraries/LibWeb/Rust/src/layout/layout_node_arena.rs

📝 Walkthrough

Walkthrough

Partial relayout now passes layout roots without old paintables. Boundary selection uses Layout::Box* values and saved committed geometry. The Rust layout arena stores this geometry with generation validation and preserves it across SVG root replacement. Subtree layout and absolute-position replay restore geometry through callbacks. Commit replacement resolves the replacement paintable from the root and commit sink.

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
Loading

Merge Risk: ⚪ Minimal · up to 72f59

This change is merge-ready after normal checks and review; no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description directly relates to the changes, which advance replacing the paintable tree with the fragments tree.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.
@kalenikaliaksandr
kalenikaliaksandr force-pushed the arena-seeded-svg-root-relayout branch from 3c8c29a to 72f599d Compare August 14, 2026 12:43
@kalenikaliaksandr
kalenikaliaksandr enabled auto-merge (rebase) August 14, 2026 12:59
@kalenikaliaksandr
kalenikaliaksandr merged commit ba71d78 into LadybirdBrowser:master Aug 14, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant