Commit c988cbe
committed
fix(engine): stop clobbering native <video> opacity in HDR pipeline
Four related bugs in the opacity pipeline that interact with HDR video
compositing and GSAP-controlled fades:
1A. screenshotService injectVideoFramesBatch and syncVideoFrameVisibility
were applying `opacity: 0 !important` to native <video> elements to
hide them under the injected <img>. That stomp clobbered any
GSAP-controlled inline opacity, so the next seek read 0 from
computed style and the comp went black. We now use
`visibility: hidden !important` only — visibility hides the element
from rendering without changing its opacity, so subsequent reads
(and queryElementStacking) see the real GSAP value on every frame.
The `parseFloat(...) || 1` recovery hack at injectVideoFramesBatch
was specifically there to compensate for this stomp; it’s now
replaced with a `Number.isNaN` guard that defaults to 1 only when
parsing actually fails.
1B. queryVideoElementBounds parsed `style.opacity` and `style.zIndex`
with `parseFloat(...) || N`, which silently coerces a real opacity
of 0 into 1 (and zIndex 0 into 0 only by coincidence). Switched to
explicit `Number.isNaN` checks so opacity 0 stays 0.
1C. resolveRadius cast `el as HTMLElement` to read offsetWidth/Height.
SVG and other non-HTML elements would have crashed at runtime.
Replaced the cast with an `instanceof HTMLElement` guard, and made
the numeric fallback `Number.isNaN`-safe.
1D. The opacity walk in queryVideoElementBounds started from
`el.parentElement` for HDR videos to skip past the engine’s forced
`opacity: 0` on the element itself. Now that the engine never sets
opacity, the special case is unnecessary — always walk from `el`.
Kept the `isHdrEl` lookup because transform/border-radius logic
further down still branches on it.
Verified:
- bun run --filter @hyperframes/engine typecheck (clean)
- bun run --filter @hyperframes/engine test (308/308 passing)
- bun run --filter @hyperframes/producer typecheck (clean)
- oxlint + oxfmt --check on both touched files
Next: regenerate hdr-regression window C (the opacity-fade window) and
tighten its maxFrameFailures budget — done in a follow-up commit so the
golden churn is reviewable separately from the code fix.1 parent e56820c commit c988cbe
2 files changed
Lines changed: 24 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
375 | 375 | | |
376 | 376 | | |
377 | 377 | | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | | - | |
388 | | - | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
389 | 384 | | |
390 | 385 | | |
391 | 386 | | |
| |||
454 | 449 | | |
455 | 450 | | |
456 | 451 | | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
457 | 455 | | |
458 | | - | |
459 | 456 | | |
460 | 457 | | |
461 | 458 | | |
| |||
489 | 486 | | |
490 | 487 | | |
491 | 488 | | |
492 | | - | |
| 489 | + | |
| 490 | + | |
493 | 491 | | |
494 | 492 | | |
495 | | - | |
496 | 493 | | |
497 | 494 | | |
498 | 495 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
152 | | - | |
153 | | - | |
154 | 152 | | |
155 | 153 | | |
156 | 154 | | |
| |||
168 | 166 | | |
169 | 167 | | |
170 | 168 | | |
171 | | - | |
172 | 169 | | |
173 | 170 | | |
174 | 171 | | |
| |||
203 | 200 | | |
204 | 201 | | |
205 | 202 | | |
206 | | - | |
207 | | - | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
208 | 207 | | |
209 | 208 | | |
210 | 209 | | |
| |||
320 | 319 | | |
321 | 320 | | |
322 | 321 | | |
323 | | - | |
324 | | - | |
325 | | - | |
| 322 | + | |
| 323 | + | |
326 | 324 | | |
327 | 325 | | |
328 | | - | |
| 326 | + | |
| 327 | + | |
329 | 328 | | |
330 | 329 | | |
331 | 330 | | |
| |||
435 | 434 | | |
436 | 435 | | |
437 | 436 | | |
438 | | - | |
439 | | - | |
440 | | - | |
441 | 437 | | |
442 | | - | |
443 | | - | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
444 | 443 | | |
445 | 444 | | |
446 | 445 | | |
| |||
0 commit comments