Closed
Bug 1150807
Opened 10 years ago
Closed 10 years ago
Implement Animation.cancel()
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla40
Tracking | Status | |
---|---|---|
firefox40 | --- | fixed |
People
(Reporter: birtles, Assigned: birtles)
References
Details
Attachments
(5 files, 1 obsolete file)
1.25 KB,
patch
|
jwatt
:
review+
|
Details | Diff | Splinter Review |
2.46 KB,
patch
|
smaug
:
review+
|
Details | Diff | Splinter Review |
9.12 KB,
patch
|
jwatt
:
review+
|
Details | Diff | Splinter Review |
4.61 KB,
patch
|
jwatt
:
review+
|
Details | Diff | Splinter Review |
30.32 KB,
patch
|
jwatt
:
review+
|
Details | Diff | Splinter Review |
No description provided.
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → bbirtles
Status: NEW → ASSIGNED
Assignee | ||
Comment 1•10 years ago
|
||
Assignee | ||
Comment 2•10 years ago
|
||
This patch is still missing a few tests (as listed at the end of css-animations/test_animation-cancel.html).
Currently one of the tests in css-animations/test_animation-playstate.html is failing because it's checking that after we set the currentTime while idle we transition to the paused state. By the letter of the spec we should actually start playing from currentTime (i.e. transition to the running state) but I'm not sure if that's actually the desired behaviour in this case or if we should update the spec. It seems like it makes more sense only to update the start time if it's already set.
Assignee | ||
Comment 3•10 years ago
|
||
(In reply to Brian Birtles (:birtles) from comment #2)
> Currently one of the tests in css-animations/test_animation-playstate.html
> is failing because it's checking that after we set the currentTime while
> idle we transition to the paused state. By the letter of the spec we should
> actually start playing from currentTime (i.e. transition to the running
> state) but I'm not sure if that's actually the desired behaviour in this
> case or if we should update the spec. It seems like it makes more sense only
> to update the start time if it's already set.
I'm going to change the spec:
https://lists.w3.org/Archives/Public/public-fx/2015AprJun/0027.html
Assignee | ||
Comment 4•10 years ago
|
||
The main problem I'm facing now is what to call the different Cancel methods. For each of these Animation methods we have four different ways of calling them:
a. Call from script -- needs to reset a bunch of state in style so that we retrigger layer transactions etc.
b. Call from script on a CSS animation/transition -- needs to reset state in style AND needs to flush style before doing anything
c. Call from style -- doesn't need to reset any of that state (since we're in style already) but *may* need to behave differently (specifically for pausing/playing we behave differently when being called from style)
d. Call from elsewhere in Gecko -- needs to reset a bunch of state in style
Typically we've named these as follows:
a. XXXFromJS()
b. XXXFromJS() (but on the CSSAnimation/CSSTransition-specific override)
c. XXXFromStyle()
d. XXX()
I wonder about (d). I wonder if XXX() should just do the operation but not reset state in style and make that the responsibility of the caller. Currently there *are* no other callers in Gecko at the moment other than style.
It might be that in bug 1151731 we find a better way of expressing this so I'll just leave it as-is for now.
Assignee | ||
Comment 5•10 years ago
|
||
The reasoning for this change is described here:
https://lists.w3.org/Archives/Public/public-fx/2015AprJun/0027.html
Furthermore, subsequent tests introduced in this bug for the animation playState
depend on this change.
Attachment #8596439 -
Flags: review?(jwatt)
Assignee | ||
Comment 6•10 years ago
|
||
Attachment #8596441 -
Flags: review?(bugs)
Assignee | ||
Comment 7•10 years ago
|
||
This patch makes Cancel() call PostUpdate which clobbers certain state in style
so that animated style is correctly flushed when an animation is cancelled.
The main difficulty with this is that we *don't* want to call this when we're
cancelling an animation as a result of a style update or else we'll trigger
needless work. The pattern elsewhere has been to define a *FromStyle() method
for this case (e.g. CSSAnimation::PlayFromStyle, PauseFromStyle). This isn't
ideal because there's always the danger we will forget to call the appropriate
*FromStyle method. It is, however, consistent. Hopefully in bug 1151731 we'll
find a better way of expressing this.
Attachment #8596442 -
Flags: review?(jwatt)
Assignee | ||
Comment 8•10 years ago
|
||
This isn't spec'ed anywhere (since the whole Web Animations API <-> CSS
interaction isn't spec'ed yet) but it seems that changing animation-play-state
should not restart an idle animation.
If an author calls Cancel() on an animation then that animation should continue
to be idle until they call Play()/Pause() from the API. Cancelling an animation
and hanging on to it is a purely API-only feature and hence it's reasonable that
restoring it from this state is also an API-only feature.
One can imagine use-cases such as polyfilling where script wants to remove any
CSS Animations/Transitions run by the browser and replace them with something
else entirely. In that case, the script can call Cancel() on the animation and
be sure that the animation is going to stay out of the way even if something
else tweaks the animation-play-state.
Attachment #8596444 -
Flags: review?(jwatt)
Assignee | ||
Comment 9•10 years ago
|
||
Attachment #8596445 -
Flags: review?(jwatt)
Assignee | ||
Updated•10 years ago
|
Attachment #8595193 -
Attachment is obsolete: true
Assignee | ||
Comment 10•10 years ago
|
||
(In reply to Brian Birtles (:birtles) from comment #3)
> I'm going to change the spec:
>
> https://lists.w3.org/Archives/Public/public-fx/2015AprJun/0027.html
https://github.com/w3c/web-animations/commit/b90463ac5bd44adf3e5d42ae4895b41b99a17c7d
Assignee | ||
Comment 11•10 years ago
|
||
![]() |
||
Updated•10 years ago
|
Attachment #8596439 -
Flags: review?(jwatt) → review+
![]() |
||
Updated•10 years ago
|
Attachment #8596442 -
Flags: review?(jwatt) → review+
![]() |
||
Updated•10 years ago
|
Attachment #8596444 -
Flags: review?(jwatt) → review+
Updated•10 years ago
|
Attachment #8596441 -
Flags: review?(bugs) → review+
![]() |
||
Updated•10 years ago
|
Attachment #8596445 -
Flags: review?(jwatt) → review+
Comment 12•10 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/076fabe36fd3
https://hg.mozilla.org/integration/mozilla-inbound/rev/72571965f94d
https://hg.mozilla.org/integration/mozilla-inbound/rev/12421d0f1bb3
https://hg.mozilla.org/integration/mozilla-inbound/rev/064e704dfa02
https://hg.mozilla.org/integration/mozilla-inbound/rev/f66f164d3160
Comment 13•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/076fabe36fd3
https://hg.mozilla.org/mozilla-central/rev/72571965f94d
https://hg.mozilla.org/mozilla-central/rev/12421d0f1bb3
https://hg.mozilla.org/mozilla-central/rev/064e704dfa02
https://hg.mozilla.org/mozilla-central/rev/f66f164d3160
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•