mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Bug 1418268 - Tweak expected restyle count for the case where animation start time was clamped. r=birtles
MozReview-Commit-ID: IPxRtRucze4 --HG-- extra : rebase_source : b5c346b38022fa69f0762a5d3149599f41f2414b
This commit is contained in:
parent
18bbe2d0b2
commit
6a7d32d971
@ -89,6 +89,16 @@ function waitForWheelEvent(aTarget) {
|
||||
});
|
||||
}
|
||||
|
||||
// Returns true if |aAnimation| begins at the current timeline time. We
|
||||
// sometimes need to detect this case because if we started an animation
|
||||
// asynchronously (e.g. using play()) and then ended up running the next frame
|
||||
// at precisely the time the animation started (due to aligning with vsync
|
||||
// refresh rate) then we won't end up restyling in that frame.
|
||||
function startsRightNow(aAnimation) {
|
||||
return aAnimation.startTime === aAnimation.timeline.currentTime &&
|
||||
aAnimation.currentTime === 0;
|
||||
}
|
||||
|
||||
var omtaEnabled = isOMTAEnabled();
|
||||
|
||||
var isAndroid = !!navigator.userAgent.includes("Android");
|
||||
@ -147,8 +157,26 @@ waitForAllPaints(() => {
|
||||
await animation.ready;
|
||||
ok(!SpecialPowers.wrap(animation).isRunningOnCompositor);
|
||||
|
||||
// Normally we expect one restyling for each requestAnimationFrame (as
|
||||
// called by observeRestyling) PLUS one for the last frame becasue of bug
|
||||
// 1193394. However, we won't observe that initial restyling unless BOTH of
|
||||
// the following two conditions hold:
|
||||
//
|
||||
// 1. We are running *before* restyling happens. This only happens if we
|
||||
// perform a micro task checkpoint after resolving the 'ready' promise
|
||||
// above (bug 1416966).
|
||||
// 2. The animation actually needs a restyle because it started prior to
|
||||
// this frame. Even if (1) is true, in some cases due to aligning with
|
||||
// the refresh driver, the animation fame in which the ready promise is
|
||||
// resolved happens to coincide perfectly with the start time of the
|
||||
// animation. In this case no restyling is needed so we won't observe
|
||||
// an additional restyle.
|
||||
const expectedRestyleCount =
|
||||
hasMicroTaskCheckpointForAnimation && !startsRightNow(animation)
|
||||
? 6
|
||||
: 5;
|
||||
var markers = await observeStyling(5);
|
||||
is(markers.length, 5,
|
||||
is(markers.length, expectedRestyleCount,
|
||||
'CSS animations running on the main-thread should update style ' +
|
||||
'on the main thread');
|
||||
await ensureElementRemoval(div);
|
||||
@ -905,9 +933,13 @@ waitForAllPaints(() => {
|
||||
|
||||
await animation.ready;
|
||||
|
||||
const expectedRestyleCount =
|
||||
hasMicroTaskCheckpointForAnimation && !startsRightNow(animation)
|
||||
? 6
|
||||
: 5;
|
||||
var markers = await observeStyling(5);
|
||||
|
||||
is(markers.length, 5,
|
||||
is(markers.length, expectedRestyleCount,
|
||||
'Discrete animation has has no keyframe whose offset is 0 or 1 in an ' +
|
||||
'out-of-view element should not be throttled');
|
||||
await ensureElementRemoval(div);
|
||||
@ -972,8 +1004,12 @@ waitForAllPaints(() => {
|
||||
var animation = rect.animate({ fill: ['blue', 'lime'] }, 100 * MS_PER_SEC);
|
||||
await animation.ready;
|
||||
|
||||
const expectedRestyleCount =
|
||||
hasMicroTaskCheckpointForAnimation && !startsRightNow(animation)
|
||||
? 6
|
||||
: 5;
|
||||
var markers = await observeStyling(5);
|
||||
is(markers.length, 5,
|
||||
is(markers.length, expectedRestyleCount,
|
||||
'CSS animations on an in-view svg element with post-transform should ' +
|
||||
'not be throttled.');
|
||||
|
||||
@ -1032,8 +1068,12 @@ waitForAllPaints(() => {
|
||||
var animation = targetDiv.getAnimations()[0];
|
||||
await animation.ready;
|
||||
|
||||
const expectedRestyleCount =
|
||||
hasMicroTaskCheckpointForAnimation && !startsRightNow(animation)
|
||||
? 6
|
||||
: 5;
|
||||
var markers = await observeStyling(5);
|
||||
is(markers.length, 5,
|
||||
is(markers.length, expectedRestyleCount,
|
||||
'CSS animation on an in-view element with pre-transform should not ' +
|
||||
'be throttled.');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user