Bug 1168759 - Part 2: Use waitForAllPaints() instead of animation.ready. r?boris draft
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Thu, 27 Oct 2016 16:34:04 +0900
changeset 430135 b6c75e7c1ee4144d88382364e55cec4f936e948a
parent 430134 36efb0539fd7d36a39d20b941486d16a35f47cc6
child 535133 e1e0df2d17ab0f28bdc2840372ff85e1f2286022
push id33748
push userbmo:hiikezoe@mozilla-japan.org
push dateThu, 27 Oct 2016 07:34:46 +0000
reviewersboris
bugs1168759
milestone52.0a1
Bug 1168759 - Part 2: Use waitForAllPaints() instead of animation.ready. r?boris MozReview-Commit-ID: Hekj71Een7s
dom/animation/test/mozilla/file_deferred_start.html
--- a/dom/animation/test/mozilla/file_deferred_start.html
+++ b/dom/animation/test/mozilla/file_deferred_start.html
@@ -1,11 +1,12 @@
 <!doctype html>
 <meta charset=utf-8>
 <script src="../testcommon.js"></script>
+<script src="/tests/SimpleTest/paint_listener.js"></script>
 <style>
 @keyframes empty { }
 @keyframes animTransform {
   from { transform: translate(0px); }
   to { transform: translate(100px); }
 }
 .target {
   /* Element needs geometry to be eligible for layerization */
@@ -23,16 +24,22 @@ function waitForDocLoad() {
     if (document.readyState === 'complete') {
       resolve();
     } else {
       window.addEventListener('load', resolve);
     }
   });
 }
 
+function waitForPaints() {
+  return new Promise(function(resolve, reject) {
+    waitForAllPaintsFlushed(resolve);
+  });
+}
+
 promise_test(function(t) {
   var div = addDiv(t);
   var cs = window.getComputedStyle(div);
 
   // Test that empty animations actually start.
   //
   // Normally we tie the start of animations to when their first frame of
   // the animation is rendered. However, for animations that don't actually
@@ -82,17 +89,17 @@ promise_test(function(t) {
   }
 
   // Setup animation
   var div = addDiv(t);
   div.classList.add('target');
   div.style.animation = 'animTransform 100s -50s forwards';
   var animation = div.getAnimations()[0];
 
-  return animation.ready.then(function() {
+  return waitForPaints(function() {
     var transformStr =
       SpecialPowers.DOMWindowUtils.getOMTAStyle(div, 'transform');
 
     var matrixComponents =
       transformStr.startsWith('matrix(')
       ? transformStr.substring('matrix('.length, transformStr.length-1)
                     .split(',')
                     .map(component => Number(component))