RESOLVED FIXED 285914
REGRESSION (282580@main): font-size: calc(). using rem and em prevents text from scaling up or down
https://bugs.webkit.org/show_bug.cgi?id=285914
Summary REGRESSION (282580@main): font-size: calc(). using rem and em prevents text f...
aweb33
Reported 2025-01-14 08:33:35 PST
text defined with `em` or `rem` always stays at the same size no matter how much we scale up or down, or zoom in or down. ```css .rem { font-size: calc(1rem); } .em { font-size: calc(1em); }``` text defined with `px` correctly scales: ``` .px { font-size: calc(16px); }``` codepen: https://codepen.io/slk333/pen/emOrKZB?editors=1100
Attachments
codepen screenshot that shows the bug in action (135.55 KB, image/png)
2025-01-14 08:34 PST, aweb33
no flags
aweb33
Comment 1 2025-01-14 08:34:47 PST
Created attachment 473900 [details] codepen screenshot that shows the bug in action
aweb33
Comment 2 2025-01-14 08:37:21 PST
Please open the screenshot: 1. Each line should have the same font-size 2. Lines are not rendered with the same font-size
aweb33
Comment 3 2025-01-14 08:58:28 PST
this bug is a bit similar than https://bugs.webkit.org/show_bug.cgi?id=224614, exect it happens when we use rem or em.
Simon Fraser (smfr)
Comment 4 2025-01-14 14:39:11 PST
Simon Fraser (smfr)
Comment 5 2025-01-14 14:39:28 PST
Sam Weinig
Comment 6 2025-01-15 12:30:14 PST
Sam Weinig
Comment 7 2025-01-15 12:33:20 PST
This is due to the weird dance we do in the calc unit canonicalization code to undo the zoom applied in Style::computeNonCalcLengthDouble. As it turns out, Style::computeNonCalcLengthDouble only sometimes applies zoom, so unconditionally undoing it breaks things. Instead, we can avoid the whole dance by just passing in a parameter to ask it to not apply zoom at all, and then remove the undoing code. Putting up a PR to let the bots at it, but it still needs a proper test added which I will do shortly.
EWS
Comment 8 2025-01-16 16:04:08 PST
Committed 289030@main (5a1ed2afa80c): <https://commits.webkit.org/289030@main> Reviewed commits have been landed. Closing PR #39093 and removing active labels.
Karl Dubost
Comment 9 2025-05-19 22:03:00 PDT
*** Bug 293110 has been marked as a duplicate of this bug. ***
Note You need to log in before you can comment on or make changes to this bug.