Repository navigation
fix(studio): a sealed drag's outline moves in the same frame as the layer - #8962
miguel-heygen wants to merge 7 commits into
Conversation
terencecho
left a comment
There was a problem hiding this comment.
[P2] Give the outline back to Studio if a later chrome copy fails validation (packages/studio/src/components/editor/frameDragChrome.ts:154). After a successful mounted draft, Studio clips out the part over the frame. If a later DOM copy exceeds the wire limit, read() omits chrome, so the layer still moves but the frame keeps painting the old outline and Studio stays clipped. I reproduced this by starting a sealed drag, waiting for the clip, then growing the chrome tree past the limit before the next draft. Restore the full Studio outline and clear the old frame copy on this transition while allowing the draft through.
All 21 focused tests passed. The added stand-in case reproduced the stale outline. The PR body still lists the 4× compositor benchmark as pending, so the measured parity claim is unverified.
— tai (automated review)
|
Fixed in
The 4x bench proof is still pending. It will come as a comment here. |
What
On a sealed preview, the selection outline now moves in the same frame as the layer you drag. Studio hands its outline to the frame for the length of the drag, keeps only the part that lies outside the frame, and takes it back on release.
Stacked on #8961 (the frame side). Review that one first.
Why
In stock Chrome a sealed preview renders out of process, so Studio's outline and the dragged layer are two compositor surfaces shown independently. Since #8912 the layer's step reaches the frame before Studio's next frame, so the outline shows the step before. On the 4x CPU bench, outline minus layer sits at +0.68 to +1.09 steps per drag sealed and 0.00 open. Only an outline the frame paints in the same turn as the layer can share its compositor frame.
Related work
Refs #8909, #8919, #8921, #8931, #8912.
How
frameDragChrome.ts(new):paintChromeInFrameWhile(iframe, overlay, held)starts with a sealed drag's raw steps. With the first draft it sends a copy of Studio's chrome as structured data: tag (div,span,svg,path), the computed look, SVG geometry attributes. With every later draft it sends only each node's inline placement. The copy is checked with the core's ownparseDragChromebefore it rides a request, so a copy the frame would refuse never takes the drafts down with it, and Studio simply keeps its whole chrome.clip-path: path(evenodd, ...)), so the part over the stage is painted only by the frame. The part outside the stage (handles past the edge, the box when the layer hangs off stage) stays Studio's.previewDrafts.ts: the draft queue carries the chrome on each request it already sends (microtask-batched, one in flight). No extra message per step.gestureSteps.ts: the raw step now moves Studio's outline (single box, and group members plus group box) before the draft goes out, so the frame copies this step's outline, not the last one.DomEditSelectionChrome.tsx: the selection and group chrome render inside one plane element (data-dom-edit-chrome-plane) that the clip applies to.pointer-events: none), and saves, history, captures and stage reads never see it (see the core PR).Not covered here:
Test plan
Proof: 4x bench pending. The close bar: outline minus layer at most 0.1 per drag sealed, and pooled outline vs pointer no worse than open, at 4x CPU; the off-stage part's lag measured on its own. Numbers and Before/After captures land here when the run is done.
fails without the fix:
frameDragChrome.test.ts"is painted by the frame with each draft at that step's place, and Studio keeps only what is outside" (sealed frame with the real agent) fails withcarryPreviewDraftChromeremoved, with the clip removed, and with the release clear removed.parseDragChromecheck removed.endPreviewDraftChrome.sealedRawDragStep.test.tsraw-step outline cases fail with the outline writes removed fromdrawGestureStepand the group raw step.On current main:
packages/studioeditor and player folders 5087 passed; the touched test files 3 runs in a row;tsc --noEmit,oxlint,oxfmt,fallowclean.