-
Notifications
You must be signed in to change notification settings - Fork 757
Description
https://drafts.csswg.org/css-cascade/#default
author origin: Rolls back the cascaded value to the user level, so that the specified value is calculated as if no author-origin rules were specified for this property on this element. For the purpose of revert, this 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 is not collapsed with the author origin for this purpose as it is for revert, and thus effectively forms its own cascade layer.
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 9fed7ff 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?