Repository navigation
feat(core): paint a sealed preview's drag chrome in the same frame as the layer - #8961
Open
miguel-heygen wants to merge 5 commits into
Open
miguel-heygen wants to merge 5 commits into
miguel-heygen wants to merge 5 commits into
Conversation
2 of 4 tasks
Contributor
Edit accuracy: accurate 273 (base branch 271), smooth 73 of thoseThe gate passes. Newly passing (2)
Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)
Quarantined, measured but not gated (0) Unstable (1)
|
Collaborator
Author
|
Correction to the test plan, as of
|
Collaborator
Author
|
Two additions to the description, as of
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A sealed preview can now paint Studio's selection chrome itself, in the same turn as the gesture draft that moves the layer. Studio sends a copy of its own chrome (structured data, never markup) with a drag's first draft, then only each node's placement with every later draft. The frame builds the copy in a closed shadow root on one marked host under
<html>, and removes the host when the drag ends.Nothing sends chrome yet: Studio's half follows in a separate PR. Until then this path is inert.
Why
In stock Chrome a sealed preview renders out of process, so Studio's outline and the dragged layer are two compositor surfaces that Viz shows independently. Even with Studio writing its outline in the move event (0 frames late), the frame's surface for step N+1 is shown with Studio's surface for step N. On the 4x CPU bench, outline minus layer sits at +0.68 to +1.09 steps per drag on a sealed preview and 0.00 on an open one. Only a chrome the frame paints itself can share the layer's compositor frame.
Related work
Refs the selection-chrome lag work in #8909, #8919, #8921, #8931 and the raw-step drafts in #8912.
How
runtime/editing/dragChrome.ts(new):parseDragChromechecks the copy, anddrawDragChromemounts, places or clears it. The copy may only usediv,span,svgandpath, SVG geometry attributes, and style maps whose names are CSS properties. A value that would make the frame fetch (url(,image(,image-set(,src() is refused. Caps: 64 nodes, depth 6, 32 KB of nodes, 48 properties per map, 512 characters per value. An over-cap copy fails the request's validation.<div data-hf-ignore data-hyperframes-ignore data-hyperframes-picker-ignore data-layout-ignore aria-hidden>, marked like the paused-frame canvas (pausedVideoFrames.tsmarkFrameCanvas), withall:initial; position:fixed; inset:0; pointer-events:none. Every chrome node is forced topointer-events: none !important. The copy maps overlay px to frame px with one transform:scale(1/s) translate(-origin).runtime/editingPort.ts: thedraftrequest takes an optionalchrome(null clears it). A request that carries chrome may name no draft.runtime/editingDraft.ts:drawDrafts(drafts, chrome)draws the chrome after the drafts in the same call. When no chrome comes and the last live draft ends, the chrome is cleared, so a cancel can never leave it behind.editingAgent.tsalso clears it when the agent is disposed.Every frame-side reader of the document, checked against the host:
editing/documentMarkup.ts(documentElement.outerHTML)withoutDragChrome), and put back in the same turneditingHandles.tsqueryElements,readEveryMatch(document.querySelectorAll)editingAgent.tscomputed-stylesandediting/motionPathHome.ts(document.querySelector)<body>editingLayers.ts:102,editingGestureStart.ts:238<html>editing/maxZIndex.ts,editing/stageMeasure.tsdocument.bodysceneWindow.ts(host.outerHTMLof scene hosts)<body>picker.ts[data-hf-ignore]elements-at-point,pointer-targets(elementsFromPoint)pointer-events: none<html>(init.ts,preloadMedia.ts,sealedMediaCors.ts,previewRasterHints.ts,frameSources.ts,staticCompositionPost.ts,editing/stageAct.ts)editing/textEdit.tsremoval observerEvery Studio reader of a sealed frame's document goes through
document-markup(previewChannel.tspreviewDocumentMarkup/previewDocumentCopy): the property panel, clipboard, GSAP reads (gsapShared.ts), timing patches, audio-group volume, automation sync, the timeline header and sync callbacks, and first-frame telemetry. All of them get the stripped markup.Renders: chrome only arrives over the editing port, and the port is only handed to a parent that connects to a page marked for Studio (
editingAgent.tsinstallEditingAgent). A render page is its own top window and carries no Studio mark.Test plan
Proof: 4x bench pending. The bench run (outline minus layer per drag, sealed and open, at 4x CPU) lands with the Studio PR's numbers.
fails without the fix:
editing/dragChrome.test.ts"is drawn in the same call as the draft it rides, at the step's place, mapped into frame px" fails with thedrawDragChromecall removed fromdrawDrafts.withoutDragChromeremoved fromdocumentMarkup, and again with the query skip removed (expected [ …(2) ] to have a length of 1 but got 2).pointer-eventsoverride and the chrome-only request each fail their assertion when removed.producer/src/services/coreRuntimeBrowser.test.ts"hands a render page no editing port, so it never paints drag chrome" (real Chrome, built runtime) fails with the agent's top-window and Studio-mark checks removed (expected [ 'editing-connect', …(2) ] to not include 'editing-port').Three runs of the touched core files (
dragChrome,editingDraft,editingDraftRestore,editingPort,editingAgent,editingHandles,gsapSet,patchTween): 281/281 each. Fullpackages/core/src/runtime: 3860/3860 on current main.coreRuntimeBrowser.test.ts: 94/94.tsc --noEmit,oxlint,oxfmt,fallowclean.