Bug 1413817 - Run requestAnimationFrame before resolving a Promise in waitForWheelEvent(). r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Thu, 09 Nov 2017 08:06:36 +0900
changeset 695298 12cac7c126e510046860818aa52fe8d40b36eb9f
parent 695297 686255678267d540fbf9f35f517ebf7709d5a7c4
child 695299 ef9dfbe86259f8a0a8e3fd7a910b67db32e84325
push id88383
push userhikezoe@mozilla.com
push dateThu, 09 Nov 2017 00:26:11 +0000
reviewersbirtles
bugs1413817
milestone58.0a1
Bug 1413817 - Run requestAnimationFrame before resolving a Promise in waitForWheelEvent(). r?birtles sendWheelAndPaintNoFlush waits for MozAfterPaint and calls a given callback function when the MozAfterPaint is received. The MozAfterPaint is processed after we did a paint process. That means that we have no chance to process restyling between MozAfterPaint and requestAnimationFrame. MozReview-Commit-ID: 1B8EZNozjFj
dom/animation/test/mozilla/file_restyles.html
--- a/dom/animation/test/mozilla/file_restyles.html
+++ b/dom/animation/test/mozilla/file_restyles.html
@@ -86,17 +86,19 @@ function waitForWheelEvent(aTarget) {
     // system to send a wheel event to the element.
     var targetRect = aTarget.getBoundingClientRect();
     var centerX = targetRect.left + targetRect.width / 2;
     var centerY = targetRect.top + targetRect.height / 2;
 
     sendWheelAndPaintNoFlush(aTarget, centerX, centerY,
                              { deltaMode: WheelEvent.DOM_DELTA_PIXEL,
                                deltaY: targetRect.height },
-                             resolve);
+                             () => {
+                               requestAnimationFrame(resolve);
+                             });
   });
 }
 
 var omtaEnabled = isOMTAEnabled();
 
 var isAndroid = !!navigator.userAgent.includes("Android");
 var isServo = isStyledByServo();
 var offscreenThrottlingEnabled =