Commit 5d70109b authored by Kevin Ellis's avatar Kevin Ellis Committed by Commit Bot

Revert "Web-animation: Remove some uses of PlayStateUpdateScope."

This reverts commit af74d157.

Reason for revert: pref regression in queuing durations

Original change's description:
> Web-animation: Remove some uses of PlayStateUpdateScope.
> 
> PlayStateUpdateScope is problematic for handling timing of finished
> promises in addition to not conforming with the algorithm outlined in
> the web-animations spec. This patch removes several uses of
> PlayStateUpdateScope and refines handling of pending flags.
> 
> Bug: 960944
> Change-Id: I093a3aa86084adfbe128a5aedd36206d67dd12c8
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1851927
> Commit-Queue: Kevin Ellis <kevers@chromium.org>
> Reviewed-by: Stephen McGruer <smcgruer@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#705966}

TBR=kevers@chromium.org,majidvp@chromium.org,smcgruer@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 960944
Change-Id: Ib16d862d5834f837717e64bb86277860e50ec11a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1866624Reviewed-by: default avatarKevin Ellis <kevers@chromium.org>
Reviewed-by: default avatarMajid Valipour <majidvp@chromium.org>
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707821}
parent 0bc500aa
......@@ -144,12 +144,11 @@ class CORE_EXPORT Animation : public EventTargetWithInlineData,
ScriptPromise ready(ScriptState*);
bool Paused() const {
return CalculateAnimationPlayState() == kPaused && !is_paused_for_testing_;
return GetPlayState() == kPaused && !is_paused_for_testing_;
}
bool Playing() const override {
return CalculateAnimationPlayState() == kRunning && !Limited() &&
!is_paused_for_testing_;
return GetPlayState() == kRunning && !Limited() && !is_paused_for_testing_;
}
// Indicates if the animation is out of sync with the compositor. A change to
......@@ -337,9 +336,6 @@ class CORE_EXPORT Animation : public EventTargetWithInlineData,
void ScheduleAsyncFinish();
void AsyncFinishMicrotask();
void CommitFinishNotification();
void CommitPendingPause(double ready_time);
void CommitPendingPlay(double ready_time);
void ApplyUpdates(double ready_time);
// Tracking the state of animations in dev tools.
void NotifyProbe();
......
......@@ -169,8 +169,6 @@ class AnimationAnimationTestNoCompositing : public RenderingTest {
}
bool SimulateFrame(double time_ms) {
animation->CommitAllUpdatesForTesting();
last_frame_time = time_ms;
const auto* paint_artifact_compositor =
GetDocument().GetFrame()->View()->GetPaintArtifactCompositor();
......@@ -441,8 +439,7 @@ TEST_F(AnimationAnimationTestNoCompositing, StartTimeWithZeroPlaybackRate) {
animation->setPlaybackRate(0);
EXPECT_EQ("running", animation->playState());
SimulateAwaitReady();
EXPECT_EQ("running", animation->playState());
EXPECT_EQ(0, animation->startTime());
EXPECT_FALSE(animation->startTime());
SimulateFrame(10000);
EXPECT_EQ("running", animation->playState());
......
......@@ -82,7 +82,7 @@ test(function() {
test(function() {
var animation = finishedAnimation();
assert_times_equal(animation.startTime, document.timeline.currentTime - (animation.playbackRate * animation.currentTime));
assert_equals(animation.startTime, document.timeline.currentTime - (animation.playbackRate * animation.currentTime));
assert_equals(animation.currentTime, 0);
assert_false(animation.pending);
assert_equals(animation.playState, 'finished');
......@@ -118,7 +118,7 @@ test(function() {
test(function() {
var animation = idleAnimation();
animation.finish();
assert_times_equal(animation.startTime, document.timeline.currentTime - (animation.playbackRate * animation.currentTime));
assert_equals(animation.startTime, document.timeline.currentTime - (animation.playbackRate * animation.currentTime));
assert_equals(animation.currentTime, 0);
assert_false(animation.pending);
assert_equals(animation.playState, 'finished');
......@@ -221,7 +221,7 @@ test(function() {
animation.play();
assert_equals(animation.startTime, startTime);
assert_equals(animation.currentTime, currentTime);
assert_false(animation.pending);
assert_true(animation.pending);
assert_equals(animation.playState, 'running');
}, "Calling play() on a running animation");
......
......@@ -212,7 +212,7 @@ test(function(t) {
animation.play();
assert_equals(animation.startTime, startTime);
assert_equals(animation.currentTime, currentTime);
assert_false(animation.pending);
assert_true(animation.pending);
assert_equals(animation.playState, 'running');
}, "Setting play() on a running animation");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment