Skip to content

Write HTML. Render video. Built for agents.

1.5 KB
Raw Blame
<!doctype html>
<html>
  <head>
    <style>
      /*
        We DELIBERATELY paint a non-transparent body background here to
        exercise the regression this PR fixes. The pre-navigation
        Emulation.setDefaultBackgroundColorOverride that the engine used
        to set is overridden by any `body { background: ... }` rule, so
        on the buggy code path the captured PNG's "transparent" pixels
        decode as opaque #111 (rgba [17, 17, 17, 255]).
        The fix injects an `[data-composition-id]{background:transparent !important}`
        stylesheet via initTransparentBackground() AFTER navigation, which
        force-overrides this body background and produces a real alpha
        channel — pixels outside the .card decode as rgba [0, 0, 0, 0].
        If the test passes against this fixture, alpha is genuinely making
        it through end-to-end.
      */
      html,
      body {
        margin: 0;
        padding: 0;
        background: #111;
      }
      .card {
        position: absolute;
        left: 50px;
        top: 50px;
        width: 100px;
        height: 100px;
        background: rgb(255, 0, 0);
      }
    </style>
  </head>
  <body
    data-composition-id="transparency-regression"
    data-no-timeline
    data-duration="1"
    data-width="200"
    data-height="200"
  >
    <div class="card"></div>
    <script>
      // Minimal seek protocol — the composition is static.
      window.__hf = {
        duration: 1,
        seek: () => {},
      };
    </script>
  </body>
</html>