Re: [csswg-drafts] [css-sizing-4] Should aspect-ratio affect the intrinsic size? (#5032)

@bfgeek So wrt Option 2... if we take the natural size of an image as analogous to the content size of a non-replaced element *and* maintain the correspondendance of min-content/max-content to the min/max extremes of shrink-to-fit, then Option 2 would break the current handling of floating images. Assuming we want to maintain the shrink-to-fit correspondence, we could take your interpretation only if we decide to break the content-size=natural-size analogy. Which is an interesting possibility! So, if I'm understanding correctly, option 2 could be:
    * min-content/max-content/fit-content on replaced elements defers to the aspect ratio rather than maxxing with natural size, to maintain consistency with current shrink-to-fit behavior.
    * min-content/max-content/fit-content on non-replaced elements takes the larger of the aspect-ratio-derived size (if applicable) and the content-based size

But the problem with this is that it would give unexpected results for shrink-to-fit boxes. Consider your cases A-D as a float. The min-content size of the float would be 150px: if we put the float in a narrow box, it would not shrink below 150px, the size of its largest unbreakable content. This is fine, and probably what an author would expect. But if we place the float into a large container, it takes its max-content size, which would be 300px. This is not what an author would expect: they would expect the float to be its aspect-ratio-constrained width (floored by the min-content width if necessary), but no larger than that.

This suggests that either (a) both min-content and max-content work off the min-content size and AR (probably confusing?) or (b) we give up and go back to Option 1, where the shrink-to-fit size of a non-replaced ratio-having element is solely determined by its ratio and the size in the other dimension (tho still floored by the 'min-width: auto', giving a width of 150px in this case) or (c) max-content no longer represents the max extreme of shrink-to-fit/fit-content, but is something else entirely??

[In both of (a) and (b) the behavior of min-content and max-content are identical to each other for any element with an aspect-ratio, but we can't figure out a way to make them different without falling to the unintuitive behavior outlined above.]

Fwiw, our current inclination is to stick with [Option 1](https://github.com/w3c/csswg-drafts/issues/5032#issuecomment-644517090) / https://github.com/w3c/csswg-drafts/issues/5032#issuecomment-639874263  Further thoughts?

~@fantasai and @tabatkins 

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

Received on Monday, 29 June 2020 23:17:51 UTC