Skip to content

Commit

Permalink
Bug 1509466 - Make cancelAnimationFrame cancel a pending request fram…
Browse files Browse the repository at this point in the history
…e callback scheduled in the same frame; r=farre

As per the following change to the HTML spec:

  whatwg/html@86b05f8

when running a requestAnimationFrame callback it should be possible to cancel
another requestAnimationFrame callback scheduled to run in the same frame by
using cancelAnimationFrame.

See issue:

  whatwg/html#4359

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

UltraBlame original commit: 65c438efa01fc8478aa3d1d69bab22f758038b62
  • Loading branch information
marco-c committed Oct 4, 2019
1 parent a322eba commit 58f2e6b
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 0 deletions.
47 changes: 47 additions & 0 deletions dom/base/Document.cpp
Expand Up @@ -18137,6 +18137,12 @@ SwapElements
mFrameRequestCallbacks
)
;
mCanceledFrameRequestCallbacks
.
clear
(
)
;
mFrameRequestCallbacksScheduled
=
false
Expand Down Expand Up @@ -43331,6 +43337,47 @@ UpdateFrameRequestCallbackSchedulingState
)
;
}
else
{
Unused
<
<
mCanceledFrameRequestCallbacks
.
put
(
aHandle
)
;
}
}
bool
Document
:
:
IsCanceledFrameRequestCallback
(
int32_t
aHandle
)
const
{
return
!
mCanceledFrameRequestCallbacks
.
empty
(
)
&
&
mCanceledFrameRequestCallbacks
.
has
(
aHandle
)
;
}
nsresult
Document
Expand Down
23 changes: 23 additions & 0 deletions dom/base/Document.h
Expand Up @@ -363,6 +363,15 @@ include
"
mozilla
/
HashTable
.
h
"
#
include
"
mozilla
/
LinkedList
.
h
Expand Down Expand Up @@ -7853,6 +7862,14 @@ int32_t
aHandle
)
;
bool
IsCanceledFrameRequestCallback
(
int32_t
aHandle
)
const
;
void
TakeFrameRequestCallbacks
(
Expand Down Expand Up @@ -12339,6 +12356,12 @@ FrameRequest
>
mFrameRequestCallbacks
;
HashSet
<
int32_t
>
mCanceledFrameRequestCallbacks
;
nsIBFCacheEntry
*
mBFCacheEntry
Expand Down
18 changes: 18 additions & 0 deletions layout/base/nsRefreshDriver.cpp
Expand Up @@ -7201,6 +7201,24 @@ docCallbacks
mCallbacks
)
{
if
(
docCallbacks
.
mDocument
-
>
IsCanceledFrameRequestCallback
(
callback
.
mHandle
)
)
{
continue
;
}
callback
.
mCallback
Expand Down
43 changes: 43 additions & 0 deletions layout/style/ServoBindings.toml
Expand Up @@ -1985,6 +1985,49 @@ mozilla
detail
:
:
HashTable
"
#
<
-
We
should
be
able
to
remove
this
once
#
https
:
/
/
github
.
com
/
rust
-
lang
/
rust
-
bindgen
/
pull
/
1515
#
is
available
"
mozilla
:
:
detail
:
:
PointerType
"
"
Expand Down

0 comments on commit 58f2e6b

Please sign in to comment.