Re: [css-grid] Interactions between min/max-content and min/max-width

On 22/11/14 03:25, fantasai wrote:
> On 11/21/2014 06:32 AM, Sergio Villar Senin wrote:
>> In section 10.5 of the specs, the "Grow All Tracks To Their Max" step
>> literally says:
>>
>> "For the purpose of this step: if sizing the grid container under a
>> max-content constraint, the free space is infinite; if sizing under a
>> min-content constraint, the free space is zero."
>>
>> If I am not wrong that's not always accurate, I'm thinking in two cases
>> in particular:
>>
>> - grid container sized under max-content with a "definite" max-size.
>> Instead of infinity I guess we should respect the max-size.
>> - grid container sized under min-content with a "definite" min-size. In
>> this case instead of non distributing anything, I guess we should try to
>> fulfill the min-size restriction.
>>
>> Are those assumptions correct?
> 
> Yes. The min/max-size properties are basically defined as:
>   1. Do layout ignoring them, use just the size property.
>   2. If layout violates the max-size, redo layout using the max-size as
> the size.
>   3. If layout violates the min-size, redo layout using the min-size as
> the size.
> 
> Of course, an implementation won't actually do that. But that's how
> they're defined.

Many thanks for the information, although I am not completely satisfied
:) because I haven't asked the right question.

My point is, should we take into account {min/max}-{width/height} values
set in the grid container when sizing the grid tracks? At least for me
is not completely obvious. Let's use an example (assuming we're using
Ahem font with size 10px).

<div style="display: grid; width: min-content; min-width: 100px;">
   <div style="grid-row: 1; grid-column: 1;">XXX XXX XXX</div>
</div>

>From my understanding there are 2 potential interpretations:
a) min-width *does not* affect tracks sizing.

So as the grid is under a min-content restriction that means that no
extra space will be allocated so the track will be 30px wide (used
breadth: 30px, max breadth: 110px).

The grid container will be 100px wide anyway.

b) min-width *does* affect tracks sizing.

So despite being under min-content restriction we distribute space till
we fulfill the min-width of the grid container. This means that the
track will grow till 100px (used breadth: 100px, max breadth: 110px).

Which is the right one?

Now should b) be correct one, things become a bit complex because I
guess we should also check that the values of {min/max}-{width/height}
are definite.

BR

PS: similar things happen with max-content and max-width

Received on Wednesday, 3 December 2014 11:20:37 UTC