feat(screenshot): support selector crops on Tizen and webOS TVs

Merged
AL
11d ago
+502-43

Summary

screenshot --crop-on was refused on Tizen and webOS TVs (provider-owned Android TV devices).

 classifyScreenshotCropTarget(android)
+  tv device, provider-owned → provider-android-tv
 tv-cdp snapshot
+  captureScale = visualViewport.scale; viewport = inner size
 cropScreenshotToSelector
+  assertScreenshotCropSnapshot   # cdp-dom, both facts
-  rects 1:1, clipped to the image
+  rects × captureScale, clipped to viewport × captureScale

TV captures don't follow devicePixelRatio (webOS 1280×720 app: 1.5, unscaled, top-left; Tizen 1280 meta viewport: 1, captured at 1.5×). visualViewport.scale matches both.

24 files, no linked issue. Scope expansion: TV snapshots publish viewport (CSS px). Follow-up: --overlay-refs on TVs.

Validation

Evidence: 1de5b2a2c on 80075b641, rebased onto fdf595127 as a20e4e38f (help/README conflicts); CI validates that head, whose lockfile won't install here.

  • check:affected --run --head 1de5b2a2c: static checks, build, vitest-related (406/406) pass; unit's 6 failures also fail on unchanged base.
  • Mutations: removing the scale, page clip, or missing-fact refusal fails its leaf test.
  • Hardware (static fixture; crop located by border pixels in a plain screenshot): pixel-identical, unique match, every ±4 px shift differs.
    • webOS 22 (32LQ6300), 1920×1080 and 1280×720 apps: 400×240 at (200,300).
    • Tizen 9.0 (M7): 400×240 at (200,300); 1280 meta viewport: 600×360 at (300,450), where 1:1 missed.
    • Page-edge nodes clip to the page, with a warning.

Screenshots:

  • Tizen, 1280 meta viewport:
tizen-1280-full
  • Tizen crop before / after:
tizen-1280-crop-before tizen-1280-crop-after
  • webOS 1280×720, edge crop:
webos-720-full webos-720-edge-crop

Risks: TVs without visualViewport refuse the crop; panned-viewport refusal is hardware-untested.

Two-way door. Blast radius: TV plugins.

🤖 Generated with Claude Code