Re: [css3 multicol] Bug in line 21 of the pseudo-algorithm?

David Hyatt <hyatt@apple.com> writes:

> When I changed WebKit to match the newer pseudo algorithm, I hit a
> compatibility issue with existing multi-column content.  The specific
> compatibility issue is with line 21 of the pseudo algorithm, and it occurs when
> an author specifies both a column-count and a column-width inside an element
> whose available width is known.
>
> The case in question is:
>
>
> (19)  if (column-width != auto) and (column-count != auto) then
> (20)    N := min(column-count, floor((available-width + column-gap) / (column-width + column-gap)))
> (21)    W := ((available-width + column-gap) / N) - column-gap;
> (22)  exit
>
> Line 21 is causing the incompatibility for us, and I think there is a mistake
> here. When both column-count and column-width are specified, I would not expect
> the column-width to be increased just to fill an available width. It seems to
> me that the line in question should actually be:
>
>
> (21)    W := min(column-width, ((available-width + column-gap) / N) - column-gap)
>
> With this change, the column-width and column-count both act as maximum allowed
> values, rather than only having the column-count act as a maximum allowed
> value. This makes more sense to me, since if an author specifies width:600px,
> column-count:2; column-width:200px, it's odd to me that the columns would grow
> to be nearly 300px wide. The author's intent is pretty clear here, so we should
> honor it, even if it leaves leftover space.

Why can't we treat this as an overconstrained situation? Leftover space
is, as far as I understand and remember, not something we want in the
multicol model. I think it would be better to just let column-width win,
and do (what is currently known as) (16) and (17).

Basically remove line 19-22, and remove the test at (15) - so that we
get this:

(11)  if (column-width = auto) then
(12)    N := column-count;
(13)    W := max(0, (available-width - ((N - 1) * column-gap)) / N);
(14)  exit;

(15)  N := max(1, floor((available-width + column-gap) / (column-width + column-gap)));
(16)  W := ((available-width + column-gap) / N) - column-gap;

(I also dropped a condition from (11) that would always be true anyway,
but I suppose that's a matter of taste)

-- 
---- Morten Stenshorne, developer, Opera Software ASA ----
---- Office: +47 23693206 ---- Cellular: +47 93440112 ----
------------------ http://www.opera.com/ -----------------

Received on Friday, 18 November 2011 08:31:21 UTC