W3C home > Mailing lists > Public > www-style@w3.org > May 2011

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

From: Håkon Wium Lie <howcome@opera.com>
Date: Sun, 15 May 2011 21:40:53 +0200
Message-ID: <19920.11333.531653.801333@gargle.gargle.HOWL>
To: David Hyatt <hyatt@apple.com>
Cc: "www-style@w3.org CSS" <www-style@w3.org>
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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:40 GMT