Skip to content

feat(screenshot): draw TV overlay refs at the page's capture scale - #4639

Merged
thymikee merged 1 commit into
callstack:mainfrom
alimek:feat/tv-screenshot-overlay-refs
Nov 17, 2026
Merged

thymikee merged 1 commit into
callstack:mainfrom
alimek:feat/tv-screenshot-overlay-refs

Conversation

@alimek

@alimek alimek commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #4635. On Tizen and webOS, screenshot --overlay-refs drew CSS px rects 1:1 on the capture. Tizen boxes came out too small and offset (1280 meta viewport, captured at 1.5×). On webOS (1280×720 app), boxes for nodes past the page edge spilled onto the padding.

 buildSnapshotState
+  captureScale carried beside viewport
 projectRectToScreenshot (overlay)
-  rects 1:1, clamped to the image
+  rects × captureScale, clamped to viewport × captureScale   # same as --crop-on

8 files, no linked issue. Scope expansion: SnapshotState.captureScale (internal). A tree without a scale keeps 1:1 boxes and is not refused.

Validation

Tested 59f385621 on bfb67d5cc; hardware ran on 851a13449, before a refactor-only amend that keeps Fallow complexity under threshold. The local registry mirror lacks packages for this lockfile, so the local runs used the #4635 worktree with this patch applied. CI validates the head.

  • vitest capture-kit, daemon/src/execution, tv-cdp: 2071/2071. Typecheck, oxlint, oxfmt, fr: clean.
  • Mutation: reverting the overlay projection fails both new tests.
  • Hardware, webOS 22 and Tizen 9.0, static fixture. Each overlayRect was compared with the element's frame found from border pixels in a plain screenshot:
    • webOS 1920×1080 app: 400×240 at (200,300) and the edge node at 80×100 match.
    • webOS 1280×720 app: both match, with 0 overlay pixels outside the page. Before the fix: edge box 300×100, 1072 pixels outside.
    • Tizen native: both match. Tizen 1280 meta viewport (visualViewport.scale 1.5): 600×360 at (300,450) and edge 120×150 at (1800,900) match. Before the fix: 400×240 at (200,300) and 300×100 at (1200,600).

Screenshots:

  • webOS 1280×720 app, edge box, before / after:
webos-720-overlay-edge-before webos-720-overlay-edge-after
  • webOS 1280×720 app, full capture with overlay:
webos-720-overlay-full
  • Tizen 1280 meta viewport, before / after:
tizen-1280-overlay-before tizen-1280-overlay-after

Risks: on a scaled Tizen page, JSON center is in screenshot px, not the CSS px that press takes.

Two-way door. Blast radius: TV plugins.

🤖 Generated with Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff

screenshot --overlay-refs on the Tizen and webOS plugins projected CSS px
rects 1:1 onto the capture. A Tizen page with a 1280 meta viewport is
captured at 1.5x, so its boxes landed too small and offset; a webOS app at
1280x720 fills only the top-left of a 1920x1080 capture, so a node past the
page edge was boxed over the padding.

SnapshotState now carries the producer's captureScale beside viewport, and
the overlay projects with that scale and clamps to viewport x captureScale,
the same projection and frame the crop uses.
@alimek
alimek force-pushed the feat/tv-screenshot-overlay-refs branch from 851a134 to 59f3856 Compare November 17, 2026 15:02
@thymikee

Copy link
Copy Markdown
Member

This PR is ready at 59f3856. The projection and its fixtures (Save 10,10,40,20 at scale 1.5; Tile 1200+300 against a 1280 frame) look correct. All 16 checks are green, and there are no conflicts. The webOS and Tizen hardware evidence in the PR body predates a refactor-only amend, and the helper extraction at snapshot-state.ts:145-151 behaves the same. Not blocking, and you can take or leave these: the crop path still reads captureScale from raw snapshotData (screenshot-crop.ts:88) while the overlay reads it from SnapshotState; the overlay still picks the rect space inline instead of using resolveScreenshotRectSpace (screenshot-overlay.ts:273, from #4635); a TV page with no published scale is drawn 1:1 while --crop-on refuses it, which the PR and docs already state (screenshot-overlay.ts:278); and the Tizen and webOS doc sentences describe the same behavior in different words (webos.md:112). Only a maintainer merge is left.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 17, 2026
@thymikee
thymikee merged commit 6fd52ca into callstack:main Nov 17, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants