Repository navigation
Map an element's pixels to the viewport through every transform, in place of size ratios a turn defeats - #6795
Merged
Merged
Conversation
…lace of size ratios a turn defeats Several readings worked out an element's scale as its bounding rect's size over its offset size: what a container shows (`shownBand`), what a sample's frame shows (`frameView`), a region capture's crop of a sample, the drag grip's offset, the prose box, and two render checks, scrollbar clearance and the room in the Layout's shell. A rotation defeats that ratio: a box turned a quarter reads its height across. Under a quarter turn, a dragged card ran about 24,700px off in 12 frames. Each reading now asks element-axes.js. `elementMatrix` composes an element's linear map to the viewport from the transforms and zoom on it and on the boxes around it. `elementBorderFrame` places its border box, `carriedBox` carries a box through the map, and `innerBox` reads a box inside the border box from the browser's own bounding rect, brought in by the insets the frame carries. Where the frame misses a transform the browser draws, such as a motion path or a perspective, the error stays within the border and scrollbar, as it did with the ratio. The clip walk builds each box's map from its parent's, outside in, once per pass. A clip on one axis cuts the window axis its direction lies nearest. A nested SVG viewport clips to its own box, which the ratio read as empty, and SVG is recognised by namespace, across frames. On feature-gallery, thread-panel-gallery, how-it-works and using, at the top and three pages down, every element's `seenRect` matches main within 0.01px, and both render checks return what main returns. New tests cover a turned box's clip, a card carried under a turn, a region capture of a turned sample and what a turned sample reads of its window; the SVG chip test gains a drawing scaled by its viewBox. The landing-scroll fixtures gain the offset sizes a browser always gives a box with client sizes.
leaf-agent
previously approved these changes
Nov 23, 2026
…oxes # Conflicts: # browser/runtime/geometry.js
leaf-agent
reviewed
Nov 23, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
This head conflicts with main in browser/runtime/geometry.js, where #6802 also changed that file, so GitHub runs no PR CI on it and I can't approve it yet. I found nothing to change in the diff itself: the focused render-gate, thread-layout, go-to, sample-visibility and region-capture tests pass on the merge with the old base, as does pnpm run test:runtime. Once the conflict is resolved, the next push gets a fresh review.
…oxes # Conflicts: # browser/runtime/geometry.js
leaf-agent
approved these changes
Nov 23, 2026
This was referenced Nov 23, 2026
leaf-agent
added a commit
that referenced
this pull request
Nov 23, 2026
…for (#6852) `elementMatrix` threw `Failed to execute 'multiply' on 'DOMMatrixReadOnly': The is2D member is set to true but the input matrix is a 3d matrix` whenever a clip walk or margin layout measured an element the browser computes no style for. Such an element is either out of the document (a detached `<lf-tabs>` in the comparison tests) or connected inside a document no window shows (the `.lf-reply-continuity` overlay of `versions/v1.html` in the application-boundary tests). Its computed style reads `""` for every property. `ownTransform` (added in #6795) took `rotate: ""` for a turn and parsed its angle as NaN, so the matrix it returned was all NaN with `is2D` still set. Chrome's `multiply` refuses that matrix, because NaN fails the 3D-member check. A temporary probe in `elementMatrix` captured both cases: the outer matrix was the identity, the own matrix all NaN, and the style tuple `["", "", "", "", ""]`. `ownTransform` now returns null when the computed `display` is empty. An element without a computed style draws no box, so it adds nothing to the map, as its empty bounding rect says. Elements with real transforms are unchanged. Verification: - All four tests from #6847 fail on `main` with this exception and pass with the change. - `pnpm run test:runtime` passes. - #6795's turned-box tests pass: `test_a_turned_box_clips_its_contents_to_its_turned_band` and both cases of `test_a_carried_card_travels_with_the_pointer_when_turned`. Closes #6847 — automated triage Co-authored-by: leaf-agent <[email protected]>
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.
Several readings worked out an element's scale as its bounding rect's size over its offset size: what a container shows (
shownBand), what a sample's frame shows (frameView), a region capture's crop of a sample, the drag grip's offset, the prose box, and the render checks for scrollbar clearance and the room in the Layout's shell. A rotation defeats that ratio, since a box turned a quarter reads its height across; under a quarter turn a dragged card ran about 24,700px off in 12 frames. Each now askselement-axes.js, which composes an element's map to the viewport from every transform and zoom around it (elementMatrix), places its border box (elementBorderFrame) and carries a box through it (carriedBox).Where to look: a container's band starts from the browser's own bounding rect and is brought in by the border and scrollbar the map carries (
innerBox), so where Leaf can't read a transform the browser draws, a motion path or a perspective, the error stays within those insets, as with the ratio.frameView, the capture crop and the grip still convert through the map's inverse, so a sample frame on a motion path is approximate there, as on main. Nested SVG viewports now clip to their own box (main read them as empty) throughviewBoxFit, a port of SVG's equivalent-transform rule. The clip walk builds each box's map from its parent's, once per pass.On four corpus pages, at the top and three pages down, every element's
seenRectmatches main within 0.01px, and both render checks return what main returns.A follow-up to #6771; Max asked for it, and two Codex reviews' findings are folded in. New browser and journey tests cover a turned box's clip, a carried card, a region capture and a sample's view;
pnpm run checkpasses.