Re: [csswg-drafts] [css-sizing-4] Should aspect-ratio apply for width: auto; height: auto;? (#5060)

> So, I want to follow up on the flex item case. First I thought you were right, now I'm not sure. See:
> []( step 3
> "_Once the cross size of a flex line has been determined_, the cross sizes of items in auto-sized flex containers are also considered definite" (emphasis mine)
> But []( happens _before_ the cross-size determination.
> As such, I think the flex item case does require a `height: 100%` to trigger aspect-ratio in this case.

Funnily enough, this comment was posted just a few days after we committed the (mistaken, it turns out) simplification to the definiteness rules you asked for in #3531, which made this exact case no longer have a definite size. While reviewing this thread we realized it wasn't redundant at all, exactly for cases like this, and restored that text in <>, so now the spec is back to the expected behavior of the flex item having a definite cross size immediately (because it's stretched, and the flex container is single-line and has a definite cross size), so the aspect-ratio should activate and give the item a width of 100px.

> You convinced me for the align-self: stretch case, but I don't see why that's the case for non-stretched items?

A non-stretched item won't gain a definite height like the above; it'll fall through to Flexbox algo step 3 case E, in which its width becomes max-content, which per css-sizing-3 depends on its available inline size, which is defined in Flexbox step 2 as the inner size of the flex container. At this point its *width* becomes definite, so the a-r should then give it a height. (Note that this doesn't require it to flex; this happens prior to that step.)

Firefox appears to get this case right, currently; Chrome for some reason keeps it at the naturalHeight regardless ([testcase](! So, this appears to be well-defined and in line with what we'd expect.

We think there's nothing left to do for this issue, if that seems right shall we close it?

~@tabatkins & @fantasai

GitHub Notification of comment by fantasai
Please view or discuss this issue at using your GitHub account

Received on Monday, 20 July 2020 19:25:06 UTC