summaryrefslogtreecommitdiffstats
path: root/layout/reftests/web-animations/animation-utils.js
blob: d34ba635a12dc99f68fc02c1bde52544b1928487 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
function waitForIterationChange(animation) {
  var initialIteration = animation.effect.getComputedTiming().currentIteration;
  return new Promise(resolve => {
    window.requestAnimationFrame(handleFrame = () => {
      if (animation.effect.getComputedTiming().currentIteration !=
            initialIteration) {
        resolve();
      } else {
        window.requestAnimationFrame(handleFrame);
      }
    });
  });
}