W3C home > Mailing lists > Public > www-style@w3.org > March 2015

Re: [css-grid] How to resolve lines for absolutely positioned grid items

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Wed, 25 Mar 2015 16:52:50 -0700
Message-ID: <CAAWBYDC0EKUhNR6CcLpewJ5hr_QDA3+E3MwsZU_9vJRUB8-Rng@mail.gmail.com>
To: Mats Palmgren <mats@mozilla.com>
Cc: "www-style@w3.org" <www-style@w3.org>
On Tue, Mar 24, 2015 at 11:58 AM, Mats Palmgren <mats@mozilla.com> wrote:
> Hi,
>
> I'm implementing Grid layout for Gecko and I have a few questions
> on how lines should be resolved for abs.pos. grid items.
> (I'm including a full example inline at the bottom)
>
> Q1. what is the end line for "grid-column: auto / span 2" ?
>
> My understanding is that "span 2" means "cover two tracks"
> just as it does for normal flow grid items, i.e. line 3.
> Is that correct?

Ah, that's a great question.  We didn't really consider that case.
Off the top of my head, a reasonable answer seems to be that it the
span is resolved as if the "auto" contributes the first/last line,
which appears to match your intuition. (In other words, yeah, I think
it should stretch from the left padding edge to line 3.)

> Q2. what is the end line for "grid-column: auto / span A" ?
> http://dev.w3.org/csswg/css-grid/#grid-placement-errors
> third paragraph says it should be treated as "span 1"
> which seems undesirable for abs.pos. grid items.
>
> (I would like the answer to cover both when line A exists
> and when it doesn't exist.)

If we do what I suggested above, this would span from the left padding
edge to the first line named A (or to the end of the explicit grid, if
there is no line named A).

> Q3. what is the start and end lines for "grid-column: 99 / 100"
>     in a 3x3 grid?
>
> I think first clamping the lines to the implicit grid bounds
> makes sense ("4 / 4").  And then the error handling:
> http://dev.w3.org/csswg/css-grid/#grid-placement-errors
> (first paragraph says "it instead contributes nothing")
> makes it "4 / auto".  So the containing block will cover
> the area between the end of the grid to the padding-edge on
> the right side.  Is that correct?

Hm.  I was initially going to say that it should be positioned at
99/100 and grow the implicit grid, but this is weird, because you can
have abspos grandchildren, and we don't want arbitrary descendants to
be able to affect the implicit grid.

So, I think your intuition is right - assuming the implicit grid
hasn't been grown that far, they should clamp down to the last line,
and error-handling will kick in to fully define the rendering.  This
needs to be properly specified.

> And what is the answer to Q3 if the grid has no tracks at all?
> (same as "auto / auto" ?)

The number of explicit tracks doesn't affect the answer.

> I'm assuming that abs.pos. grid items don't create new tracks
> in the implicit grid due to the Note in 9.4:
> "such elements do not take up space or otherwise
>  participate in the layout of the grid."
> http://dev.w3.org/csswg/css-grid/#abspos-items
> but it was brought up during code review that there is nothing
> in the spec that actually says that.  To the contrary,
> the intro to chap 6. "The Implicit Grid" makes no exception
> for abs.pos. grid items:
> http://dev.w3.org/csswg/css-grid/#implicit-grids

There are no abspos grid items. ^_^  Or, hm, looking at the spec,
looks like the abspos *children* of a grid item technically are, but
abspos grandchildren wouldn't be, and that seems to be an oversight -
I think it needs to be just in-flow children.  I need to review the
spec and make sure we didn't have a reason to make the out-of-flow
children be grid items; if not, then I'll fix the definition to
exclude absposes.

~TJ
Received on Wednesday, 25 March 2015 23:53:38 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:39:30 UTC