Use the proper aspect ratio in flexbox (#33256)

When computing the automatic minimum size, flex layout was using the
natural aspect ratio, ignoring the `aspect-ratio` property.

`ReplacedContent::inline_size_over_block_size_intrinsic_ratio()` is now
made private to avoid more accidental uses.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Oriol Brufau 2024-08-30 08:28:14 +02:00 committed by GitHub
parent 13cbcf614a
commit cd8b803368
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 57 additions and 28 deletions

View file

@ -235020,6 +235020,19 @@
{}
]
],
"flex-aspect-ratio-055.html": [
"d512d84c866a283c5e36b61c62062bf72d2b44f4",
[
null,
[
[
"/css/reference/ref-filled-green-100px-square-only.html",
"=="
]
],
{}
]
],
"floats-aspect-ratio-001.html": [
"53627d2134aacff311142d5513a5a662264143de",
[

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<link rel="author" title="Oriol Brufau" href="obrufau@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio">
<link rel="help" href="https://drafts.csswg.org/css-flexbox-1/#min-size-auto">
<link rel="match" href="../../reference/ref-filled-green-100px-square-only.html">
<meta name="assert" content="
The automatic minimum size makes the flex item be 50px wide (converted from the height through the aspect ratio).
Adding the borders, the flex container is then a 100x100 square.">
<style>
.flex {
display: inline-flex;
border: solid 25px green;
}
.flex img {
height: 50px;
flex: 0 0 0px;
aspect-ratio: 1 / 1;
}
</style>
<p>Test passes if there is a filled green square.</p>
<div class="flex">
<img src="support/20x50-green.png">
</div>