Re: [css3-grid-layout] Negative numbers for <grid-line>

>> 1) Which negative range is allowed for <integer>?
>>
>> There are several options:
>> * Match Python which allows negative integers up to -len(array),
>> something below is in error and resolves to 'auto'. This has the
>> downside of allowing the auto-placement algorithm to run in some
>> cases.
>> * Allow arbitrary values, knowing that they would be brought back into
>> the appropriate range (e.g. using modulo).
>> * Match what the specification does for numbered named grid line and
>> clamp the value to - (size of the grid) thus resolving in the first
>> grid line.
>
> I'd do option 3, clamping them to the first grid line.
>
> The -1 grid line is the last line defined by grid-definition-*.

I guess you meant to also include grid-template and any explicitly
positioned items or else this is not compatible with the grid
auto-placement sizing algorithm (which is btw what we use in WebKit to
size the grid regardless of whether we have auto placed grid items).

>> 2) Interaction with the Automatic Grid Item Placement Algorithm (section 6.3.1)
>>
>> Currently the specification allows "the position and size of any
>> explicitly-defined grid items" which would cover negative positions. I
>> would propose to ignore them for the purpose of sizing the grid based
>> on what the resolution above.
>
> I don't understand.  The negative value resolves to an equivalent
> positive value from the other edge, at which point it's identical to a
> normal explicit position.  Why would you ignore them?

That's a fair point, I just thought it would be weird to let a
negative number impact the grid sizing but that's a convenient way to
resolve the issue (we don't even need option 3 as the grid is sized so
that the grid item falls naturally into the first grid line).

Something like the following would be nice to have in the specification:

"Explicitly positioned items with negative grid lines are treated as
if they had their absolute grid-line value for the purpose of sizing
the grid."
(the wording can be improved but you get the idea)

Thanks,
Julien

Received on Monday, 25 March 2013 22:35:20 UTC