Record which fields of CSS animations / transitions have been overridden by script and ignore changes from style
Categories
(Core :: DOM: Animation, enhancement, P3)
Tracking
()
People
(Reporter: birtles, Assigned: birtles)
References
Details
Attachments
(5 files, 1 obsolete file)
Assignee | ||
Updated•7 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
Given that CSS transitions properties are snapshotted when the transition is created (i.e. changing transition-duration
doesn't affect running transitions), I think that once bug 1292001 is done, the only thing left to do for transitions will be to add tests that changing the timing properties via the API actually does take effect.
As a result, this bug is mostly concerned with CSS Animations. Boris, if you are interested, feel free to take this bug. I think it mostly involves writing a bunch of WPT for each of the different timing properties / keyframes. Actually recording which properties changed is hopefully not too difficult? I think it might just involve sticking a bitfield on CSSAnimation
that tracks which of the following have been overridden:
- The effect as a whole (in which case changes to any of the following should be ignored)
- The effect's keyframes
- Each of the effect's timing properties
- The animation's play state
The last point might be a separate bug. The current thinking is we should drop the special playback behavior defined in the spec: https://drafts.csswg.org/css-animations-2/#animation-play-state and simply say that if the author ever calls play()
, pause()
, reverse()
etc. or sets the startTime
etc. then the animation ignores changes to animation-play-state
from that point on.
I don't think we'd need to track if the target/pseudo is changed, for example, since that's not possible to change via CSS. Likewise, technically we don't need to track if endDelay
is changed, necessarily.
I'm happy to help with any spec changes for that.
Updated•5 years ago
|
Assignee | ||
Comment 2•5 years ago
|
||
Hi Boris, I think we need to get this landed within the next 2~3 days before the soft code freeze.
I hope you don't mind but I wrote a patch just to outline what I think we need to do. It only covers setKeyframes() but hopefully it explains the approach I have in mind.
If you like I can take this bug and fill out the rest of the patches? If you are already working on this though, that's fine. Maybe this patch will be of some use.
Comment 3•5 years ago
•
|
||
Sorry I haven't started to work on this yet. Please feel free to take this and finish your patch. :)
Updated•5 years ago
|
Comment 4•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 5•5 years ago
|
||
(In reply to Boris Chiou [:boris] from comment #4)
+// A subclass of KeyframeEffect that reports when specific properties have been
+// overridden via the Web Animations API.
+class CSSAnimationKeyframeEffect : public dom::KeyframeEffect {So, unfortunately, we still need something like CSSTransitionKeyframeEffect
for transition, though we just drop ElementPropertyTransition.
I don't think we need it for CSS transitions, only CSS animations. For CSS transitions, you can't update the running transition by changing the CSS since the values are snapshotted at the point when the transition is generated.
I'm thinking is it possible to add a type flag in Keyframe, so we can just
check this flag, instead of doing this by polymophism.
Since we only need it for CSS animations, I'm inclined to use the subclass approach in order to keep KeyframeEffect
simple. I agree that if we needed this for both CSS transitions and CSS animations it would be worth adding to KeyframeEffect
however.
Comment 6•5 years ago
|
||
(In reply to Brian Birtles (:birtles) from comment #5)
I don't think we need it for CSS transitions, only CSS animations. For CSS transitions, you can't update the running transition by changing the CSS since the values are snapshotted at the point when the transition is generated.
Oh right. This is for setKeyframes()
, so don't need to do this for CSS transition. :)
Assignee | ||
Comment 7•5 years ago
|
||
Assignee | ||
Comment 8•5 years ago
|
||
We will use this in the next patch to test the result after calling setKeyframes.
Assignee | ||
Comment 9•5 years ago
|
||
Depends on D65096
Assignee | ||
Comment 10•5 years ago
|
||
Depends on D65097
Assignee | ||
Comment 11•5 years ago
|
||
Depends on D65098
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 12•5 years ago
|
||
This corresponds to the approach outlined in https://github.com/w3c/csswg-drafts/issues/4822
Depends on D65099
Comment 13•5 years ago
|
||
Comment 17•5 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/c206b97b7447
https://hg.mozilla.org/mozilla-central/rev/7c8d563e57ea
https://hg.mozilla.org/mozilla-central/rev/d6f2c615730f
https://hg.mozilla.org/mozilla-central/rev/4c24b62d2686
https://hg.mozilla.org/mozilla-central/rev/02295b7142ac
Updated•5 years ago
|
Description
•