Re: [css-sizing][css-grid] Doubt about definite/indefinite size

On Tue, Oct 6, 2015 at 4:13 AM, Manuel Rego Casasnovas <rego@igalia.com> wrote:
> we're trying to implement properly in Blink the support for percentage
> tracks when the size of the grid container is indefinite [1]:
> "If the inline or block size of the grid container is indefinite,
> <percentage> values relative to that size are treated as auto."
>
> However, we've had some discussions about when a size is or not indefinite.
>
> The particular case is an absolutely positioned grid container with
> "auto" height, but "non-auto" top and bottom properties. E.g.
> <div style="position: relative; height: 100px;">
>   <div style="display: grid; position: absolute; top: 0; bottom: 0;">
>   </div>
> </div>
>
> IMHO, the height of the grid container should be definite in this case,
> as we don't have to measure the content to determine it. Is this right?

Yes.  This is defined in 2.1, tho it's a little tricky to find.  Check
<http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-height>,
which defines that all of the variables in that equation are resolved
at used-value time.  As long as none of them require measuring
content, and of the top/bottom/height triplet, only height is auto,
then height is determined without reference to content, and should be
definite.

We've added an issue to define this better in the Sizing spec, so
thanks for bringing it up. ^_^

> Talking about grids, if it's definite and we've grid-template-rows: 40%
> 60%. 1st row should be 40px and 2nd row 60px. Otherwise, the rows would
> become as "auto" rows (adapting the size to their contents).

Yes, they'll resolve to 40px and 60px.

> As a side note, I'm not sure if the wording for "definite" in the sizing
> spec is or not completely right [2]:
> "A size that can be determined without measuring content; that is, a
> <length>, a size of the initial containing block, or a <percentage> that
> is resolved against a definite size."
>
> My question is that from the spec text it seems be limited to:
> 1) <length>
> 2) size of the initial containing block
> 3) <percentage>
>
> However, from a previous thread [3] it seems clear that "width: auto;"
> can be definite (if the container has a definite size). E.g.
> <div style="width: 200px;">
>   <div sltyle="width: auto;">Inner div</div>
> </div>
>
> The width of the "Inner div" is definite, but it doesn't seem to comply
> with any of 1), 2) and/or 3) options listed above.
>
> Would it be nice to add some clarification to the spec?

Yeah, we'll clarify this. There's an issue in Sizing now.

~TJ and fantasai

Received on Thursday, 5 November 2015 01:14:11 UTC