mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
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:
parent
13cbcf614a
commit
cd8b803368
4 changed files with 57 additions and 28 deletions
13
tests/wpt/meta/MANIFEST.json
vendored
13
tests/wpt/meta/MANIFEST.json
vendored
|
@ -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",
|
||||
[
|
||||
|
|
24
tests/wpt/tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-055.html
vendored
Normal file
24
tests/wpt/tests/css/css-sizing/aspect-ratio/flex-aspect-ratio-055.html
vendored
Normal 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>
|
Loading…
Add table
Add a link
Reference in a new issue