fix(playback): keep CSS bounds unrounded until native scaling

Review feedback on #1206: measureBounds() rounded the CSS edges in the
renderer, before the main-process CSS-to-native conversion, so fractional
layout positions could drift by a pixel per scale factor (a 10.49px edge
at 200% must land on 21 physical px, not 20). The renderer now sends raw
getBoundingClientRect() edges and rounding happens exactly once, after
scaling. Also pins process.platform explicitly in the macOS wiring test
instead of relying on the suite default.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Fable 5 committed 2026-07-19 07:22:18 +02:00
1 parent 5af6058134
commit d7753f7401
7 files changed
+42 -13

No files matched your search

+5 -3
View File
@@ -607,9 +607,11 @@ and match physical pixels only at 100% page zoom AND 100% display scale.
`EmbeddedMpvNativeService` therefore converts every native-view bounds payload
in the main process (`toNativeViewBounds` in `embedded-mpv-bounds.util.ts`):
all platforms scale by the webContents zoom factor, win32/linux additionally
by the scale factor of the display hosting the window. Edges are scaled
before deriving width/height so rounding cannot open 1px seams against the
surrounding DOM UI. Skipping this conversion is issue #1145: on scaled
by the scale factor of the display hosting the window. The renderer sends
unrounded CSS edges (`measureBounds` does not round) and the conversion
rounds exactly once, after scaling — edges first, width/height derived from
them — so fractional CSS layouts and fractional scales cannot open 1px
seams against the surrounding DOM UI. Skipping this conversion is issue #1145: on scaled
displays (Windows 125%, Linux fractional scaling, HiDPI TVs) the video landed
toward the window's top-left corner at `1/scale` of its size, in windowed and
fullscreen mode alike.