relative font-size (em, percent, inherit) in the keyframes animation of a pseudo-element do not measure the font-size relative to the element with the pseudo-element, but relative to its parent
Categories
(Core :: CSS Transitions and Animations, defect)
Tracking
()
People
(Reporter: sliva0mk, Assigned: emilio)
References
(Regression)
Details
(Keywords: regression)
Attachments
(5 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36 OPR/83.0.4254.46
Steps to reproduce:
added to the keyframes animation changing the font-size of the pseudo-element relative to its parent in em units.
Actual results:
font-size of the pseudo-element calculated incorrectly (relative to the parent) during animation.
Expected results:
font-size of the pseudo-element is calculated relative to the element with it.
Comment 1•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Layout: Text and Fonts' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Comment 2•2 years ago
|
||
Thanks for the bug report! This looks like a legit bug to me.
Importantly: we behave differently depending on whether the font-size is applied via an animation-that-sets-font-size, vs. via a direct font-size
declaration, in the CSS ::after {} pseudo-class rule. That inconsistency seems definitely-wrong.
Also: this seems to affect percentage font-sizes and explicit font-size:inherit
, according to my testing.
I'll attach an additional reduced testcase in a bit, to demonstrate the things I noted above. Also CC'ing some folks who know our CSS Animation code better than I do, who might have thoughts or cycles to investigate.
Updated•2 years ago
|
Comment 3•2 years ago
|
||
Here's a testcase to demonstrate our behavior a bit more.
It's got 5 boxes, all generated by ::after, with width and height of 1em (revealing the computed font-size
on the pseudo-element via the size of the box).
The expectation is that all of the boxes should be the same size; they all reference the parent's font-size in one way or another.
(The first one references the parent's font-size implicitly i.e. by-default; the second one just redeclares the exact pixel value [kinda cheating]. These are both fine. And then the last 3 use font-size: 1em
vs. 100%
vs. inherit
, all via animations. These last 3 all "fail" and end up with the wrong computed font-size.)
Comment 4•2 years ago
|
||
I believe the fact that we don't handle font-size
in animations correctly is a known issue which we always anticipated fixing when we implement CSS Properties API (bug 1273706) since that introduces a more general case of the same problem.
Comment 5•2 years ago
|
||
Here's a reference case for testcase 2, where I've simply replaced the animations with explicit declarations. i.e. I've replaced...
@keyframes kf-fs1em { from, to { font-size: 1em; } }
.fs1em::after {
animation: kf-fs1em 1s infinite;
}
...with:
.fs1em::after {
font-size: 1em;
}
I think it's legit to expect these^ to produce the same result here, but they don't produce the same result.
Comment 6•2 years ago
|
||
Here's a screenshot showing us vs. Chrome on testcase 2.
(We agree with Chrome on how to render the reference case, which is also how Chrome renders the testcase.)
Comment 7•2 years ago
•
|
||
Looks like this was a regression from the "stylo" CSS Engine rewrite / import-from-servo.
mozregression gives me this range:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=f64e2b4dcf5eec0b4ad456c149680a67b7c26dc4&tochange=93dd2e456c0ecca00fb4d28744e88078a77deaf7
...which includes:
Bug 1330412 - Enable Stylo by default. r=bholley,froydnj
https://hg.mozilla.org/mozilla-central/rev/7b3215e184436b77de2204e57919d1c21286727f
Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Comment 8•2 years ago
|
||
Set release status flags based on info from the regressing bug 1330412
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 9•2 years ago
|
||
Updated•2 years ago
|
Updated•2 years ago
|
Comment 10•2 years ago
|
||
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/387276dda7b5 Make keyframes for pseudo-elements inherit from the right style. r=dholbert
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/33031 for changes under testing/web-platform/tests
Comment 12•2 years ago
|
||
bugherder |
Updated•2 years ago
|
Updated•2 years ago
|
Upstream PR merged by moz-wptsync-bot
Description
•