Re: [csswg-drafts] [css-flexbox] Why does flex item aspect ratio sizing not take max-width into account? (#3736)

@cbiesinger I'm not sure I understand your point about consistency. Those two calculations *are* consistent, are they not? The only difference is that the min-size uses the minimum size and the base size doesn't, which is appropriate.

Anyway, to follow your example...
```
<div style="display: flex; flex-direction: column; width: 10px;">
  <img src="10x10.png" style="max-width: 5px">
</div>
```

First, we calculate the minimum main size of this image, which is an automatic minimum size. The specified size is undefined, the transferred size is 5px, and the content size is 10px. The transferred size wins, so its minimum main size is 5px.

Then we calculate the base size. The flex basis is `content` and it has an aspect ratio. It doesn't have a definite cross size, so we fall down to E, which says to size the item into the available space treating its main size as `max-content`. The `max-content` value runs its calculations based off of sizing an `auto`-height floated 10x10 image in an infinitely-sized containing block--according to CSS2.1 section 10.4 this is max(max-width*h/w,min-height) which here is equal to 5px. The resulting main size is 5px, the cross size is 5px, and the image maintains its 1:1 aspect ratio, which is exactly the result you want in 972576, no?


-- 
GitHub Notification of comment by fantasai
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3736#issuecomment-501006571 using your GitHub account

Received on Tuesday, 11 June 2019 20:18:35 UTC