[css3-multicol] Pseudo-algorithm feedback

Hi, a few comments on the pseudo-code in section 4.4 [1].

a. I suggest adding line numbers to the code block; it may be very helpful when referring to and commenting about it. I provide a full copy below.

b. Given that the result of the algorithm may depend on the shrink-to-fit value, should the algorithm to define this computation be left undefined by CSS ?

c. Line 30 should be :
                     W := available-width;

d. Same for line 41.

e. Section 4.1 indicates that column-width's value may expand to fill the available space. Yet this is not what the clause from lines 35-38 does. It seems its outcome is only valid 
when the expression matches available-width i.e.

                    (35)  elsif ((column-count * column-width) + ((column-count - 1 ) * column-gap) = available-width) then
...instead of :
                    (35)  elsif ((column-count * column-width) + ((column-count - 1 ) * column-gap) <= available-width) then



(1)   if ((column-width = auto) and (column-count = auto)) or
(2)      ((available-width = unknown) and (column-count = auto)) then
(3)     exit; /* no columns */
(4)   fi
(5)
(6)   if (available-width = unknown) and (column-count != auto) and (column-width != auto) then
(7)     N := column-count;
(8)     W := column-width;
(9)     exit;
(10)  fi
(11)
(12)  if (available-width = unknown) then
(13)    available-width := shrink-to-fit;
(14)  fi
(15)
(16)  if (column-width = auto) then
(17)    if ((column-count - 1) * column-gap < available-width) then
(18)      N := column-count;
(19)      W := (available-width - ((N - 1) * column-gap))/N;
(20)    elsif (column-gap >= available-width) then
(21)      N := 1;
(22)      W := available-width;
(23)    else
(24)      N := floor(available-width/column-gap);
(25)      W := (available-width - ((N - 1) * column-gap))/N;
(26)    fi
(27)  elsif (column-count = auto) then
(28)    if (column-width >= available-width) then
(29)      N := 1
(30)      W := column-width;
(31)    else
(32)      N := floor((available-width + column-gap) / (column-width + column-gap));
(33)      W := ((available-width + column-gap) / N) - column-gap;
(34)    fi
(35)  elsif ((column-count * column-width) + ((column-count - 1 ) * column-gap) <= available-width) then
(36)    N := column-count;
(37)    W := column-width;
(38)  elsif (column-width >= available-width) then
(40)    N := 1
(41)    W := column-width;
(42)  else
(43)    N := floor((available-width + column-gap) / (column-width + column-gap));
(44)    W := ((available-width + column-gap) / N) - column-gap;
(45)  fi

[1] http://dev.w3.org/csswg/css3-multicol/#pseudo-algorithm

Received on Tuesday, 2 June 2009 05:57:08 UTC