Re: [css3-multicol] Error in latest pseudo-algorithm

David Hyatt wrote:

 > I implemented the new pseudo-algorithm in the latest draft of CSS3
 > multi-column and we ended up running into a divide-by-zero issue.
 > The error is on line 20. It needs a max(1, ....) just like line 16
 > has to avoid setting N to 0.

Right. The current line reads:

  N := min(column-count, floor((available-width + column-gap) / (column-width + column-gap)))

And, to avoid N becoming 0, it should be:

  N := max(1, min(column-count, floor((available-width + column-gap) / (column-width + column-gap))))

Or, perhaps:

  N := min(column-count, floor((available-width + column-gap) / (column-width + column-gap)))
  N := max(1, N);

I've added the last version to the editor's draft.

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

Cheers,

-h&kon
              Håkon Wium Lie                          CTO °þe®ª
howcome@opera.com                  http://people.opera.com/howcome

Received on Sunday, 15 May 2011 19:41:29 UTC