diff --git a/devtools/client/inspector/animation/test/summary-graph_end-delay-sign_head.js b/devtools/client/inspector/animation/test/summary-graph_end-delay-sign_head.js index f87a55442003..945cced3a486 100644 --- a/devtools/client/inspector/animation/test/summary-graph_end-delay-sign_head.js +++ b/devtools/client/inspector/animation/test/summary-graph_end-delay-sign_head.js @@ -66,17 +66,16 @@ async function testSummaryGraphEndDelaySign() { "The endDelay sign element should be in animation item element" ); - function assertExpected(key) { - const actual = parseFloat(endDelaySignEl.style[key]); - const expected = parseFloat(expectedResult[key]); - ok( - Math.abs(actual - expected) < 0.01, - `${key} should be ${expected} (got ${actual})` - ); - } - - assertExpected(`marginInlineStart`); - assertExpected(`width`); + is( + endDelaySignEl.style.marginInlineStart, + expectedResult.marginInlineStart, + `marginInlineStart position should be ${expectedResult.marginInlineStart}` + ); + is( + endDelaySignEl.style.width, + expectedResult.width, + `Width should be ${expectedResult.width}` + ); if (expectedResult.additionalClass) { ok( diff --git a/dom/animation/Animation.cpp b/dom/animation/Animation.cpp index bc9e23aca1d6..9363cec76030 100644 --- a/dom/animation/Animation.cpp +++ b/dom/animation/Animation.cpp @@ -926,9 +926,9 @@ void Animation::SetCurrentTimeAsDouble(const Nullable& aCurrentTime, void Animation::Tick(AnimationTimeline::TickState& aTickState) { if (Pending()) { - // Finish pending if we can, but make sure we've seen one existing tick, or - // we've requested to get started via SetPendingReadyTime. - if (!mPendingReadyTime.IsNull() || mSawTickWhilePending) { + // Finish pending if we can, but make sure we've seen one existing tick + // at least. + if (mSawTickWhilePending) { TryTriggerNow(); } mSawTickWhilePending = true; @@ -960,16 +960,6 @@ bool Animation::TryTriggerNow() { if (!Pending()) { return true; } - if (!mPendingReadyTime.IsNull()) { - auto timelineTime = mTimeline->ToTimelineTime(mPendingReadyTime); - MOZ_ASSERT(!timelineTime.IsNull(), - "How? This came from the timeline itself"); - mPendingReadyTime = {}; - if (!timelineTime.IsNull()) { - FinishPendingAt(timelineTime.Value()); - return true; - } - } // If we don't have an active timeline we can't trigger the animation. if (NS_WARN_IF(!mTimeline)) { return false; @@ -1459,7 +1449,7 @@ void Animation::PlayNoUpdate(ErrorResult& aRv, LimitBehavior aLimitBehavior) { } mPendingState = PendingState::PlayPending; - mPendingReadyTime = {}; + mSawTickWhilePending = false; if (Document* doc = GetRenderedDocument()) { if (HasFiniteTimeline()) { @@ -1521,7 +1511,6 @@ void Animation::Pause(ErrorResult& aRv) { } mPendingState = PendingState::PausePending; - mPendingReadyTime = {}; mSawTickWhilePending = false; // See the relevant PlayPending code for comments. diff --git a/dom/animation/Animation.h b/dom/animation/Animation.h index cb0859a4b68d..737be457079b 100644 --- a/dom/animation/Animation.h +++ b/dom/animation/Animation.h @@ -114,9 +114,6 @@ class Animation : public DOMEventTargetHelper, Nullable GetStartTime() const { return mStartTime; } Nullable GetStartTimeAsDouble() const; void SetStartTime(const Nullable& aNewStartTime); - void SetPendingReadyTime(const TimeStamp& aReadyTime) { - mPendingReadyTime = aReadyTime; - } virtual void SetStartTimeAsDouble(const Nullable& aStartTime); // This is deliberately _not_ called GetCurrentTime since that would clash @@ -577,9 +574,6 @@ class Animation : public DOMEventTargetHelper, // Whether the Animation is System, ResistFingerprinting, or neither RTPCallerType mRTPCallerType; - // The time at which our animation should be ready. - TimeStamp mPendingReadyTime; - private: // The id for this animation on the compositor. uint64_t mIdOnCompositor = 0; diff --git a/dom/animation/test/chrome/test_animation_observers_async.html b/dom/animation/test/chrome/test_animation_observers_async.html index 7b1259c713a0..0a69c12c3ef5 100644 --- a/dom/animation/test/chrome/test_animation_observers_async.html +++ b/dom/animation/test/chrome/test_animation_observers_async.html @@ -178,7 +178,7 @@ function runTest() { "getAnimations().length after transition end"); // Wait for the change MutationRecord for seeking the Animation to be - // delivered, followed by the removal MutationRecord. + // delivered, followed by the the removal MutationRecord. return waitForFrame(); }).then(() => { assert_records([{ added: [], changed: animations, removed: [] }, @@ -553,7 +553,7 @@ promise_test(t => { p => ({ added: [], changed: [p], removed: [] }) ); - return Promise.all(animations.map(animation => animation.finished)); + return await_event(div, "animationend"); }).then(() => { // After the changed notifications, which will be dispatched in the order that // the animations were seeked, we should get removal MutationRecords in order diff --git a/gfx/layers/AnimationInfo.cpp b/gfx/layers/AnimationInfo.cpp index 81d11f672c23..1600d40c8985 100644 --- a/gfx/layers/AnimationInfo.cpp +++ b/gfx/layers/AnimationInfo.cpp @@ -493,14 +493,10 @@ void AnimationInfo::AddAnimationForProperty( animSegment->sampleFn() = segment.mTimingFunction; } - if (aAnimation->Pending()) { - const TimeStamp readyTime = - aFrame->PresContext()->RefreshDriver()->MostRecentRefresh( - /* aEnsureTimerStarted= */ false); - MOZ_ASSERT(!readyTime.IsNull()); - aAnimation->SetPendingReadyTime(readyTime); - MaybeStartPendingAnimation(*animation, readyTime); - } + const TimeStamp readyTime = + aFrame->PresContext()->RefreshDriver()->MostRecentRefresh( + /* aEnsureTimerStarted= */ false); + MaybeStartPendingAnimation(*animation, readyTime); } // Let's use an example to explain this function: @@ -604,8 +600,8 @@ bool AnimationInfo::AddAnimationsForProperty( // Currently this only happens when the timeline is driven by a refresh // driver under test control. In this case, the next time the refresh // driver is advanced it will trigger any pending animations. - if (anim->Pending() && anim->GetTimeline() && - !anim->GetTimeline()->TracksWallclockTime()) { + if (anim->Pending() && + (anim->GetTimeline() && !anim->GetTimeline()->TracksWallclockTime())) { continue; }