Bug 1406381 - Update the simple iteration progress calculation to match recent changes to the Web Animations specification; r?hiro
This implements the following change to the Web Animations specification:
https://github.com/w3c/web-animations/pull/202/commits/19b6c33cee533dde34b67ac9e416d93ecf4cb1d0
The background to that change is described in the corresponding spec issue:
https://github.com/w3c/web-animations/issues/201
MozReview-Commit-ID: GGA64LG5vT
--- a/dom/animation/AnimationEffectReadOnly.cpp
+++ b/dom/animation/AnimationEffectReadOnly.cpp
@@ -195,30 +195,28 @@ AnimationEffectReadOnly::GetComputedTimi
// Convert the overall progress to a fraction of a single iteration--the
// simply iteration progress.
// https://w3c.github.io/web-animations/#simple-iteration-progress
double progress = IsFinite(overallProgress)
? fmod(overallProgress, 1.0)
: fmod(result.mIterationStart, 1.0);
- // When we finish exactly at the end of an iteration we need to report
- // the end of the final iteration and not the start of the next iteration.
- // We *don't* want to do this when we have a zero-iteration animation or
- // when the animation has been effectively made into a zero-duration animation
- // using a negative end-delay, however.
- if (result.mPhase == ComputedTiming::AnimationPhase::After &&
- progress == 0.0 &&
- result.mIterations != 0.0 &&
- (result.mActiveTime != zeroDuration ||
- result.mDuration == zeroDuration)) {
- // The only way we can be in the after phase with a progress of zero and
- // a current iteration of zero, is if we have a zero iteration count or
- // were clipped using a negative end delay--both of which we should have
- // detected above.
+ // When we are at the end of the active interval and the end of an iteration
+ // we need to report the end of the final iteration and not the start of the
+ // next iteration. We *don't* want to do this, however, when we have
+ // a zero-iteration animation.
+ if (progress == 0.0 &&
+ (result.mPhase == ComputedTiming::AnimationPhase::After ||
+ result.mPhase == ComputedTiming::AnimationPhase::Active) &&
+ result.mActiveTime == result.mActiveDuration &&
+ result.mIterations != 0.0) {
+ // The only way we can reach the end of the active interval and have
+ // a progress of zero and a current iteration of zero, is if we have a zero
+ // iteration count -- something we should have detected above.
MOZ_ASSERT(result.mCurrentIteration != 0,
"Should not have zero current iteration");
progress = 1.0;
if (result.mCurrentIteration != UINT64_MAX) {
result.mCurrentIteration--;
}
}
deleted file mode 100644
--- a/testing/web-platform/meta/web-animations/timing-model/animation-effects/current-iteration.html.ini
+++ /dev/null
@@ -1,7 +0,0 @@
-[current-iteration.html]
- type: testharness
- [Test negative playback rate: duration:1 delay:1 fill:both playbackRate:-1]
- expected: FAIL
-
- [Test negative playback rate: duration:1 delay:1 iterations:2 fill:both playbackRate:-1]
- expected: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/web-animations/timing-model/animation-effects/simple-iteration-progress.html.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[simple-iteration-progress.html]
- type: testharness
- [Test negative playback rate: duration:1 delay:1 fill:both playbackRate:-1]
- expected: FAIL
--- a/testing/web-platform/tests/web-animations/timing-model/animation-effects/current-iteration.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animation-effects/current-iteration.html
@@ -512,17 +512,17 @@ runTests([
{
input: { iterationStart: 0.5,
duration: 100,
delay: 1,
fill: 'both',
endDelay: -50 },
before: 0,
active: 0,
- after: 0
+ after: 1
},
{
input: { iterationStart: 0.5,
duration: 100,
delay: 1,
fill: 'both',
endDelay: -100 },
@@ -534,17 +534,17 @@ runTests([
{
input: { iterations: 2,
duration: 100,
delay: 1,
fill: 'both',
endDelay: -100 },
before: 0,
active: 0,
- after: 0
+ after: 1
},
{
input: { iterations: 1,
iterationStart: 2,
duration: 100,
delay: 1,
fill: 'both',
--- a/testing/web-platform/tests/web-animations/timing-model/animation-effects/simple-iteration-progress.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animation-effects/simple-iteration-progress.html
@@ -503,17 +503,17 @@ runTests([
{
input: { iterationStart: 0.5,
duration: 100,
delay: 1,
fill: 'both',
endDelay: -50 },
before: 0.5,
active: 0.5,
- after: 1
+ after: 0
},
{
input: { iterationStart: 0.5,
duration: 100,
delay: 1,
fill: 'both',
endDelay: -100 },
@@ -525,17 +525,17 @@ runTests([
{
input: { iterations: 2,
duration: 100,
delay: 1,
fill: 'both',
endDelay: -100 },
before: 0,
active: 0,
- after: 1
+ after: 0
},
{
input: { iterations: 1,
iterationStart: 2,
duration: 100,
delay: 1,
fill: 'both',