Bug 311188

Summary: Identical buttons drawn differently with font: -apple-system-short-body
Product: WebKit Reporter: Jeff Johnson <opendarwin>
Component: Layout and RenderingAssignee: Tim Horton <thorton>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, lily_spiniolas, simon.fraser, thorton, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: Safari 26   
Hardware: iPhone / iPad   
OS: iOS 26   
Attachments:
Description Flags
Sample HTML demonstrating the bug
none
Screenshot on iPhone
none
variant of the testcase that jiggles as it moves across the screen none

Jeff Johnson
Reported 2026-03-31 07:49:22 PDT
Created attachment 478864 [details] Sample HTML demonstrating the bug This bug occurs on iOS 26.4 and iPadOS 26.4. The bug may be new, but I'm not certain about that. When there are multiple buttons on the page, and they use font: -apple-system-short-body, then they can be drawn with different corner radiuses. See the attached sample HTML and screenshot. If I remove the CSS font rule, the bug no longer occurs. The sample HTML is adapted from my Safari extension popup window.
Attachments
Sample HTML demonstrating the bug (1.04 KB, text/html)
2026-03-31 07:49 PDT, Jeff Johnson
no flags
Screenshot on iPhone (17.99 KB, image/png)
2026-03-31 07:50 PDT, Jeff Johnson
no flags
variant of the testcase that jiggles as it moves across the screen (1.37 KB, text/html)
2026-05-18 17:32 PDT, Tim Horton
no flags
Jeff Johnson
Comment 1 2026-03-31 07:50:00 PDT
Created attachment 478865 [details] Screenshot on iPhone
Radar WebKit Bug Importer
Comment 2 2026-03-31 09:02:46 PDT
Tim Horton
Comment 3 2026-05-18 17:31:54 PDT
I worked this one out. It has nothing /really/ to do with the font, it's about the logic in RenderThemeCocoa's shapeForButton that tries to make "squareish" buttons not draw a circle"ish" background (by dropping to a much lower corner radius). The reason that identical buttons can vary across the page is that it uses the pixel-snapped size to decide which path (pill or roundrect) to go down, and different positions on the screen can result in different sizes. It just so happens that the font in the testcase puts the button right on the boundary, and rounding can kick it either way. I think the fix is to use the un-snapped size to decide which shape path to take.
Tim Horton
Comment 4 2026-05-18 17:32:49 PDT
Created attachment 479707 [details] variant of the testcase that jiggles as it moves across the screen Adding a variant of the testcase that moves the buttons around and clearly shows them pop between the two paths as they move.
Tim Horton
Comment 5 2026-05-19 16:06:48 PDT
EWS
Comment 6 2026-05-19 18:42:52 PDT
Committed 313535@main (8bf88660a664): <https://commits.webkit.org/313535@main> Reviewed commits have been landed. Closing PR #65230 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.