diff --git a/dom/animation/KeyframeEffect.cpp b/dom/animation/KeyframeEffect.cpp index f2f1c4110ff2..4640f98871bd 100644 --- a/dom/animation/KeyframeEffect.cpp +++ b/dom/animation/KeyframeEffect.cpp @@ -271,7 +271,9 @@ KeyframeEffectReadOnly::GetComputedTimingAt( // The animation isn't active or filling at this time. return result; } - activeTime = result.mActiveDuration; + activeTime = std::max(std::min(result.mActiveDuration, + result.mActiveDuration + aTiming.mEndDelay), + zeroDuration); } else if (localTime < std::min(StickyTimeDuration(aTiming.mDelay), result.mEndTime)) { result.mPhase = ComputedTiming::AnimationPhase::Before; @@ -321,9 +323,19 @@ KeyframeEffectReadOnly::GetComputedTimingAt( // 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.mIterations != 0.0 && + (activeTime != 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. + MOZ_ASSERT(result.mCurrentIteration != 0, + "Should not have zero current iteration"); progress = 1.0; if (result.mCurrentIteration != UINT64_MAX) { result.mCurrentIteration--; diff --git a/layout/style/test/file_animations_effect_timing_enddelay.html b/layout/style/test/file_animations_effect_timing_enddelay.html index fe8c2dbe33df..bd7c5084fe86 100644 --- a/layout/style/test/file_animations_effect_timing_enddelay.html +++ b/layout/style/test/file_animations_effect_timing_enddelay.html @@ -122,19 +122,19 @@ addAsyncAnimTest(function *() { advance_clock(100); yield waitForPaints(); - omta_todo_is(div, "transform", { tx: 50 }, RunningOn.MainThread, + omta_is(div, "transform", { tx: 50 }, RunningOn.MainThread, "Animation is updated on main thread " + "duration 1000, endDelay -500, fill forwards, current time 500"); advance_clock(400); yield waitForPaints(); - omta_todo_is(div, "transform", { tx: 50 }, RunningOn.MainThread, + omta_is(div, "transform", { tx: 50 }, RunningOn.MainThread, "Animation is updated on main thread " + "duration 1000, endDelay -500, fill forwards, current time 900"); advance_clock(100); yield waitForPaints(); - omta_todo_is(div, "transform", { tx: 50 }, RunningOn.MainThread, + omta_is(div, "transform", { tx: 50 }, RunningOn.MainThread, "Animation is updated on main thread " + "duration 1000, endDelay -500, fill forwards, current time 1000"); diff --git a/testing/web-platform/meta/web-animations/interfaces/AnimationEffectTiming/getComputedStyle.html.ini b/testing/web-platform/meta/web-animations/interfaces/AnimationEffectTiming/getComputedStyle.html.ini deleted file mode 100644 index f64ea9109bda..000000000000 --- a/testing/web-platform/meta/web-animations/interfaces/AnimationEffectTiming/getComputedStyle.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[getComputedStyle.html] - type: testharness - [change currentTime when fill forwards and endDelay is negative] - expected: FAIL - bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1283387 diff --git a/testing/web-platform/meta/web-animations/timing-model/animation-effects/active-time.html.ini b/testing/web-platform/meta/web-animations/timing-model/animation-effects/active-time.html.ini deleted file mode 100644 index 8fd0d27a2100..000000000000 --- a/testing/web-platform/meta/web-animations/timing-model/animation-effects/active-time.html.ini +++ /dev/null @@ -1,13 +0,0 @@ -[active-time.html] - type: testharness - [Active time in after phase with forwards fill and negative end delay is the active duration + end delay] - expected: FAIL - bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1283387 - - [Active time in after phase with forwards fill and negative end delay greater in magnitude than the active duration is zero] - expected: FAIL - bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1283387 - - [Active time in after phase with forwards fill and negative end delay greater in magnitude than the sum of the active duration and start delay is zero] - expected: FAIL - bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1283387