[csswg-drafts] [css-animations-2] Alternate animation composite order when owning element of A and B differs (#4669)

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

== [css-animations-2] Alternate animation composite order when owning element of A and B differs ==
TLDR; Can/should we change CSS Animations and CSS Transitions composite order when owning elements differ to be sorted by creation order first?

[css-animations-2](https://drafts.csswg.org/css-animations-2/#animation-composite-order) and [css-transitions-2](https://drafts.csswg.org/css-transitions-2/#animation-composite-order) state when the owning element of A and B differs, the animations are sorted by tree order. As far as I can tell the only time this inter-element sorting is noticeable is when returning animations from [getAnimations](https://drafts.csswg.org/web-animations-1/#dom-animatable-getanimations), as animation composition behaviors only applies when animations are on the same element.

It seems that it might be more consistent (and possibly more efficient) to return animations ordered by creation (i.e. position in the global animation list). We would still need to spec that animations would be sorted by tree order when multiple animations are created at the same time. Then, the first level of sorting would be more consistent with [web animations](https://drafts.csswg.org/web-animations/#animation-composite-order), and for implementations which maintain a global animation list it would eliminate the need for a tree traversal comparison sort, e.g. [WebKit](https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/animation/DocumentTimeline.cpp#L177), Blink (We would need to do the same).

In practice, this means for the test [Order of CSS Animations - across elements](https://github.com/web-platform-tests/wpt/blob/master/css/css-animations/Document-getAnimations.tentative.html#L69) the order after appending 1 and 4 would be 2, 3, 1, 4.

It's possible there's reasons why this doesn't work, but as far as I can tell this seems simpler (more consistent with web animations, easier to implement) and does not change the visible effect, whereas the tree order is inconsistent and imposes either sorting or a data structure tracking DOM changes.

@stephenmcgruer @kevers-google @graouts @birtles, thoughts?

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

Received on Monday, 13 January 2020 22:05:42 UTC