Skip to content

Make cancelAnimationFrame cancel pending callbacks - #4375

Merged
annevk merged 2 commits into
whatwg:masterfrom
birtles:cancel-pending-callbacks
Feb 19, 2019
Merged

annevk merged 2 commits into
whatwg:masterfrom
birtles:cancel-pending-callbacks

Conversation

@birtles

@birtles birtles commented Feb 19, 2019 •

Copy link
Copy Markdown
Contributor

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

birtles commented Feb 19, 2019 •

Copy link
Copy Markdown
Contributor Author

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

birtles commented Feb 19, 2019

Copy link
Copy Markdown
Contributor Author

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

@annevk

annevk commented Feb 19, 2019

Copy link
Copy Markdown
Member

@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.

@annevk annevk left a comment

Copy link
Copy Markdown
Member

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?

Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
Comment thread source Resolved
annevk pushed a commit to web-platform-tests/wpt that referenced this pull request Feb 19, 2019
@birtles

birtles commented Feb 19, 2019

Copy link
Copy Markdown
Contributor Author

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

birtles commented Feb 19, 2019

Copy link
Copy Markdown
Contributor Author

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
bhearsum pushed a commit to mozilla-releng/staging-firefox that referenced this pull request May 1, 2025
…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
bhearsum pushed a commit to mozilla-releng/staging-firefox that referenced this pull request May 1, 2025
…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
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