E53D [web-animations-1] Fix play an animation procedure by birtles · Pull Request #7148 · w3c/csswg-drafts · GitHub
[go: up one dir, main page]

Skip to content

Conversation

birtles
Copy link
Contributor
@birtles birtles commented Mar 17, 2022

Fixes #7145.

@birtles birtles force-pushed the fix-play-rewinding branch from 037d96d to 27500f7 Compare March 18, 2022 01:08
@birtles birtles requested review from flackr and graouts March 18, 2022 01:08
@birtles
Copy link
Contributor Author
birtles commented Mar 18, 2022

This patch makes the following changes:

  • Consistently applies auto-rewind seeking only when the auto-rewind flag is set. Previously there was an inconsistency where we would not check the auto-rewind flag when the effective playback rate was zero.

  • Makes the play procedure play an idle animation even when the auto-rewind flag is set to false.

  • Makes the procedure to seamlessly update an animation's playback rate immediately apply the playback rate if the animation is running but has an unresolved current time and no pending play task, rather than attempting to play such an animation.

Fixes w3c#7145.

This patch makes the following changes:

- Consistently applies auto-rewind seeking only when the auto-rewind
  flag is set. Previously there was an inconsistency where we would not
  check the auto-rewind flag when the effective playback rate was zero.

- Makes the play procedure play an idle animation even when the
  auto-rewind flag is set to false.

- Makes the procedure to seamlessly update an animation's playback rate
  immediately apply the playback rate if the animation is running but
  has an unresolved current time and no pending play task, rather than
  attempting to play such an animation.
@birtles birtles force-pushed the fix-play-rewinding branch from 27500f7 to 60df646 Compare March 18, 2022 01:21
Copy link
Contributor
@flackr flackr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all looks good to me, thanks!

@birtles
Copy link
Contributor Author
birtles commented Mar 19, 2022

This all looks good to me, thanks!

Thanks! I'll wait to hear what @graouts thinks about the testing situation etc. before merging.

@graouts
Copy link
Contributor
graouts commented Mar 21, 2022

Thanks! I'll wait to hear what @graouts thinks about the testing situation etc. before merging.

It looks great!

@birtles birtles merged commit fe001f0 into w3c:main Mar 22, 2022
@birtles
Copy link
Contributor Author
birtles commented Mar 22, 2022

It looks great!

Thank you!

@birtles birtles deleted the fix-play-rewinding branch March 22, 2022 06:56
moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Mar 23, 2022
…te() and UpdatePlaybackRate().

Based on the spec [1], the unresolved current time should be checked only if
the auto-rewind flag is ture. Otherwise, the null timeline with the false
auto-rewind flag may get an InvalidStateError DOMException if its effect end
is positive infinity.

Note:
If the animation has no associated timeline, it's current time is
unresolved [2].

Besides, we also tweak the handle for unresolved current time based on the
spec PR: w3c/csswg-drafts#7148, in
UpdatePlaybackRate() and PlayNoUpdate().

Note:
CSS animations and CSS transitions set auto-rewind flag to false [3], and
the current time is unresolved (because the start time and the hold time
are all unresolved), and so the seek time is unresolved as well, especially
when we build a new CSS animation or CSS transition. Therefore we have to
avoid the unresolved seek time to let PlayNoUpdate() early return.

[1] https://drafts.csswg.org/web-animations-1/#playing-an-animation-section
[2] https://drafts.csswg.org/web-animations-1/#animation-current-time
[3] https://drafts.csswg.org/css-animations-2/#animation-play-state

See the spec issue: w3c/csswg-drafts#7145 for
more details.

Differential Revision: https://phabricator.services.mozilla.com/D140682

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1758527
gecko-commit: e34abd14507f5deb4f3e110a9c07156b5ccc54ea
gecko-reviewers: birtles
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Mar 23, 2022
… in PlayNoUpdate() and UpdatePlaybackRate(). r=birtles

