Bug 27881 - Creating @-webkit-keyframes on the fly does not start animation
Summary: Creating @-webkit-keyframes on the fly does not start animation
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Dean Jackson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-31 08:25 PDT by Simon Fraser (smfr)
Modified: 2023-03-21 02:49 PDT (History)
4 users (show)

See Also:


Attachments
Testcase (993 bytes, text/html)
2009-07-31 08:25 PDT, Simon Fraser (smfr)
no flags Details
STP165 video recording on macOS 13.2.1 (2.58 MB, video/quicktime)
2023-03-20 11:29 PDT, Ahmad Saleem
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2009-07-31 08:25:15 PDT
Created attachment 33876 [details]
Testcase

If a page creates keyframes rules on the fly with JS, but relies on the animation-name already existing on the element, then the animation does not start. See testcase.
Comment 1 Chris Marrin 2009-07-31 08:53:08 PDT
This is the same as rdar://problem/6276692
Comment 2 Ralph T 2013-10-07 18:08:55 PDT
It looks like this bug is probably in CompositeAnimation::updateKeyframeAnimations. We take the "animations of target style and current style are equal" branch and don't look up if the underlying keyframes have changed.

We shouldn't change an animation that has already started in the case that we're redefining an @keyframes rule, but we should start an animation if none is running. Spec says:

"The values used for the keyframes and animation properties are snapshotted at the time the animation starts. Changing them during the execution of the animation has no effect. Note also that changing the value of ‘animation-name’ does not necessarily restart an animation (e.g., if a list of animations are applied and one is removed from the list, only that animation will stop; The other animations will continue). In order to restart an animation, it must be removed then reapplied."

I guess if an animation already finished (is postActive) then we should start it again for a new @keyframes definition.
Comment 3 Ralph T 2013-10-09 11:20:28 PDT
In order to do this correctly in CompositeAnimation, We'd need to know if a @keyframes rule is new (hasn't been seen by this CompositeAnimation instance before). Is there any existing mechanism to tell if a rule is "new" for the current recalc?
Comment 4 Ahmad Saleem 2023-03-20 10:34:11 PDT
STP165 is matching with Chrome Canary 113 and Firefox Nightly 113, where the attached test case animate on page load but only difference is that rather than 5 times, it animates only 3 times.

Is it something still to fix?
Comment 5 Antoine Quint 2023-03-20 11:22:17 PDT
With STP 165, I see the square animate 5 times. Could you share more about your configuration? I'm surprised you see otherwise.
Comment 6 Ahmad Saleem 2023-03-20 11:26:47 PDT
I am counting one side as '1' and not backward. It could be issue. Let me attach video shortly.
Comment 7 Ahmad Saleem 2023-03-20 11:29:06 PDT
Created attachment 465526 [details]
STP165 video recording on macOS 13.2.1

Video Recording attached of what I am seeing.

I counted '3' from ---> this direction only but not <---- but if I count those then I think they are '5'.
Comment 8 Antoine Quint 2023-03-20 13:26:14 PDT
Yes, that is the behavior I see across STP 165, Firefox and Chrome. I'll let you confirm this on your own machine, but I believe this is behaving correctly.
Comment 9 Ahmad Saleem 2023-03-20 14:12:09 PDT
(In reply to Antoine Quint from comment #8)
> Yes, that is the behavior I see across STP 165, Firefox and Chrome. I'll let
> you confirm this on your own machine, but I believe this is behaving
> correctly.

Do we need to keep it open, or we can mark it as "RESOLVED CONFIGURATION CHANGED"?