LibWeb: Fix overeager fallback to stretch-fit width for some flex items

If a flex item has a preferred aspect ratio and the flex basis is not
definite, we were falling back to using stretch-fit for the main size,
since that appeared to match other browsers.

However, we missed the case where we actually have a definite cross size
through which the preferred aspect ratio can be naturally resolved.
This commit is contained in:
Andreas Kling 2024-06-23 15:52:14 +02:00 committed by Andreas Kling
commit db1faef786
Notes: sideshowbarker 2024-07-17 22:55:25 +09:00
3 changed files with 36 additions and 3 deletions

View file

@ -0,0 +1,19 @@
<!doctype html><style type="text/css">
* { outline: 1px solid black; }
html {
background: white;
}
body {
display: flex;
background: orange;
width: 200px;
}
svg {
background: cyan;
height: 20px;
}
div {
background: magenta;
width: 100px;
}
</style><body><svg viewBox="0 0 24 24"><rect x=0 y=0 width=12 height=12></svg><div>