Based on the spec [1], the unresolved current time should be checked only if
the auto-rewind flag is ture. Otherwise, the null timeline with the false
auto-rewind flag may get an InvalidStateError DOMException if its effect end
is positive infinity.

Note:
If the animation has no associated timeline, it's current time is
unresolved [2].

Besides, we also tweak the handle for unresolved current time based on the
spec PR: w3c/csswg-drafts#7148, in
UpdatePlaybackRate() and PlayNoUpdate().

Note:
CSS animations and CSS transitions set auto-rewind flag to false [3], and
the current time is unresolved (because the start time and the hold time
are all unresolved), and so the seek time is unresolved as well, especially
when we build a new CSS animation or CSS transition. Therefore we have to
avoid the unresolved seek time to let PlayNoUpdate() early return.

[1] https://drafts.csswg.org/web-animations-1/#playing-an-animation-section
[2] https://drafts.csswg.org/web-animations-1/#animation-current-time
[3] https://drafts.csswg.org/css-animations-2/#animation-play-state

See the spec issue: w3c/csswg-drafts#7145 for
more details.

Differential Revision: https://phabricator.services.mozilla.com/D140682
moz-wptsync-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Mar 23, 2022
…te() and UpdatePlaybackRate().

Based on the spec [1], the unresolved current time should be checked only if
the auto-rewind flag is ture. Otherwise, the null timeline with the false
auto-rewind flag may get an InvalidStateError DOMException if its effect end
is positive infinity.

Note:
If the animation has no associated timeline, it's current time is
unresolved [2].

Besides, we also tweak the handle for unresolved current time based on the
spec PR: w3c/csswg-drafts#7148, in
UpdatePlaybackRate() and PlayNoUpdate().

Note:
CSS animations and CSS transitions set auto-rewind flag to false [3], and
the current time is unresolved (because the start time and the hold time
are all unresolved), and so the seek time is unresolved as well, especially
when we build a new CSS animation or CSS transition. Therefore we have to
avoid the unresolved seek time to let PlayNoUpdate() early return.

[1] https://drafts.csswg.org/web-animations-1/#playing-an-animation-section
[2] https://drafts.csswg.org/web-animations-1/#animation-current-time
[3] https://drafts.csswg.org/css-animations-2/#animation-play-state

See the spec issue: w3c/csswg-drafts#7145 for
more details.

Differential Revision: https://phabricator.services.mozilla.com/D140682

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1758527
gecko-commit: e34abd14507f5deb4f3e110a9c07156b5ccc54ea
gecko-reviewers: birtles
DanielRyanSmith pushed a commit to DanielRyanSmith/wpt that referenced this pull request Mar 25, 2022
…te() and UpdatePlaybackRate().

Based on the spec [1], the unresolved current time should be checked only if
the auto-rewind flag is ture. Otherwise, the null timeline with the false
auto-rewind flag may get an InvalidStateError DOMException if its effect end
is positive infinity.

Note:
If the animation has no associated timeline, it's current time is
unresolved [2].

Besides, we also tweak the handle for unresolved current time based on the
spec PR: w3c/csswg-drafts#7148, in
UpdatePlaybackRate() and PlayNoUpdate().

Note:
CSS animations and CSS transitions set auto-rewind flag to false [3], and
the current time is unresolved (because the start time and the hold time
are all unresolved), and so the seek time is unresolved as well, especially
when we build a new CSS animation or CSS transition. Therefore we have to
avoid the unresolved seek time to let PlayNoUpdate() early return.

[1] https://drafts.csswg.org/web-animations-1/#playing-an-animation-section
[2] https://drafts.csswg.org/web-animations-1/#animation-current-time
[3] https://drafts.csswg.org/css-animations-2/#animation-play-state

See the spec issue: w3c/csswg-drafts#7145 for
more details.

Differential Revision: https://phabricator.services.mozilla.com/D140682

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1758527
gecko-commit: e34abd14507f5deb4f3e110a9c07156b5ccc54ea
gecko-reviewers: birtles
aosmond pushed a commit to aosmond/gecko that referenced this pull request Mar 26, 2022
… in PlayNoUpdate() and UpdatePlaybackRate(). r=birtles

