Bug 1418268 - Make sure the animation on scrolled out element is throttled in the first place. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Thu, 07 Dec 2017 08:43:38 +0900
changeset 708762 e72e0dafad843d62ea881d1734d0860a96e0021f
parent 708379 c0c5e19a32b8b1b74b9dc0360800aec01665f9b0
child 708763 3c33dc8ddc1460691409d4350727d8d5bdf2073b
push id92440
push userhikezoe@mozilla.com
push dateThu, 07 Dec 2017 03:58:44 +0000
reviewersbirtles
bugs1418268
milestone59.0a1
Bug 1418268 - Make sure the animation on scrolled out element is throttled in the first place. r?birtles In the first frame after the initial paint, we skip restyling if the initial paint took over vsync refresh rate as an optimization and to avoid jumpy animations. To avoid checking this skipped restyling that we'd actually expect a restyle maker there, firstly we check there is no restyle marker after the initial paint for scrolled out animation for five frames, and we then make the element visible and check a restyle marker there. MozReview-Commit-ID: 5XkJhdtUly5
dom/animation/test/mozilla/file_restyles.html
--- a/dom/animation/test/mozilla/file_restyles.html
+++ b/dom/animation/test/mozilla/file_restyles.html
@@ -502,18 +502,23 @@ waitForAllPaints(() => {
       { style: 'overflow-y: scroll; height: 20px;' });
     var div = addDiv(null,
       { style: 'animation: background-color 100s; position: relative; top: 100px;' });
     parentElement.appendChild(div);
     var animation = div.getAnimations()[0];
 
     await animation.ready;
 
+    var markers = await observeStyling(5);
+    is(markers.length, 0,
+       'Animations running on the main-thread which is in scrolled out ' +
+       'elements should not update restyling');
+
     parentElement.style.height = '100px';
-    var markers = await observeStyling(1);
+    markers = await observeStyling(1);
 
     is(markers.length, 1,
        'Animations running on the main-thread which was in scrolled out ' +
        'elements should update restyling soon after the element moved in ' +
        'view by resizing');
 
     await ensureElementRemoval(parentElement);
   });