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

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

From: Julien Chaffraix <julien.chaffraix@gmail.com>
Date: Wed, 6 Mar 2013 13:55:45 -0800
Message-ID: <CAGY_oHJNZvFN-gZmzCMZfpWZXyEmSa4p0=bo+kmvnrALiKnF5w@mail.gmail.com>
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: Henrik Andersson <henke@henke37.cjb.net>, www-style list <www-style@w3.org>
>> 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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:21:06 GMT