Based on the spec [1], the unresolved current time should be checked only if
the auto-rewind flag is ture. Otherwise, the null timeline with the false
auto-rewind flag may get an InvalidStateError DOMException if its effect end
is positive infinity.

Note:
If the animation has no associated timeline, it's current time is
unresolved [2].

Besides, we also tweak the handle for unresolved current time based on the
spec PR: w3c/csswg-drafts#7148, in
UpdatePlaybackRate() and PlayNoUpdate().

Note:
CSS animations and CSS transitions set auto-rewind flag to false [3], and
the current time is unresolved (because the start time and the hold time
are all unresolved), and so the seek time is unresolved as well, especially
when we build a new CSS animation or CSS transition. Therefore we have to
avoid the unresolved seek time to let PlayNoUpdate() early return.

[1] https://drafts.csswg.org/web-animations-1/#playing-an-animation-section
[2] https://drafts.csswg.org/web-animations-1/#animation-current-time
[3] https://drafts.csswg.org/css-animations-2/#animation-play-state

See the spec issue: w3c/csswg-drafts#7145 for
more details.

Differential Revision: https://phabricator.services.mozilla.com/D140682
webkit-early-warning-system pushed a commit to graouts/WebKit that referenced this pull request Oct 21, 2022
…dating-the-playback-rate-of-an-animation.html has one failure

https://bugs.webkit.org/show_bug.cgi?id=246850

Reviewed by Dean Jackson.

Update our implementation of the "play an animation" [0] and "seamlessly update the playback rate" [1]
procedures to account for the spec changes made in w3c/csswg-drafts#7148.

We also import the changes made to the matching WPT so that we have a new PASS results.

[0] https://drafts.csswg.org/web-animations-1/#play-an-animation
[1] https://drafts.csswg.org/web-animations-1/#seamlessly-update-the-playback-rate

* LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/seamlessly-updating-the-playback-rate-of-an-animation-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/web-animations/timing-model/animations/seamlessly-updating-the-playback-rate-of-an-animation.html:
* Source/WebCore/animation/WebAnimation.cpp:
(WebCore::WebAnimation::updatePlaybackRate):
(WebCore::WebAnimation::play):
(WebCore::WebAnimation::runPendingPlayTask):

Canonical link: https://commits.webkit.org/255833@main
jwidar pushed a commit to jwidar/LatencyZeroGithub that referenced this pull request Sep 16, 2025
… in PlayNoUpdate() and UpdatePlaybackRate(). r=birtles

Based on the spec [1], the unresolved current time should be checked only if
the auto-rewind flag is ture. Otherwise, the null timeline with the false
auto-rewind flag may get an InvalidStateError DOMException if its effect end
is positive infinity.

Note:
If the animation has no associated timeline, it's current time is
unresolved [2].

Besides, we also tweak the handle for unresolved current time based on the
spec PR: w3c/csswg-drafts#7148, in
UpdatePlaybackRate() and PlayNoUpdate().

Note:
CSS animations and CSS transitions set auto-rewind flag to false [3], and
the current time is unresolved (because the start time and the hold time
are all unresolved), and so the seek time is unresolved as well, especially
when we build a new CSS animation or CSS transition. Therefore we have to
avoid the unresolved seek time to let PlayNoUpdate() early return.

[1] https://drafts.csswg.org/web-animations-1/#playing-an-animation-section
[2] https://drafts.csswg.org/web-animations-1/#animation-current-time
[3] https://drafts.csswg.org/css-animations-2/#
756D
animation-play-state

See the spec issue: w3c/csswg-drafts#7145 for
more details.

Differential Revision: https://phabricator.services.mozilla.com/D140682
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[web-animations-1][css-animations-2] Bug in handling of auto-rewind state when playing new CSS animations
3 participants
0