Re: [css3-multicol] 'column-fill' and column overflow

On Mon, Mar 4, 2013 at 7:06 AM, David Hyatt <hyatt@apple.com> wrote:

> I think the spec needs to really spell out when and how balancing is
> supposed to occur, because right now I really have no idea when or how I'm
> supposed to balance columns. The current implementation of balancing in
> WebKit is pretty poor as a result, since the spec hasn't really provided
> enough information for me to really understand what I'm supposed to do. I
> have no idea how forced breaks affect balancing. I have no idea how
> overflow affects balancing. There is no balancing algorithm in the spec, so
> I don't know what the expectations are for balancing (is it 2-pass, is it
> n-pass, etc.).
>
> My own intuition regarding balancing is that it is done per-column-row, so
> it seems like the spec should be talking in terms of column-rows. I would
> think that balancing would be done when:
>

What exactly do you mean by "column-row"?

(1) The height of the column-row is both unknown and not constrained by any
> enclosing pagination context, so you have to create equal height columns to
> try to determine the height of the column-row. This could include overflow
> columns, the column-row on the last printed page, etc.  I don't think you
> would want to special case overflow in this situation, since you would not
> even know you had overflow columns until you had done a layout with the
> balancing guess.
>
> (2) There is excess height in the column-row. Even then I have questions…
> if the excess height is caused by a forced page break for example, but all
> the columns in the row had unforced breaks, do you balance the columns on
> that page?
>
> I really think we need clear and precise rules for exactly when to balance,


Definitely...


> and I think the spec needs to actually provide an algorithm for balancing,
> even if it's just informative. Something on the level of
>
> http://dev.w3.org/csswg/css3-regions/#regions-visual-formatting-examples
>
> but explaining how to balance would be helpful.
>

In Gecko we try to find a balance height H satisfying:
-- Laying out the content with column height H does not have overflow
-- Laying out the content with column height H - epsilon has overflow
"Has overflow" means "some border-box of content in the columns extends
beyond the column height, ignoring relative positioning and CSS transforms".

This definition seems intuitive and is robust to the addition of CSS
features. Such an H always exists. It's unique in most cases; in fact I
don't know of any examples where it's not unique, although proving it's
unique in all possible cases sounds challenging. We implement this fairly
directly with multi-pass layout and a kind of binary search, with some
heuristics and shortcuts to try to keep the number of passes small.

Rob
-- 
Wrfhf pnyyrq gurz gbtrgure naq fnvq, “Lbh xabj gung gur ehyref bs gur
Tragvyrf ybeq vg bire gurz, naq gurve uvtu bssvpvnyf rkrepvfr nhgubevgl
bire gurz. Abg fb jvgu lbh. Vafgrnq, jubrire jnagf gb orpbzr terng nzbat
lbh zhfg or lbhe freinag, naq jubrire jnagf gb or svefg zhfg or lbhe fynir
— whfg nf gur Fba bs Zna qvq abg pbzr gb or freirq, ohg gb freir, naq gb
tvir uvf yvsr nf n enafbz sbe znal.” [Znggurj 20:25-28]

Received on Monday, 4 March 2013 02:12:17 UTC