Bug 296243

Summary: Non-replaced element with aspect-ratio enforces automatic minimum, even if explicitly set to 0
Product: WebKit Reporter: Oriol Brufau <obrufau>
Component: Layout and RenderingAssignee: alan <zalan>
Status: RESOLVED FIXED    
Severity: Normal CC: ahmad.saleem792, bfulgham, koivisto, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: BrowserCompat, InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://github.com/web-platform-tests/wpt/pull/59423
Attachments:
Description Flags
Screenshot Firefox vs Chrome vs Webkit
none
[fast-cq]Patch none

Oriol Brufau
Reported 2025-07-20 03:40:14 PDT
Created attachment 476124 [details] Screenshot Firefox vs Chrome vs Webkit ``` <!DOCTYPE html> <style> div { aspect-ratio: 1; width: max-content; height: 0; border: 25px solid cyan; margin: 50px } div::before { content: ""; display: block; width: 50px; height: 50px; background: magenta } </style> <div style="min-width: auto"></div> <div style="min-width: 0"></div> ``` In the 2nd case, the content-box should be 0px wide (transferring `height: 0` thru the aspect ratio). Chrome and Firefox agree. However, in WebKit it's 50px wide because of the contents. That should only happen in the 1st case with the automatic minimum.
Attachments
Screenshot Firefox vs Chrome vs Webkit (14.63 KB, image/png)
2025-07-20 03:40 PDT, Oriol Brufau
no flags
[fast-cq]Patch (4.47 KB, patch)
2026-04-12 19:45 PDT, alan
no flags
Ahmad Saleem
Comment 1 2025-07-20 09:24:16 PDT
It is broken on Minibrowser (WebKit ToT - 297661@main) as well.
Radar WebKit Bug Importer
Comment 2 2025-07-27 03:41:11 PDT
alan
Comment 3 2026-04-12 19:45:51 PDT
Created attachment 479037 [details] [fast-cq]Patch
EWS
Comment 4 2026-04-13 08:20:43 PDT
Committed 311096@main (51f2f1647fce): <https://commits.webkit.org/311096@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 479037 [details].
Oriol Brufau
Comment 5 2026-04-13 16:46:21 PDT
Please export the test. Also, it might have been better to place it within `css/css-sizing/aspect-ratio/`
Sammy Gill
Comment 6 2026-04-22 15:20:57 PDT
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/59423
Note You need to log in before you can comment on or make changes to this bug.