Skip to content

Commit 375633f

Browse files
committed
remove engine/producer changes — belongs in a separate PR
The portrait-video getBoundingClientRect fix and its regression test will be submitted separately. This branch focuses on studio refactoring.
1 parent 54e9a2c commit 375633f

8 files changed

Lines changed: 553 additions & 1982 deletions

File tree

packages/engine/src/services/screenshotService.ts

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,6 @@ export async function injectVideoFramesBatch(
386386
"bottom",
387387
"inset",
388388
]);
389-
// Force Chrome to commit any pending style/layout from the preceding
390-
// seek. On macOS Chrome (screenshot mode, pooled browser), layout can
391-
// be deferred after __hf.seek(); reading any BCRA flushes the queue
392-
// synchronously so offsetWidth/offsetHeight are guaranteed current.
393-
document.body.getBoundingClientRect();
394-
395389
for (const item of items) {
396390
const video = document.getElementById(item.videoId) as HTMLVideoElement | null;
397391
if (!video) continue;
@@ -442,22 +436,22 @@ export async function injectVideoFramesBatch(
442436
// stack vertically — the <img> lands below the video and gets clipped
443437
// by any overflow:hidden ancestor (e.g., border-radius wrappers).
444438
//
445-
// Size: offsetWidth/offsetHeight — layout dimensions unaffected by
446-
// ancestor CSS transforms (getBoundingClientRect double-scales).
447-
// The layout flush above guarantees these are current even on
448-
// macOS Chrome with pooled browsers (#1009).
449-
// Position: offsetLeft/offsetTop — correct relative to offsetParent.
439+
// Apply this after visual style copying so the measured used box is
440+
// the final authority for replacement frame geometry.
450441
{
451-
const w = video.offsetWidth;
452-
const h = video.offsetHeight;
442+
const videoRect = video.getBoundingClientRect();
443+
const offsetLeft = Number.isFinite(video.offsetLeft) ? video.offsetLeft : 0;
444+
const offsetTop = Number.isFinite(video.offsetTop) ? video.offsetTop : 0;
445+
const offsetWidth = video.offsetWidth > 0 ? video.offsetWidth : videoRect.width;
446+
const offsetHeight = video.offsetHeight > 0 ? video.offsetHeight : videoRect.height;
453447
img.style.position = "absolute";
454448
img.style.inset = "auto";
455-
img.style.left = `${video.offsetLeft}px`;
456-
img.style.top = `${video.offsetTop}px`;
449+
img.style.left = `${offsetLeft}px`;
450+
img.style.top = `${offsetTop}px`;
457451
img.style.right = "auto";
458452
img.style.bottom = "auto";
459-
img.style.width = `${w}px`;
460-
img.style.height = `${h}px`;
453+
img.style.width = `${offsetWidth}px`;
454+
img.style.height = `${offsetHeight}px`;
461455
}
462456
img.style.objectFit = computedStyle.objectFit;
463457
img.style.objectPosition = computedStyle.objectPosition;

packages/producer/tests/portrait-video-fullbleed/meta.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/producer/tests/portrait-video-fullbleed/output/compiled.html

Lines changed: 0 additions & 34 deletions
This file was deleted.

packages/producer/tests/portrait-video-fullbleed/output/output.mp4

Lines changed: 0 additions & 3 deletions
This file was deleted.
Binary file not shown.

packages/producer/tests/portrait-video-fullbleed/src/index.html

Lines changed: 0 additions & 23 deletions
This file was deleted.

packages/producer/tests/style-13-prod/output/compiled.html

Lines changed: 77 additions & 669 deletions
Large diffs are not rendered by default.

packages/producer/tests/style-6-prod/output/compiled.html

Lines changed: 465 additions & 1224 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)