Bug 1283387 part 2 - Implement updated calculation of active time in after phase with negative end delay r=hiro

This implements the changes to the specified behavior from the following
changeset:

  a9ba51338e

It also updates test expectations based on the tests updated in part 1 of this
patch series.

MozReview-Commit-ID: HyJC8tHXLYc

--HG--
extra : rebase_source : 6d0f5eb03a2bb4c3938d79dfae7ee433d33fd2b1
This commit is contained in:
Brian Birtles 2016-07-01 09:31:02 +09:00
Родитель e7db0c0103
Коммит c42c3acc9a
4 изменённых файлов: 17 добавлений и 23 удалений

Просмотреть файл

@ -271,7 +271,9 @@ KeyframeEffectReadOnly::GetComputedTimingAt(
// The animation isn't active or filling at this time. // The animation isn't active or filling at this time.
return result; return result;
} }
activeTime = result.mActiveDuration; activeTime = std::max(std::min(result.mActiveDuration,
result.mActiveDuration + aTiming.mEndDelay),
zeroDuration);
} else if (localTime < } else if (localTime <
std::min(StickyTimeDuration(aTiming.mDelay), result.mEndTime)) { std::min(StickyTimeDuration(aTiming.mDelay), result.mEndTime)) {
result.mPhase = ComputedTiming::AnimationPhase::Before; 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 // 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. // 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 && if (result.mPhase == ComputedTiming::AnimationPhase::After &&
progress == 0.0 && 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; progress = 1.0;
if (result.mCurrentIteration != UINT64_MAX) { if (result.mCurrentIteration != UINT64_MAX) {
result.mCurrentIteration--; result.mCurrentIteration--;

Просмотреть файл

@ -122,19 +122,19 @@ addAsyncAnimTest(function *() {
advance_clock(100); advance_clock(100);
yield waitForPaints(); 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 " + "Animation is updated on main thread " +
"duration 1000, endDelay -500, fill forwards, current time 500"); "duration 1000, endDelay -500, fill forwards, current time 500");
advance_clock(400); advance_clock(400);
yield waitForPaints(); 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 " + "Animation is updated on main thread " +
"duration 1000, endDelay -500, fill forwards, current time 900"); "duration 1000, endDelay -500, fill forwards, current time 900");
advance_clock(100); advance_clock(100);
yield waitForPaints(); 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 " + "Animation is updated on main thread " +
"duration 1000, endDelay -500, fill forwards, current time 1000"); "duration 1000, endDelay -500, fill forwards, current time 1000");

Просмотреть файл

@ -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

Просмотреть файл

@ -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