Re: [css-grid] min-height and max-height in track sizing algorithm

On 04/14/2014 03:30 PM, Peter Salas wrote:
> I don't think the grid track sizing algorithm today specifies
> how to handle the min-height/max-height (or -width) properties
> when the available space is indefinite.  Does the following
> behavior make sense?  (I'm using "min-height"/"max-height"
> for convenience, but I think the same behavior would apply
> for min-width/max-width when the grid is sized under a
> min-content/max-content constraint.)

I think the general principle, under the somewhat over-specific
definition of min/max-width/height [1] is to
   a) Do layout ignoring these properties.
   b) If that violated a max constraint, do it again with that
      constraint as the specified value.
   c) If we're now violating a min constraint, do it again with
      the min constraint as the specified value.
[1] http://www.w3.org/TR/CSS21/visudet.html#min-max-widths

Probably this is the right definition to have, although certainly
implementations would want to optimize for a single pass on the
layout if possible. :) I think ideally the definition should be
in the definition of min/max-width/height so we don't have to
repeat it in every layout spec. Unfortunately CSS2.1's definition
is a bit too specific to block layout.

Maybe the action item here is to import the definition into
Sizing.

Going through your examples...

> Example 4:
> <div style="display:grid; grid-template-columns:1fr; height:auto; min-height:50px;"></div>
> Expected: The height of the first row is 50px.  The height of the grid is 50px.
>
> Example 5:
> <div style="display:grid; grid-template-columns:1fr; height:auto; min-height:150px; max-height:50px;"></div>
> Expected: The height of the first row is 150px.  The height of the grid is 150px.

I disagree on these two. Here the rows are sized as 'auto', which
means they're sized to their content. Since there's no content,
the row height should be zero. The grid container will still be
150px, though. (If the grid contained a small item, then we could
see the difference in effect by setting alignment properties.)

Thoughts?

~fantasai

Received on Friday, 18 April 2014 01:57:37 UTC