diff --git a/third_party/blink/renderer/core/animation/animation.cc b/third_party/blink/renderer/core/animation/animation.cc index 4c1f968d330966..b0c69c73b04d39 100644 --- a/third_party/blink/renderer/core/animation/animation.cc +++ b/third_party/blink/renderer/core/animation/animation.cc @@ -276,8 +276,6 @@ base::Optional Animation::TimelineTime() const { // https://drafts.csswg.org/web-animations/#setting-the-current-time-of-an-animation. void Animation::setCurrentTime(base::Optional new_current_time, ExceptionState& exception_state) { - // TODO(crbug.com/924159): Update this after we add support for inactive - // timelines and unresolved timeline.currentTime if (!new_current_time) { // If the current time is resolved, then throw a TypeError. if (CurrentTimeInternal()) { @@ -446,7 +444,7 @@ bool Animation::PreCommit( return true; } -void Animation::PostCommit(double timeline_time) { +void Animation::PostCommit() { compositor_pending_ = false; if (!compositor_state_ || compositor_state_->pending_action == kNone) @@ -896,10 +894,11 @@ const char* Animation::PlayStateString(AnimationPlayState play_state) { Animation::AnimationPlayState Animation::CalculateAnimationPlayState() const { // 1. All of the following conditions are true: // * The current time of animation is unresolved, and + // * the start time of animation is unresolved, and // * animation does not have either a pending play task or a pending pause // task, // then idle. - if (!CurrentTimeInternal() && !PendingInternal()) + if (!CurrentTimeInternal() && !start_time_ && !PendingInternal()) return kIdle; // 2. Either of the following conditions are true: @@ -974,18 +973,36 @@ void Animation::pause(ExceptionState& exception_state) { if (pending_pause_ || CalculateAnimationPlayState() == kPaused) return; - // 3. If the animation’s current time is unresolved, perform the steps + // 3. Let has finite timeline be true if animation has an associated timeline + // that is not monotonically increasing. + bool has_finite_timeline = + timeline_ && !timeline_->IsMonotonicallyIncreasing(); + + // 4. If the animation’s current time is unresolved, perform the steps // according to the first matching condition from below: - // 3a. If animation’s playback rate is ≥ 0, - // Let animation’s hold time be zero. - // 3b. Otherwise, - // If associated effect end for animation is positive infinity, throw an - // "InvalidStateError" DOMException and abort these steps. Otherwise, - // let animation’s hold time be associated effect end. + // 4a. If animation’s playback rate is ≥ 0, + // Update either animation’s start time or hold time as follows: + // If has finite timeline is true, + // Set animation’s start time to zero. + // Otherwise, + // Set animation’s hold time to zero. + // 4b. Otherwise, + // If associated effect end for animation is positive infinity, + // throw an "InvalidStateError" DOMException and abort these + // steps. + // Otherwise, + // Update either animation’s start time or hold time as follows: + // If has finite timeline is true, + // let animation’s start time be associated effect end. + // Otherwise, + // let animation’s hold time be associated effect end. base::Optional current_time = CurrentTimeInternal(); if (!current_time) { if (playback_rate_ >= 0) { - hold_time_ = 0; + if (has_finite_timeline) + start_time_ = 0; + else + hold_time_ = 0; } else { if (EffectEnd() == std::numeric_limits::infinity()) { exception_state.ThrowDOMException( @@ -993,30 +1010,35 @@ void Animation::pause(ExceptionState& exception_state) { "Cannot play reversed Animation with infinite target effect end."); return; } - hold_time_ = EffectEnd(); + if (has_finite_timeline) + start_time_ = EffectEnd(); + else + hold_time_ = EffectEnd(); } } - // 4. Let has pending ready promise be a boolean flag that is initially false. - // 5. If animation has a pending play task, cancel that task and let has + // 5. Let has pending ready promise be a boolean flag that is initially false. + // 6. If animation has a pending play task, cancel that task and let has // pending ready promise be true. - // 6. If has pending ready promise is false, set animation’s current ready + // 7. If has pending ready promise is false, set animation’s current ready // promise to a new promise in the relevant Realm of animation. if (pending_play_) pending_play_ = false; else if (ready_promise_) ready_promise_->Reset(); - // 7. Schedule a task to be executed at the first possible moment after the - // user agent has performed any processing necessary to suspend the - // playback of animation’s associated effect, if any. + // 8. Schedule a task to be executed at the first possible moment where both + // of the following conditions are true: + // 8a. the user agent has performed any processing necessary to suspend + // the playback of animation’s associated effect, if any. + // 8b. the animation is associated with a timeline that is not inactive. pending_pause_ = true; pending_play_ = false; SetOutdated(); SetCompositorPending(false); - // 8. Run the procedure to update an animation’s finished state for animation + // 9. Run the procedure to update an animation’s finished state for animation // with the did seek flag set to false (continuous) , and thesynchronously // notify flag set to false. UpdateFinishedState(UpdateType::kContinuous, NotificationType::kAsync); @@ -1049,51 +1071,63 @@ void Animation::PlayInternal(AutoRewind auto_rewind, // 1. Let aborted pause be a boolean flag that is true if animation has a // pending pause task, and false otherwise. // 2. Let has pending ready promise be a boolean flag that is initially false. + // 3. Let performed seek be a boolean flag that is initially false. + // 4. Let has finite timeline be true if animation has an associated timeline + // that is not monotonically increasing. bool aborted_pause = pending_pause_; bool has_pending_ready_promise = false; + bool performed_seek = false; + bool has_finite_timeline = + timeline_ && !timeline_->IsMonotonicallyIncreasing(); - // 3. Perform the steps corresponding to the first matching condition from the + // 5. Perform the steps corresponding to the first matching condition from the // following, if any: // - // 3a If animation’s effective playback rate > 0, the auto-rewind flag is true + // 5a If animation’s effective playback rate > 0, the auto-rewind flag is true // and either animation’s: // current time is unresolved, or // current time < zero, or // current time ≥ target effect end, - // Set animation’s hold time to zero. + // 5a1. Set performed seek to true. + // 5a2. Update either animation’s start time or hold time as follows: + // If has finite timeline is true, + // Set animation’s start time to zero. + // Otherwise, + // Set animation’s hold time to zero. // - // 3b If animation’s effective playback rate < 0, the auto-rewind flag is true + // 5b If animation’s effective playback rate < 0, the auto-rewind flag is true // and either animation’s: // current time is unresolved, or // current time ≤ zero, or // current time > target effect end, - // If target effect end is positive infinity, throw an "InvalidStateError" - // DOMException and abort these steps. Otherwise, set animation’s hold time - // to target effect end. + // 5b1.If associated effect end is positive infinity, + // throw an "InvalidStateError" DOMException and abort these steps. + // 5b2.Otherwise, + // 5b2a Set performed seek to true. + // 5b2b Update either animation’s start time or hold time as follows: + // If has finite timeline is true, + // Set animation’s start time to associated effect end. + // Otherwise, + // Set animation’s hold time to associated effect end. // - // 3c If animation’s effective playback rate = 0 and animation’s current time + // 5c If animation’s effective playback rate = 0 and animation’s current time // is unresolved, - // Set animation’s hold time to zero. + // 5c1. Set performed seek to true. + // 5c2. Update either animation’s start time or hold time as follows: + // If has finite timeline is true, + // Set animation’s start time to zero. + // Otherwise, + // Set animation’s hold time to zero. double effective_playback_rate = EffectivePlaybackRate(); base::Optional current_time = CurrentTimeInternal(); - // TODO(crbug.com/1012073): This should be able to be extracted into a - // function in AnimationTimeline that each child class can override for their - // own special behavior. - double initial_hold_time = 0; - if (timeline_ && timeline_->IsScrollTimeline() && timeline_->IsActive()) { - base::Optional timeline_time = timeline_->CurrentTimeSeconds(); - if (timeline_time) { - // TODO(crbug.com/924159): Once inactive timelines are supported we need - // to re-evaluate if it is desired behavior to adjust the hold time when - // playback rate is set before play(). - initial_hold_time = timeline_time.value() * effective_playback_rate; - } - } - if (effective_playback_rate > 0 && auto_rewind == AutoRewind::kEnabled && (!current_time || current_time < 0 || current_time >= EffectEnd())) { - hold_time_ = initial_hold_time; + performed_seek = true; + if (has_finite_timeline) + start_time_ = 0; + else + hold_time_ = 0; } else if (effective_playback_rate < 0 && auto_rewind == AutoRewind::kEnabled && (!current_time || current_time <= 0 || @@ -1104,44 +1138,54 @@ void Animation::PlayInternal(AutoRewind auto_rewind, "Cannot play reversed Animation with infinite target effect end."); return; } - hold_time_ = initial_hold_time + EffectEnd(); + performed_seek = true; + if (has_finite_timeline) + start_time_ = EffectEnd(); + else + hold_time_ = EffectEnd(); } else if (effective_playback_rate == 0 && !current_time) { - hold_time_ = initial_hold_time; + performed_seek = true; + if (has_finite_timeline) + start_time_ = 0; + else + hold_time_ = 0; } - // 4. If animation has a pending play task or a pending pause task, - // 4.1 Cancel that task. - // 4.2 Set has pending ready promise to true. + // 6. If animation has a pending play task or a pending pause task, + // 6.1 Cancel that task. + // 6.2 Set has pending ready promise to true. if (pending_play_ || pending_pause_) { pending_play_ = pending_pause_ = false; has_pending_ready_promise = true; } - // 5. If the following three conditions are all satisfied: + // 7. If the following three conditions are all satisfied: // animation’s hold time is unresolved, and + // performed seek is false, and // aborted pause is false, and // animation does not have a pending playback rate, // abort this procedure. - if (!hold_time_ && !aborted_pause && !pending_playback_rate_) + if (!hold_time_ && !performed_seek && !aborted_pause && + !pending_playback_rate_) return; - // 6. If animation’s hold time is resolved, let its start time be unresolved. + // 8. If animation’s hold time is resolved, let its start time be unresolved. if (hold_time_) start_time_ = base::nullopt; - // 7. If has pending ready promise is false, let animation’s current ready + // 9. If has pending ready promise is false, let animation’s current ready // promise be a new promise in the relevant Realm of animation. if (ready_promise_ && !has_pending_ready_promise) ready_promise_->Reset(); - // 8. Schedule a task to run as soon as animation is ready. + // 10. Schedule a task to run as soon as animation is ready. pending_play_ = true; finished_ = false; committed_finish_notification_ = false; SetOutdated(); SetCompositorPending(/*effect_changed=*/false); - // 9. Run the procedure to update an animation’s finished state for animation + // 11. Run the procedure to update an animation’s finished state for animation // with the did seek flag set to false, and the synchronously notify flag // set to false. // Boolean valued arguments replaced with enumerated values for clarity. @@ -1198,6 +1242,13 @@ void Animation::reverse(ExceptionState& exception_state) { // https://drafts.csswg.org/web-animations/#finishing-an-animation-section void Animation::finish(ExceptionState& exception_state) { + // TODO(crbug.com/916117): Implement finish for scroll-linked animations. + if (timeline_ && timeline_->IsScrollTimeline()) { + exception_state.ThrowDOMException( + DOMExceptionCode::kNotSupportedError, + "Scroll-linked WebAnimation currently does not support finish."); + return; + } if (!EffectivePlaybackRate()) { exception_state.ThrowDOMException( DOMExceptionCode::kInvalidStateError, @@ -1527,9 +1578,6 @@ void Animation::ApplyPendingPlaybackRate() { void Animation::setPlaybackRate(double playback_rate, ExceptionState& exception_state) { - // TODO(crbug.com/924159): Update this after we add support for inactive - // timelines and unresolved timeline.currentTime - base::Optional start_time_before = start_time_; // 1. Clear any pending playback rate on animation. diff --git a/third_party/blink/renderer/core/animation/animation.h b/third_party/blink/renderer/core/animation/animation.h index 95dfc5cd6de2ec..c9bb999fd50460 100644 --- a/third_party/blink/renderer/core/animation/animation.h +++ b/third_party/blink/renderer/core/animation/animation.h @@ -250,7 +250,7 @@ class CORE_EXPORT Animation : public EventTargetWithInlineData, bool PreCommit(int compositor_group, const PaintArtifactCompositor*, bool start_on_compositor); - void PostCommit(double timeline_time); + void PostCommit(); unsigned SequenceNumber() const override { return sequence_number_; } diff --git a/third_party/blink/renderer/core/animation/animation_test.cc b/third_party/blink/renderer/core/animation/animation_test.cc index bb16df404d7deb..5b1f9c6be16893 100644 --- a/third_party/blink/renderer/core/animation/animation_test.cc +++ b/third_party/blink/renderer/core/animation/animation_test.cc @@ -1439,7 +1439,7 @@ TEST_F(AnimationAnimationTestNoCompositing, ScrollLinkedAnimationCreation) { scroll_animation->play(); // Verify start and current times in Pending state. - EXPECT_FALSE(scroll_animation->startTime().has_value()); + EXPECT_EQ(0, scroll_animation->startTime()); EXPECT_EQ(20, scroll_animation->currentTime()); UpdateAllLifecyclePhasesForTest(); diff --git a/third_party/blink/renderer/core/animation/pending_animations.cc b/third_party/blink/renderer/core/animation/pending_animations.cc index bdc657ed8b6350..86bb3a9b3f97b2 100644 --- a/third_party/blink/renderer/core/animation/pending_animations.cc +++ b/third_party/blink/renderer/core/animation/pending_animations.cc @@ -95,6 +95,8 @@ bool PendingAnimations::Update( if (animation->Playing() && !animation->startTime()) { waiting_for_start_time.push_back(animation.Get()); } else if (animation->PendingInternal()) { + DCHECK(animation->timeline()->IsActive() && + animation->timeline()->CurrentTimeSeconds()); // A pending animation that is not waiting on a start time does not need // to be synchronized with animations that are starting up. Nonetheless, // it needs to notify the animation to resolve the ready promise and @@ -117,18 +119,16 @@ bool PendingAnimations::Update( } else { for (auto& animation : waiting_for_start_time) { DCHECK(!animation->startTime()); - // TODO(crbug.com/916117): Handle start time of scroll-linked animations. + DCHECK(animation->timeline()->IsActive() && + animation->timeline()->CurrentTimeSeconds()); animation->NotifyReady( animation->timeline()->CurrentTimeSeconds().value_or(0)); } } // FIXME: The postCommit should happen *after* the commit, not before. - for (auto& animation : animations) { - // TODO(crbug.com/916117): Handle NaN current time of scroll timeline. - animation->PostCommit( - animation->timeline()->CurrentTimeSeconds().value_or(0)); - } + for (auto& animation : animations) + animation->PostCommit(); DCHECK(pending_.IsEmpty()); for (auto& animation : deferred) @@ -208,8 +208,8 @@ void PendingAnimations::FlushWaitingNonCompositedAnimations() { if (animation->HasActiveAnimationsOnCompositor()) { waiting_for_compositor_animation_start_.push_back(animation); } else { - // TODO(crbug.com/916117): Handle start time of scroll-linked - // animations. + DCHECK(animation->timeline()->IsActive() && + animation->timeline()->CurrentTimeSeconds()); animation->NotifyReady( animation->timeline()->CurrentTimeSeconds().value_or(0)); } diff --git a/third_party/blink/web_tests/external/wpt/scroll-animations/element-based-offset.html b/third_party/blink/web_tests/external/wpt/scroll-animations/element-based-offset.html index 1c7d99822855e6..064ab4c5f3ae43 100644 --- a/third_party/blink/web_tests/external/wpt/scroll-animations/element-based-offset.html +++ b/third_party/blink/web_tests/external/wpt/scroll-animations/element-based-offset.html @@ -89,6 +89,10 @@ endScrollOffset: {target: end, ...config.end } }); + // Wait for new animation frame which allows the timeline to compute new + // current time. + await waitForNextFrame(); + const animation = createScrollLinkedAnimation(t, timeline); const scrollRange = end.offsetTop - start.offsetTop; const timeRange = animation.timeline.timeRange; @@ -100,11 +104,12 @@ "The start time is null in Idle state."); animation.play(); + assert_true(animation.pending, "Animation is in pending state."); // Verify initial start and current times in Pending state. assert_times_equal(animation.currentTime, 0, - "The current time is a hold time in Pending state."); - assert_equals(animation.startTime, null, - "The start time is null in Pending state."); + "The current time is zero in Pending state."); + assert_equals(animation.startTime, 0, + "The start time is zero in Pending state."); await animation.ready; // Verify initial start and current times in Playing state. diff --git a/third_party/blink/web_tests/external/wpt/scroll-animations/scroll-animation-inactive-timeline.html b/third_party/blink/web_tests/external/wpt/scroll-animations/scroll-animation-inactive-timeline.html new file mode 100644 index 00000000000000..07dae95692eb58 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/scroll-animations/scroll-animation-inactive-timeline.html @@ -0,0 +1,144 @@ + + +Test basic functionality of scroll linked animation. + + + + + +
+ \ No newline at end of file diff --git a/third_party/blink/web_tests/external/wpt/scroll-animations/scroll-animation.html b/third_party/blink/web_tests/external/wpt/scroll-animations/scroll-animation.html index 901549e7a44545..cb270d52f7c406 100644 --- a/third_party/blink/web_tests/external/wpt/scroll-animations/scroll-animation.html +++ b/third_party/blink/web_tests/external/wpt/scroll-animations/scroll-animation.html @@ -23,7 +23,10 @@ const animation = createScrollLinkedAnimation(t); const scroller = animation.timeline.scrollSource; const maxScroll = scroller.scrollHeight - scroller.clientHeight; - const timeRange = animation.timeline.timeRange; + + // Wait for new animation frame which allows the timeline to compute new + // current time. + await waitForNextFrame(); // Verify initial start and current times in Idle state. assert_equals(animation.currentTime, null, @@ -31,11 +34,12 @@ assert_equals(animation.startTime, null, "The start time is null in Idle state."); animation.play(); + assert_true(animation.pending, "Animation is in pending state."); // Verify initial start and current times in Pending state. assert_equals(animation.currentTime, 0, - "The current time is a hold time in Pending state."); - assert_equals(animation.startTime, null, - "The start time is null in Pending state."); + "The current time is zero in Pending state."); + assert_equals(animation.startTime, 0, + "The start time is zero in Pending state."); await animation.ready; // Verify initial start and current times in Playing state. @@ -62,7 +66,7 @@ const animation = createScrollLinkedAnimation(t); const scroller = animation.timeline.scrollSource; const maxScroll = scroller.scrollHeight - scroller.clientHeight; - const timeRange = animation.timeline.timeRange; + // Advance the scroller. scroller.scrollTop = 0.2 * maxScroll; // Wait for new animation frame which allows the timeline to compute new @@ -78,8 +82,8 @@ // Verify initial start and current times in Pending state. assert_equals(animation.currentTime, animation.timeline.currentTime, "The current time is a hold time in Pending state."); - assert_equals(animation.startTime, null, - "The start time is null in Pending state."); + assert_equals(animation.startTime, 0, + "The start time is zero in Pending state."); await animation.ready; // Verify initial start and current times in Playing state. @@ -96,7 +100,7 @@ const animation2 = createScrollLinkedAnimation(t, timeline); const scroller = timeline.scrollSource; const maxScroll = scroller.scrollHeight - scroller.clientHeight; - const timeRange = timeline.timeRange; + // Advance the scroller. scroller.scrollTop = 0.2 * maxScroll; // Wait for new animation frame which allows the timeline to compute new @@ -118,13 +122,13 @@ assert_equals(animation1.currentTime, timeline.currentTime, "The current time corresponds to the scroll position of the scroller" + " in Pending state."); - assert_equals(animation1.startTime, null, - "The start time is null in Pending state."); + assert_equals(animation1.startTime, 0, + "The start time is zero in Pending state."); assert_equals(animation2.currentTime, timeline.currentTime, "The current time corresponds to the scroll position of the scroller" + " in Pending state."); - assert_equals(animation2.startTime, null, - "The start time is null in Pending state."); + assert_equals(animation2.startTime, 0, + "The start time is zero in Pending state."); await animation1.ready; await animation2.ready; @@ -140,30 +144,6 @@ }, 'Animation start and current times are correct when multiple animations' + ' are attached to the same timeline.'); -promise_test(async t => { - const animation = createScrollLinkedAnimation(t); - const scroller = animation.timeline.scrollSource; - // Make the scroll timeline inactive. - scroller.style.overflow = "visible"; - // Trigger layout; - scroller.scrollTop; - assert_equals(animation.timeline.currentTime, null, - "Timeline current time is null in inactive state."); - // Play the animation when the timeline is inactive. - animation.play(); - // Make the scroll timeline active. - scroller.style.overflow = "auto"; - await animation.ready; - // Ready promise is resolved as a result of the timeline becoming active. - assert_equals(animation.timeline.currentTime, 0, - "Timeline current time is resolved in active state."); - assert_equals(animation.currentTime, 0, - "Animation current time is resolved when the animation is ready."); - assert_equals(animation.startTime, 0, - "Animation start time is resolved when the animation is ready."); -}, 'Animation start and current times are correct if scroll timeline is ' + - 'activated after animation.play call.'); - promise_test(async t => { const animation = createScrollLinkedAnimation(t); const scroller = animation.timeline.scrollSource; diff --git a/third_party/blink/web_tests/external/wpt/scroll-animations/setting-current-time.html b/third_party/blink/web_tests/external/wpt/scroll-animations/setting-current-time.html index 0b7dcc60034d16..d46206d8257702 100644 --- a/third_party/blink/web_tests/external/wpt/scroll-animations/setting-current-time.html +++ b/third_party/blink/web_tests/external/wpt/scroll-animations/setting-current-time.html @@ -223,5 +223,71 @@ " source has been scrolled." ); }, 'Set Animation current time then scroll.'); + + promise_test(async t => { + const animation = createScrollLinkedAnimation(t); + const scroller = animation.timeline.scrollSource; + + // Wait for new animation frame which allows the timeline to compute new + // current time. + await waitForNextFrame(); + animation.play(); + await animation.ready; + + // Make the timeline inactive. + scroller.style.overflow = 'visible'; + scroller.scrollTop; + await waitForNextFrame(); + + assert_equals(animation.currentTime, null, + 'Current time is unresolved when the timeline is inactive.'); + + animation.currentTime = 300; + assert_equals(animation.currentTime, 300, + 'Animation current time should be equal to the set value.'); + assert_equals(animation.playState, 'paused', + 'Animation play state is \'paused\' when current time is set and ' + + 'timeline is inactive.'); +}, 'Animation current time and play state are correct when current time is ' + + 'set while the timeline is inactive.'); + +promise_test(async t => { + const animation = createScrollLinkedAnimation(t); + const scroller = animation.timeline.scrollSource; + + // Wait for new animation frame which allows the timeline to compute new + // current time. + await waitForNextFrame(); + animation.play(); + await animation.ready; + + // Make the timeline inactive. + scroller.style.overflow = 'visible'; + scroller.scrollTop; + await waitForNextFrame(); + + assert_equals(animation.timeline.currentTime, null, + 'Current time is unresolved when the timeline is inactive.'); + + animation.currentTime = 300; + assert_equals(animation.currentTime, 300, + 'Animation current time should be equal to the set value.'); + assert_equals(animation.playState, 'paused', + 'Animation play state is \'paused\' when current time is set and ' + + 'timeline is inactive.'); + + // Make the timeline active. + scroller.style.overflow = 'auto'; + scroller.scrollTop; + await waitForNextFrame(); + + assert_equals(animation.timeline.currentTime, 0, + 'Current time is resolved when the timeline is active.'); + assert_equals(animation.currentTime, 300, + 'Animation current time holds the set value.'); + assert_equals(animation.playState, 'paused', + 'Animation holds \'paused\' state.'); +}, 'Animation current time set while the timeline is inactive holds when the ' + + 'timeline becomes active again.'); diff --git a/third_party/blink/web_tests/external/wpt/scroll-animations/testcommon.js b/third_party/blink/web_tests/external/wpt/scroll-animations/testcommon.js index 2a89d8e022f2ee..733b5f9f643ee4 100644 --- a/third_party/blink/web_tests/external/wpt/scroll-animations/testcommon.js +++ b/third_party/blink/web_tests/external/wpt/scroll-animations/testcommon.js @@ -27,7 +27,7 @@ function createScrollLinkedAnimation(test, timeline) { if (timeline === undefined) timeline = createScrollTimeline(test); const DURATION = 1000; // ms - const KEYFRAMES = { opacity: [1, 0] }; + const KEYFRAMES = { opacity: [0, 1] }; return new Animation( new KeyframeEffect(createDiv(test), KEYFRAMES, DURATION), timeline); } diff --git a/third_party/blink/web_tests/external/wpt/web-animations/interfaces/Animation/pending.html b/third_party/blink/web_tests/external/wpt/web-animations/interfaces/Animation/pending.html index fe7efe05aafa9a..c200f9e97739e8 100644 --- a/third_party/blink/web_tests/external/wpt/web-animations/interfaces/Animation/pending.html +++ b/third_party/blink/web_tests/external/wpt/web-animations/interfaces/Animation/pending.html @@ -31,5 +31,25 @@ }); }, 'reports true -> false when paused'); +promise_test(async t => { + const animation = + new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC), + null); + animation.play(); + assert_true(animation.pending); + await waitForAnimationFrames(2); + assert_true(animation.pending); +}, 'reports true -> true when played without a timeline'); + +promise_test(async t => { + const animation = + new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC), + null); + animation.pause(); + assert_true(animation.pending); + await waitForAnimationFrames(2); + assert_true(animation.pending); +}, 'reports true -> true when paused without a timeline'); + diff --git a/third_party/blink/web_tests/external/wpt/web-animations/timing-model/animations/setting-the-timeline-of-an-animation.html b/third_party/blink/web_tests/external/wpt/web-animations/timing-model/animations/setting-the-timeline-of-an-animation.html index dd8617503951aa..7e98ef4260f778 100644 --- a/third_party/blink/web_tests/external/wpt/web-animations/timing-model/animations/setting-the-timeline-of-an-animation.html +++ b/third_party/blink/web_tests/external/wpt/web-animations/timing-model/animations/setting-the-timeline-of-an-animation.html @@ -60,7 +60,7 @@ new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC), null); animation.startTime = document.timeline.currentTime; - assert_equals(animation.playState, 'idle'); + assert_equals(animation.playState, 'running'); animation.timeline = document.timeline; @@ -73,7 +73,7 @@ new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC), null); animation.startTime = document.timeline.currentTime - 200 * MS_PER_SEC; - assert_equals(animation.playState, 'idle'); + assert_equals(animation.playState, 'running'); animation.timeline = document.timeline;