mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 09:45:41 +00:00
Bug 1518403 - Make "is current" depend on the direction of the associated animation's playback rate; r=hiro
As per the following spec change:
4ec1deb76a
Spec issue:
https://github.com/w3c/csswg-drafts/issues/3193
Of the added test cases, only the last one, "Returns reversed animations yet to
reach their active phase" fails without this code change. The others pass
because the animation is finished at that point but I added them for consistency
with the previous tests.
Differential Revision: https://phabricator.services.mozilla.com/D16001
--HG--
extra : moz-landing-system : lando
This commit is contained in:
parent
3e70bf3ff1
commit
1ec94901a9
@ -47,8 +47,13 @@ bool AnimationEffect::IsCurrent() const {
|
||||
}
|
||||
|
||||
ComputedTiming computedTiming = GetComputedTiming();
|
||||
return computedTiming.mPhase == ComputedTiming::AnimationPhase::Before ||
|
||||
computedTiming.mPhase == ComputedTiming::AnimationPhase::Active;
|
||||
if (computedTiming.mPhase == ComputedTiming::AnimationPhase::Active) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return mAnimation->PlaybackRate() >= 0
|
||||
? computedTiming.mPhase == ComputedTiming::AnimationPhase::Before
|
||||
: computedTiming.mPhase == ComputedTiming::AnimationPhase::After;
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/web-animations/#in-effect
|
||||
|
@ -65,7 +65,32 @@ test(t => {
|
||||
delay: 100 * MS_PER_SEC,
|
||||
});
|
||||
assert_array_equals(div.getAnimations(), [animation]);
|
||||
}, 'Returns animations in their delay phase');
|
||||
}, 'Returns animations yet to reach their active phase');
|
||||
|
||||
test(t => {
|
||||
const div = createDiv(t);
|
||||
const animation = div.animate(null, 100 * MS_PER_SEC);
|
||||
animation.playbackRate = -1;
|
||||
assert_array_equals(div.getAnimations(), []);
|
||||
}, 'Does not return reversed finished animations that do not fill backwards');
|
||||
|
||||
test(t => {
|
||||
const div = createDiv(t);
|
||||
const animation = div.animate(null, {
|
||||
duration: 100 * MS_PER_SEC,
|
||||
fill: 'backwards',
|
||||
});
|
||||
animation.playbackRate = -1;
|
||||
assert_array_equals(div.getAnimations(), [animation]);
|
||||
}, 'Returns reversed finished animations that fill backwards');
|
||||
|
||||
test(t => {
|
||||
const div = createDiv(t);
|
||||
const animation = div.animate(null, 100 * MS_PER_SEC);
|
||||
animation.playbackRate = -1;
|
||||
animation.currentTime = 200 * MS_PER_SEC;
|
||||
assert_array_equals(div.getAnimations(), [animation]);
|
||||
}, 'Returns reversed animations yet to reach their active phase');
|
||||
|
||||
test(t => {
|
||||
const div = createDiv(t);
|
||||
|
Loading…
Reference in New Issue
Block a user