Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make cancelAnimationFrame cancel pending callbacks #4375

Merged
merged 2 commits into from Feb 19, 2019

Conversation

birtles
Copy link
Contributor

@birtles birtles commented Feb 19, 2019

Calling cancelAnimationFrame from within a requestAnimationFrame
callback should cancel any requestAnimationFrame callbacks that are
pending for the current frame. The currently specified behavior does not
permit that, however, since it clones the set of callbacks before
iterating over them.

This patch updates the algorithm to run animation frame callbacks such
that it is possible to cancel a pending animation frame callback.
This also brings the specified behavior into line with its
implementation in Blink, EdgeHTML, and WebKit.

This closes #4359.


/imagebitmap-and-animations.html ( diff )
/infrastructure.html ( diff )

Calling cancelAnimationFrame from within a requestAnimationFrame
callback should cancel any requestAnimationFrame callbacks that are
pending for the current frame. The currently specified behavior does not
permit that, however, since it clones the set of callbacks before
iterating over them.

This patch updates the algorithm to run animation frame callbacks such
that it is possible to cancel a pending animation frame callback.
This also brings the specified behavior into line with its
implementation in Blink, EdgeHTML, and WebKit.

This closes whatwg#4359.
@birtles
Copy link
Contributor Author

birtles commented Feb 19, 2019

Added a WPT in web-platform-tests/wpt#15455

@birtles birtles marked this pull request as ready for review February 19, 2019 07:39
@birtles
Copy link
Contributor Author

birtles commented Feb 19, 2019

I made my affiliation with Mozilla public but it's still telling me that I have not signed up to participate.

@annevk
Copy link
Member

annevk commented Feb 19, 2019

@birtles I invited you to join Mozilla's GitHub organization for this. Once you join and make your membership public all will be in order.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

Thanks, looks great. I have a couple of nits, but I could fix those as well before merging. (I also took the liberty of updating your comment to point to the actual added tests.)

Have you filed a bug against Firefox already?

source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
source Show resolved Hide resolved
annevk pushed a commit to web-platform-tests/wpt that referenced this pull request Feb 19, 2019
@birtles
Copy link
Contributor Author

birtles commented Feb 19, 2019

Great, thank you! I'll fix the nits tomorrow (unless you get to it first).
The Firefox bug is bug 1509466 which I've just re-opened.

@annevk annevk merged commit 86b05f8 into whatwg:master Feb 19, 2019
@birtles
Copy link
Contributor Author

birtles commented Feb 19, 2019

Thanks Anne!

@birtles birtles deleted the cancel-pending-callbacks branch February 19, 2019 22:23
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Mar 15, 2019
…e cancels a pending animation frame callback, a=testonly

Automatic update from web-platform-tests
HTML: cancelAnimationFrame cancels a pending animation frame callback

For whatwg/html#4375.
--

wpt-commits: bbbe615d3f5b7b44ed49b4b369f19d4c5dd32e53
wpt-pr: 15455
mykmelez pushed a commit to mykmelez/gecko that referenced this pull request Mar 16, 2019
…e cancels a pending animation frame callback, a=testonly

Automatic update from web-platform-tests
HTML: cancelAnimationFrame cancels a pending animation frame callback

For whatwg/html#4375.
--

wpt-commits: bbbe615d3f5b7b44ed49b4b369f19d4c5dd32e53
wpt-pr: 15455
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Mar 16, 2019
…e cancels a pending animation frame callback, a=testonly

Automatic update from web-platform-tests
HTML: cancelAnimationFrame cancels a pending animation frame callback

For whatwg/html#4375.
--

wpt-commits: bbbe615d3f5b7b44ed49b4b369f19d4c5dd32e53
wpt-pr: 15455
mykmelez pushed a commit to mykmelez/gecko that referenced this pull request Mar 17, 2019
…e cancels a pending animation frame callback, a=testonly

Automatic update from web-platform-tests
HTML: cancelAnimationFrame cancels a pending animation frame callback

For whatwg/html#4375.
--

wpt-commits: bbbe615d3f5b7b44ed49b4b369f19d4c5dd32e53
wpt-pr: 15455
marcoscaceres pushed a commit to web-platform-tests/wpt that referenced this pull request Jul 23, 2019
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 4, 2019
…e cancels a pending animation frame callback, a=testonly

Automatic update from web-platform-tests
HTML: cancelAnimationFrame cancels a pending animation frame callback

For whatwg/html#4375.
--

wpt-commits: bbbe615d3f5b7b44ed49b4b369f19d4c5dd32e53
wpt-pr: 15455

UltraBlame original commit: e7d92d3120c423087b25c70bdcd4c3696ae078a5
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 4, 2019
…e cancels a pending animation frame callback, a=testonly

Automatic update from web-platform-tests
HTML: cancelAnimationFrame cancels a pending animation frame callback

For whatwg/html#4375.
--

wpt-commits: bbbe615d3f5b7b44ed49b4b369f19d4c5dd32e53
wpt-pr: 15455

UltraBlame original commit: 52a879d4e479200bddbe0bf3ee6b4c28e7d220de
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 4, 2019
…e cancels a pending animation frame callback, a=testonly

Automatic update from web-platform-tests
HTML: cancelAnimationFrame cancels a pending animation frame callback

For whatwg/html#4375.
--

wpt-commits: bbbe615d3f5b7b44ed49b4b369f19d4c5dd32e53
wpt-pr: 15455

UltraBlame original commit: e7d92d3120c423087b25c70bdcd4c3696ae078a5
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 4, 2019
…e cancels a pending animation frame callback, a=testonly

Automatic update from web-platform-tests
HTML: cancelAnimationFrame cancels a pending animation frame callback

For whatwg/html#4375.
--

wpt-commits: bbbe615d3f5b7b44ed49b4b369f19d4c5dd32e53
wpt-pr: 15455

UltraBlame original commit: 52a879d4e479200bddbe0bf3ee6b4c28e7d220de
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 4, 2019
…e cancels a pending animation frame callback, a=testonly

Automatic update from web-platform-tests
HTML: cancelAnimationFrame cancels a pending animation frame callback

For whatwg/html#4375.
--

wpt-commits: bbbe615d3f5b7b44ed49b4b369f19d4c5dd32e53
wpt-pr: 15455

UltraBlame original commit: e7d92d3120c423087b25c70bdcd4c3696ae078a5
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 4, 2019
…e cancels a pending animation frame callback, a=testonly

Automatic update from web-platform-tests
HTML: cancelAnimationFrame cancels a pending animation frame callback

For whatwg/html#4375.
--

wpt-commits: bbbe615d3f5b7b44ed49b4b369f19d4c5dd32e53
wpt-pr: 15455

UltraBlame original commit: 52a879d4e479200bddbe0bf3ee6b4c28e7d220de
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

cancelAnimationFrame should also cancel pending callbacks
2 participants