Bug 285264

Summary: font-variant-caps: all-small-caps causes incorrect box-sizing in flex/inline context
Product: WebKit Reporter: Christopher Kirk-Nielsen <chriskirknielsen+wkbugs>
Component: TextAssignee: Sammy Gill <sgill26>
Status: RESOLVED FIXED    
Severity: Normal CC: ahmad.saleem792, fantasai.bugs, karlcow, vitor.roriz, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: Safari 18   
Hardware: Mac (Apple Silicon)   
OS: macOS 15   
See Also: https://github.com/web-platform-tests/wpt/pull/50340
Attachments:
Description Flags
Toggling the font-variation-caps rule showcases the element's box size does not change despite the smaller text occupying less space.
none
WebKit ToT (Minibrowser)
none
WebKit ToT vs Chrome Canary
none
rendering in safari, firefox, chrome
none
rendering in safari, firefox, chrome (after manual zoom) none

Christopher Kirk-Nielsen
Reported 2024-12-31 06:48:17 PST
Created attachment 473723 [details] Toggling the font-variation-caps rule showcases the element's box size does not change despite the smaller text occupying less space. What happens is that the computed box for the text in small caps occupies the space of the standard text. I am noticing this on page load on my website, but I need to trigger a repaint of sorts in this example CodePen (link below) by commenting out the `font-variation-caps` rule (see attachment). CodePen demo: https://codepen.io/chriskirknielsen/pen/emOGyPj Notes: - Also happens on Safari on iOS 18.1.1 - This is only really a problem when alignment is obvious (so a block element outside a flex context is fine) - Using `text-align: center` does not "fix" this issue - While I think this might be related to bug #215693, this is not a broken rendering per se.
Attachments
Toggling the font-variation-caps rule showcases the element's box size does not change despite the smaller text occupying less space. (145.03 KB, image/png)
2024-12-31 06:48 PST, Christopher Kirk-Nielsen
no flags
WebKit ToT (Minibrowser) (376.00 KB, image/png)
2024-12-31 07:57 PST, Ahmad Saleem
no flags
WebKit ToT vs Chrome Canary (1.22 MB, image/png)
2024-12-31 09:41 PST, Ahmad Saleem
no flags
rendering in safari, firefox, chrome (2.04 MB, image/png)
2025-01-06 23:32 PST, Karl Dubost
no flags
rendering in safari, firefox, chrome (after manual zoom) (2.17 MB, image/png)
2025-01-06 23:41 PST, Karl Dubost
no flags
Ahmad Saleem
Comment 1 2024-12-31 07:57:54 PST
Created attachment 473726 [details] WebKit ToT (Minibrowser) I am unable to reproduce this as can be seen from image, is it iOS specific?
Christopher Kirk-Nielsen
Comment 2 2024-12-31 09:32:57 PST
This happens in Safari on macOS 15 and iOS 18. In the provided CodePen, comment the line `font-variation-caps`, wait a moment, then uncomment the line. The issue should appear. You could also try my website which consistently showcases the issue with the date above the title: https://chriskirknielsen.com/blog/2024-as-bullet-points/
Ahmad Saleem
Comment 3 2024-12-31 09:41:36 PST
Created attachment 473728 [details] WebKit ToT vs Chrome Canary Thanks! I am able to reproduce on live website. :-)
Radar WebKit Bug Importer
Comment 4 2024-12-31 09:42:28 PST
Karl Dubost
Comment 5 2025-01-06 23:32:31 PST
Created attachment 473818 [details] rendering in safari, firefox, chrome In both Chrome and Safari, the text seems to be smaller. In Firefox it has a bigger size.
Karl Dubost
Comment 6 2025-01-06 23:41:02 PST
Created attachment 473819 [details] rendering in safari, firefox, chrome (after manual zoom) Also after applying manual zooming 6 times (aka Command +) The text in safari stays the same size, while it grows in Firefox and Chrome
Sammy Gill
Comment 7 2025-01-24 11:31:08 PST
Sammy Gill
Comment 8 2025-01-28 09:45:53 PST
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/50340
EWS
Comment 9 2025-01-28 21:46:36 PST
Committed 289486@main (62bec2852217): <https://commits.webkit.org/289486@main> Reviewed commits have been landed. Closing PR #39508 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.