[csswg-drafts] [css-animations-2] Consider not to generate the CSS animations with null timeline (#7364)

BorisChiou has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-animations-2] Consider not to generate the CSS animations with null timeline ==
I'd like to make this proposal for the following cases:

1. Set `animation-timeline: none` initially
2. Set `animation-timeline: unknown-timeline` initially
3. Change `animation-timeline` from a valid timeline to `none`
4. Change `animation-timeline` from a valid timeline to an unknown-timeline

`animation-timeline` is defined in [[css-animations-2]](https://drafts.csswg.org/css-animations-2/#animation-timeline), and the timeline name is defined in [[scroll-animations]](https://drafts.csswg.org/scroll-animations-1/). However, it's unclear to us for null timeline case.

This is the [wpt](https://github.com/web-platform-tests/wpt/blob/master/scroll-animations/css/animation-timeline-none.html) for case 1 and case 2. In this test case, we expect to hold the current time at zero. This means we still generate the CSS animation with null timeline.

However, there is another [wpt](https://github.com/web-platform-tests/wpt/blob/edca84af42bd7e84da94e63b322fe343191842d2/scroll-animations/css/at-scroll-timeline-dynamic.tentative.html#L171-L185) for case 3 and case 4. In this test case, we expect to discard the CSS animations (or say, the CSS animations are cancelled or not in effect).

This may confuse people because all the cases should have the same behavior in general, just like what we do for `@keyframes`.
That is, if there is no matching `@keyframes` rule, we don't generate a `CSSAnimation`. If the `@keyframes` rule later matches, we generate the `CSSAnimation` then. That is defined in [step 3 of the procedure to generate keyframe objects](https://drafts.csswg.org/css-animations-2/#keyframes):
> If there is no `@keyframes` at-rule with `<keyframes-name>` matching name, abort this procedure. In this case no animation is generated, and any existing animation matching name is canceled.

So just want to raise this spec issue for discussion. And based on the comment @birtles left in https://bugzilla.mozilla.org/show_bug.cgi?id=1774060#c4, for these 4 cases:

Option 1:
1. Set `animation-timeline: none` initially -> No CSSAnimation is generated
2. Set `animation-timeline: unknown-timeline` initially -> No CSSAnimation is generated
3. Change `animation-timeline` from a valid timeline to `none` -> The existing CSSAnimation is cancelled.
4. Change `animation-timeline` from a valid timeline to an unknown-timeline -> The existing CSSAnimation is cancelled.

Option 2:
The alternative is to always generate a `CSSAnimation` and set the timeline to null when `animation-timeline` is `none` or some unknown-timeline and follow the procedure for setting a timeline to null defined in [[web-animations-2]](https://drafts.csswg.org/web-animations/#setting-the-timeline).

Mozilla prefers the option 1 for now, and so I'd like to update this [wpt](https://github.com/web-platform-tests/wpt/blob/master/scroll-animations/css/animation-timeline-none.html) based on the option 1.

Do we have any concerns for this?

cc @kevers-google, @andruud, @hiikezoe

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7364 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 14 June 2022 22:04:01 UTC