[csswg-drafts] [css-cascade] Should 'revert' really treat animation origin as author origin? (#7083)

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

== [css-cascade] Should 'revert' really treat animation origin as author origin? ==
https://drafts.csswg.org/css-cascade/#default

> **[author origin](https://drafts.csswg.org/css-cascade/#cascade-origin-author)**: Rolls back the [cascaded value](https://drafts.csswg.org/css-cascade/#cascaded-value) to the user level, so that the [specified value](https://drafts.csswg.org/css-cascade/#specified-value) is calculated as if no [author-origin](https://drafts.csswg.org/css-cascade/#cascade-origin-author) rules were specified for this property on this element. For the purpose of [revert](https://drafts.csswg.org/css-cascade/#valdef-all-revert), this [origin](https://drafts.csswg.org/css-cascade/#origin) includes the Animation origin.

But it's different for `revert-layer` https://drafts.csswg.org/css-cascade-5/#revert-layer

> Note: The [animation origin](https://drafts.csswg.org/css-cascade-5/#cascade-origin-animation) is not collapsed with the [author origin](https://drafts.csswg.org/css-cascade-5/#cascade-origin-author) for this purpose as it is for [revert](https://drafts.csswg.org/css-cascade-5/#valdef-all-revert), and thus effectively forms its own [cascade layer](https://drafts.csswg.org/css-cascade-5/#cascade-layers).

`revert-layer` was resolved to respect origins in #6749.

But I wonder if `revert` really needs to have this strange exception? I have tracked the origin of the text to 9fed7ff07d38d0f2c9c462d8bb2647750936086d and https://lists.w3.org/Archives/Public/www-style/2012Dec/0270.html

Note the text is old, but it's not like `revert` in `@keyframes` has much interoperability:
 - Blink implemented it in https://chromium-review.googlesource.com/c/chromium/src/+/2132249
 - WebKit just treats it as `unset`, I'm fixing it in https://bugs.webkit.org/show_bug.cgi?id=237073
 - Doesn't work in Firefox either

Having to roll back to user origin defeats some optimizations. From the Blink patch:

> the existence of the base computed style optimization makes things more complicated, as we can't use this optimization if 'revert' exists in a keyframe. (We don't even match selectors when that optimization is in use, so we wouldn't know what to revert to). In order to fix that, it's necessary to know if an ongoing animation contains a 'revert' or not, and if so disable the optimization in that case.

It's similar in WebKit, when resolving the `@keyframes` styles, it knows the base styles for the element, but not the styles for each origin. So UA and user declarations need to be recollected if there is a `revert`.

It doesn't seem a big deal, but given that removing the exception would provide some perf benefits and consistency with `revert-layer`, it may be worth it?

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


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

Received on Thursday, 24 February 2022 01:55:47 UTC