When `aspect-ratio` is applied to a box with content, the box should prevent overflow by growing to be tall enough to fit the content, plus space for whatever margins or padding are involved.
From the spec:
>In order to avoid unintentional overflow, the automatic minimum size in the ratio-dependent axis of a box with a preferred aspect ratio that is neither a replaced element nor a scroll container is its min-content size clamped from above by its maximum size.
This works in the WebKit implementation, unless there is padding applied to the box. It looks like the padding is being subtracted from the height, instead of added, or something similarly weird.
Created attachment 426984 [details]
Created attachment 426997 [details]
Created attachment 427000 [details]
Created attachment 427006 [details]
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
Created attachment 427273 [details]
To be clear, the first patches had a WPT test included that I developed. Today I discovered that there is already a very similar WPT test available, so the latest patch imports that one.
Comment on attachment 427273 [details]
But there are multiple code changes and only one test case. Seems like we need more test cases. When I see branches in code I assume each needs a different test, so this seems to require at *least* 3 tests, but maybe more if we want to cover not changing the cases we don’t want to.
Committed r276745 (237145@main): <https://commits.webkit.org/237145@main>
All reviewed patches have been landed. Closing bug and clearing flags on attachment 427273 [details].