tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

smil-util.js (969B)


      1 // Seeks to the given time and then removes the SVG document's class to trigger
      2 // a reftest snapshot. If pauseFlag is true, animations will be paused.
      3 function setTimeAndSnapshot(timeInSeconds, pauseFlag) {
      4  var svg = document.documentElement;
      5  if (pauseFlag) {
      6    svg.pauseAnimations();
      7  }
      8  svg.setCurrentTime(timeInSeconds);
      9  svg.removeAttribute("class");
     10 }
     11 
     12 // Seeks to the given time and then removes the SVG document's class to trigger
     13 // a reftest snapshot after waiting at least minWaitTimeInSeconds.
     14 function setTimeAndWaitToSnapshot(seekTimeInSeconds, minWaitTimeInSeconds) {
     15  var svg = document.documentElement;
     16  svg.setCurrentTime(seekTimeInSeconds);
     17  var timeToTakeSnapshot =
     18    window.performance.now() + minWaitTimeInSeconds * 1000;
     19  requestAnimationFrame(function takeSnapshot(currentTime) {
     20    if (currentTime > timeToTakeSnapshot) {
     21      svg.removeAttribute("class");
     22    } else {
     23      requestAnimationFrame(takeSnapshot);
     24    }
     25  });
     26 }