Bug 1415783 - Flush pending style, layout and paint and wait for a MozAfterPaint before waiting for MozAfterPaint for OMT animation. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 28 Nov 2017 14:57:24 +0900
changeset 704064 310f085c9a5c60c4098d9b5e66335fb4e6eeb255
parent 703941 f5f03ee9e6abf77964f8dc1b9d69c6ccd3f655fd
child 704069 6e9169dffb0962a52ccc5da525c29f6ac0f2ffa9
push id91062
push userhikezoe@mozilla.com
push dateTue, 28 Nov 2017 07:25:22 +0000
reviewersbirtles
bugs1415783, 1193394
milestone59.0a1
Bug 1415783 - Flush pending style, layout and paint and wait for a MozAfterPaint before waiting for MozAfterPaint for OMT animation. r?birtles With the conformant Promise handling (bug 1193394), there happen to receive unexpected MozAfterPaint while waiting for MozAfterPaint for OMT animation. The safest way to avoid this confusion is to start test refresh mode and flush all pending styles (layout and paint) there so that the unexpected MozAfterPaint is absorbed there. MozReview-Commit-ID: 2xdKe4InYcP
layout/style/test/animation_utils.js
--- a/layout/style/test/animation_utils.js
+++ b/layout/style/test/animation_utils.js
@@ -253,18 +253,23 @@ function runOMTATest(aTestFunction, aOnS
       if (utils.isTestControllingRefreshes) {
         utils.restoreNormalRefresh();
       }
     };
 
     return waitForDocumentLoad()
       .then(loadPaintListener)
       .then(function() {
-        // Put refresh driver under test control and trigger animation
+        // Put refresh driver under test control and flush all pending style,
+        // layout and paint to avoid the situation that waitForPaintsFlush()
+        // receives unexpected MozAfterpaint event for those pending
+        // notifications.
         utils.advanceTimeAndRefresh(0);
+        return waitForPaintsFlushed();
+      }).then(function() {
         div.style.animation = animationName + " 10s";
 
         return waitForPaintsFlushed();
       }).then(function() {
         var opacity = utils.getOMTAStyle(div, "opacity");
         cleanUp();
         return Promise.resolve(opacity == 0.5);
       }).catch(function(err) {