Bug 234148 - Incorrect size when aspect-ratio is combined with width
Summary: Incorrect size when aspect-ratio is combined with width
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: Safari Technology Preview
Hardware: Mac (Intel) macOS 10.15
: P2 Normal
Assignee: Rob Buis
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-12-10 07:14 PST by Adam Seckel
Modified: 2022-02-04 10:29 PST (History)
16 users (show)

See Also:


Attachments
Patch (11.43 KB, patch)
2021-12-14 02:43 PST, Rob Buis
no flags Details | Formatted Diff | Diff
Patch (11.58 KB, patch)
2021-12-14 06:09 PST, Rob Buis
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Seckel 2021-12-10 07:14:59 PST
In latest Safari 15, as well as Safari Technology Preview, combining aspect-ratio and width does not result in the correct element height.

An element with width: 352px and an aspect-ratio: 352 / 490 should result in a height of 490px (Latest Chrome and Firefox). In Safari however, it results in ~500.xx px

AN older version of Chrome (91.0.4472.164) also resulted in 500, but this has now been fixed by 96.0.4664.93 (not entirely clear which version fixed it.

Please see the reproduction attached in the code sandbox below.

https://codesandbox.io/s/aspect-ratio-calculation-d866x?file=/src/index.js
Comment 1 Radar WebKit Bug Importer 2021-12-10 10:16:20 PST
<rdar://problem/86328069>
Comment 2 Rob Buis 2021-12-14 02:43:26 PST
Created attachment 447119 [details]
Patch
Comment 3 EWS Watchlist 2021-12-14 02:44:28 PST
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess
Comment 4 Manuel Rego Casasnovas 2021-12-14 04:31:41 PST
Comment on attachment 447119 [details]
Patch

r=me
Comment 5 Rob Buis 2021-12-14 06:09:41 PST
Created attachment 447126 [details]
Patch
Comment 6 EWS 2021-12-14 08:21:26 PST
Committed r287023 (245228@main): <https://commits.webkit.org/245228@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 447126 [details].
Comment 7 Adam Seckel 2021-12-14 10:14:37 PST
Thanks for the swift progress on this folks! 🙌
Comment 8 Brent Fulgham 2022-02-04 10:29:42 PST
This change should be present in STP 139, iOS 15.4 Beta, and macOS 12.3 Beta.