wpt / css / css-image-animation / image-animation-display-none-reset.html

Status: FAIL | Duration: 10ms | Subtests: 0/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi

/css/css-image-animation/image-animation-display-none-reset.html

<!DOCTYPE html>
<html class="reftest-wait">
<title>image-animation reset when display: none</title>
<link rel="help" href="https://drafts.csswg.org/css-image-animation-1/">
<meta charset="utf-8" />
<link rel="match" href="image-animation-display-none-reset-ref.html" />
<style>
  img {
    image-animation: paused;
  }
</style>
<script src="/common/reftest-wait.js"></script>
<script src="resources/image-animation-utils.js"></script>
<script>
  let count = 0;
  function loaded() {
    count++;
    if (count < document.querySelectorAll('img').length)
      return;

    const img1 = document.getElementById('img1');
    const img2 = document.getElementById('img2');
    img1.style.imageAnimation = "running";
    img2.style.imageAnimation = "running";

    // The GIF (anim-rgb.gif) has 3 frames:
    //   Frame 1: red,   20ms
    //   Frame 2: green, 200ms
    //   Frame 3: blue
    //
    // Wait for frame 2 (green) to be reached.
    waitForFrameTime(100).then(() => {
      img2.style.imageAnimation = 'paused';
      img1.style.display = 'none';
        requestAnimationFrame(() => {
          requestAnimationFrame(() => {
            img1.style.display = 'inline';
            img1.style.imageAnimation = 'paused';
            requestAnimationFrame(()=>{
              takeScreenshot();
            })
          });
      });
    });
  }
</script>

<img id="img1" src="../../images/anim-rgb.gif" onload="loaded()" />
<img id="img2" src="../../images/anim-rgb.gif" onload="loaded()" />

</html>

/css/css-image-animation/image-animation-display-none-reset-ref.html

<!DOCTYPE html>
<title>Reference for image-animation reset when display: none</title>
<img src="../../images/red.png">
<img src="../../images/green.png">