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
--- 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);
});