Re: [css3-grid-layout] Dense auto layout

>> I have read the grid layout module and I think that it is very good, but
>> there is one thing that bothers me.
>>
>> It is about the automatic grid placement. I think that it has a problem
>> with spanned grid items. Namely, it leaves holes of unused space in the
>> grid in some situations.
>
> I strongly agree that dense packing is useful, but it has some
> downsides as well:
> * it has worse performance (n^2 rather than n, though most of the time
> the n will be small)
> * it can sometimes be confusing, as elements late in document order
> can appear before elements much earlier than them in document order,
> if they're the first thing to fit in that hole (but most of the time,
> holes will be filled pretty quickly)

Under the current algorithm this is even *worse* from that perspective
as the cursor will be overriden if you encounter a grid item with a
non-auto minor axis and auto major axis. I still think it will yield
to confusion among authors when the cursor will jump around due to the
previous override.

I can't think of a way the document order will not influence the
placement - placing item N depends on where you placed all the
previous items - so it's probably not such a big issue.

> Because of this, I suggest a switch on the grid-auto-flow property
> that controls whether the packing is dense or loose.
>
> Note that WebKit's implementation accidentally implemented dense
> packing already. ^_^  (It showed up in Chrome Canary a few days ago,
> if you want to check.)

FWIW, I assumed that grid auto placement should be dense, which is why
WebKit is doing that. I also send my feedbacks on the algorithm some
time ago [1] and assumed the algorithm in the specification was wrong
with not resetting the cursor (for the jumping issue I mentioned
above).

Julien

[1] http://lists.w3.org/Archives/Public/www-style/2013Feb/0468.html

Received on Wednesday, 6 March 2013 21:56:35 UTC