Re: [csswg-drafts] [css-flexbox] Change content-size suggestion to min-intrinsic instead of min-content? (#6794)

> Right, our point is that we explicitly invoke aspect-ratio in the transferred size suggestion, and explicitly do not use that suggestion for non-replaced elements, so having the aspect-ratio still sneak in via the content-size suggestion seems like it's an accident.

See David's point above. Considering the aspect-ratio for only parts of the automatic-minimum-size (the content-size part), and not for other parts, is a little strange to me.

Not considering the aspect-ratio at all (for non-replaced elements) seems like a little bit of a mis-step? E.g. if people want to let the element size down to zero - they can set "min-width: 0" like usual. This means that aspect-ratio within a flexbox behaves like aspect-ratio within all other layout modes.
```html
<div style="display: flex; width:0; border: solid; height: 100px;">
  <div style="background: green; aspect-ratio: 1/1; flex-basis: 0; min-width: auto;"></div>
</div>
```
In the above example the current spec text has this as 100x100, with the new spec text it is 0x100 (AFAICT).

I still think that we should consider redefining min/max-content as considering the "min-size: auto" constraint. We already somewhat do this if we have a min-height/max-height in the opposite axis.

This would simplify all algorithms (grid/flex) which rely on either querying min-content-size or min-content-contribution-size, and I think match developer expectations a little more.

In code this would roughly look like:
```js
let computeContentSizes = (box) => {
  let [min_size, max_size] = box.ComputeMinIntrinsicSizes();
  
  // I'm omitting how the min/max transferred sizes work here, its just a little more logic.
  let transferred_size = ...;

  if (box.Style().HasAspectRatio()) {
    if (box.Style().MinSize() == "auto") {
      min_size = std::max(min_size, transferred_size);
      max_size = std::max(max_size, transferred_size);
    } else {
      min_size = max_size = transferred_size;
    }
  }

  return {min_size, max_size};
};
```

This wouldn't really break the intention "behaves like a float in zero/infinite space" the only thing we'd also need to consider is if the min-size is auto, etc.

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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 15 March 2022 19:43:33 UTC