Re: [css3-multicol] updated editor's draft

Håkon Wium Lie <> writes:

> The multicol ED has been updated:
> [...]
> Revised the pseudo-algorithm, as per;

(reading Editor's Draft 10 May 2013)

There's really no difference between the expressions
"(U - ((N - 1) * column_gap)) / N" on line 05
"((U + column_gap) / N) - column-gap" on line 09 and 14

I suggest that one of them be picked and used consistently. The first
one is probably slightly more human-friendly (one can see clearly what's
going on; the total width of all columns is the block width minus gaps,
and the column width is that number divided by the number of columns),
while the second is reduced and more CPU-friendly. :) I think I vote for
the second one, since a similar construct also can be found on current
line 08 (where we resolve the count from width).

I think the pseudo algorithm from line 03 can be simplified to something
like this:

(03) if (column-width = auto)
(04)   N := column-count;
(05) else
(06)   N := floor((U + column-gap) / (column-width + column-gap))
(07)   if (column-count != auto)
(08)     N := min(column-count, N)
(09)   endif
(10)   N := max(1, N)
(11) endif
(12) W := max(0, (U + column-gap) / N - column-gap)

This should give the exact same results, with no code duplication.

> I've kept:
>   - the 'exit' statements

I had to change that in my suggestion above.

>   - these assumptions:
>       -- that the block direction is unconstrained
>       -- that no column breaks are added through style sheets

The used value of column-width isn't affected by breaks or block
direction restrictions, but used column-count may be, but that depends
on what "used" means in this case. The column-count property has the
following phases:

- Specified/computed (whatever the stylesheet or style attributes says)

- After running the pseudo algorithm

- Actual layout

Consider this example:

<body style="width:600px;">
  <div style="column-width:200px; column-gap:0; height:2em; line-height:1em;">

The computed value of column-count is auto.
The pseudo algorithm resolves column-count to 3.
Layout ends up with 4 columns, due to restricted height.

What if we define it so that *used* column-count in the example above is
3, while *actual* column-count is 4 [1]? If we do that, you can remove
the assumptions.


Also, it should be mentioned that the pseudo algorithm needs to be run
separately on each column row, since the available width in different
rows may vary (different page sizes, regions, what not).

---- Morten Stenshorne, developer, Opera Software ASA ----
---- Office: +47 23692400 ------ Mobile: +47 93440112 ----
------------------ -----------------

Received on Wednesday, 15 May 2013 14:58:17 UTC