Re: [css3-multicol] available-width = unknown and shrink-to-fit with spanning element

"Gérard Talbot" <www-style@gtalbot.org> writes:

> [test]
> http://test.csswg.org/source/contributors/opera/submitted/multicol/multicol-span-all-margin-nested-003.xht
>
> In this test, the available width is unknown. So, we start with
>
> (09)  if (available-width = unknown) then
> (10)    available-width := shrink-to-fit;
> 3.4. Pseudo-algorithm
> http://www.w3.org/TR/css3-multicol/#pseudo-algorithm

Note: you should probably take a look at
http://dev.w3.org/csswg/css-multicol/#pseudo-algorithm instead. There's
really no need to define shrink-to-fit behavior right here, so the new
version is much simpler. The resulting layout from the new algorithm
should be 100% identical to what's in the current WD, though.

> and then follow and apply:
>
> shrink-to-fit width is:
>
> min(max(preferred minimum width, available width), preferred width).
>
> http://www.w3.org/TR/CSS21/visudet.html#shrink-to-fit-float

Note again: http://dev.w3.org/csswg/css-sizing/#multicol-intrinsic is
work in progress to define shrink-to-fit (and similar stuff) for
multicol better.

> in which case:
>
> min(max(preferred minimum width, available width), preferred width)
> min(max(4em, body's available width), 19em)
> min(body available width, 19em)
> and so shrink-to-fit width should be 19em (which is 4 FAIL words separated
> with 3 preserved white spaces).
>
> Then what do we do with the rest of the pseudo-algorithm? Should we
> continue with calculation of column box width?
>
> (13)    W := max(0, (available-width - ((N - 1) * column-gap)) / N);
>
> I ask because the reftest
> http://test.csswg.org/source/contributors/opera/submitted/multicol/multicol-span-all-margin-nested-3-ref.xht
> for the test gives a total width for the multi-column of 22em and not
> 19em. So where does such 22em comes from? Normally, the available-width
> includes the column-gapS: that's why the equation at line 13 substracts
> the column-gapS before dividing by number of columns.
>
> If 19em should be the correct width for the black rectangular area, then
> (after adding -webkit- vendor prefix) Chrome 28 would pass that test .

19em sounds like a nice width indeed, but I'm not sure if any spec can
be interpreted to that effect (19em sounds like the correct minimum
content measure of the multicol). For the maximum content measure, you
seem to be supposed to assume that none of the soft break opportunities
become actual breaks. So you have the text "FAIL FAIL FAIL
FAIL". Including the spaces, that would become a 19em wide line. Presto
(where the test passes) does this and then adds the 3 column gaps (1em
each) -> 22em. That doesn't seem right. The intrinsic/extrinsic sizing
spec seems to suggest a different behavior, though:

   The max-content measure of a multi-column element with unrestrained
   column heights and a computed ‘column-count’ not ‘auto’ is its
   ‘column-count’ multiplied by the larger of its ‘column-width’
   (treating ‘auto’ as 0) and the largest max-measure contribution of
   its contents.

The largest max-measure contribution would be 19em ("FAIL FAIL FAIL
FAIL"). So you need to multiply this by 4 (number of columns), and you
get 76em. Then you should probably add gaps as well (although the spec
fails to mention it) -> 79em! Whoaa! But that's actually exactly how
much you need if you don't want any line breaks.

> ---------
>
> I have been working on 2 other versions/variations [1] of that test. I can
> see what Chrome 28 and Opera 12.16 do ... but I can not figure out which
> one is right or wrong: any of the 2 could be right or wrong. I think the
> pseudo-algorithm needs some tuning here.
>
>
>
> [1]
> [test variation A]
> http://www.gtalbot.org/BrowserBugsSection/CSS3Multi-Columns/Opera/multicol-span-all-margin-nested-003-GT.xht
>
> [reftest variation A]
> http://www.gtalbot.org/BrowserBugsSection/CSS3Multi-Columns/Opera/multicol-span-all-margin-nested-003-GT-ref.xht
>
>
> [test (old version)]
> http://www.gtalbot.org/BrowserBugsSection/CSS3Multi-Columns/multicol-span-all-margin-nested-003-GT-previous.xht
>
> [reftest (old version)]
> http://www.gtalbot.org/BrowserBugsSection/CSS3Multi-Columns/multicol-span-all-margin-nested-003-GT-previous.xht

I think both are wrong and that the we need to fix the
intrinsic/extrinsic sizing spec to do what I wrote above (include column
gaps in the calculations).

-- 
---- Morten Stenshorne, developer, Opera Software ASA ----
------------------ http://www.opera.com/ -----------------

Received on Wednesday, 21 August 2013 08:17:23 UTC