Re: [css3-multicol] unknown available width and shrink-to-fit

Simon Sapin wrote, here:

   http://lists.w3.org/Archives/Public/www-style/2012Jul/0598.html

 > In 3.4 Pseudo-algorithm:
 > 
 > > available-width: if the used width of the multi-column element has
 > > not been determined when the ‘column-count’ and ‘column-width’ must
 > > be determined (e.g., if it is floating with a ‘width’ of ‘auto’ as
 > > per CSS 2.1 section 10.3.5) this variable is unknown
 > 
 > [...]
 > 
 > > shrink-to-fit: this variable represents the result of a shrink-to-fit
 > > computation. CSS does not define the exact algorithm.
 > 
 > 
 > Actually shrink-to-fit is defined in CSS 2.1. It is based on the 
 > preferred width and preferred minimum width which, them, are note 
 > defined exactly:
 > 
 > 10.3.5:
 > 
 > > Then the shrink-to-fit width is:
 > > min(max(preferred minimum width, available width), preferred width).

But, before that, it also says:

  Roughly: calculate the preferred width by formatting the content
  without breaking lines other than where explicit line breaks occur,
  and also calculate the preferred minimum width, e.g., by trying all
  possible line breaks. CSS 2.1 does not define the exact algorithm.

  http://www.w3.org/TR/CSS21/visudet.html#float-width

So, CSS 2.1 and CSS3-multicol are similar in this regard; the both
define an algorithm, but do not define how to calculate all input
components to the algorithm.

 > Note that the shrink-to-fit variable is only used in the multicol 
 > algorithm when available-width is unknown, but css21’s definition of 
 > shrink-to-fit requires a know available width. I don’t know what was the 
 > original intent of the spec, but clearly it doesn’t work as it stands.

But it's two different widths. In CSS 2.1, the "available-width" is
the width of the containing block of the float. In CSS3-multicol, the
"available-width" is the used width of the multi-column element
itself. So I don't think there is a circular dependency.

Say, we have:

  <one>
     <two></two>
  </one>

and 

  two { float: right; width: auto; column-count: 3 }

In CSS 2.1, the "available-width" is the content width of <one>.

In CSS3-multicol, the "available-width" is the content width of <two>.

 > Conversely, I think that the only situations where the available with 
 > might be unknown is when trying to determine a preferred (minimum) 
 > width. 

Really? The example used in the CSS3-multicol is this:

  .multicol { width: auto; float: left }

Arguably a corner case, but I thik we should define it. 

 > These are generally based recursively on the preferred outer 
 > widths of the content. In the multicol case, I think that the content 
 > should be the basis for the width of a single column, not for the whole 
 > multicol element as the pseudo-algorithm seems to imply.

I believe the intention of having these lines in the algorithm:

  if (available-width = unknown) then
     available-width := shrink-to-fit;

is that floats should not change in width if/when they are/become multicol.

That is, these two elements should have the same width:

  one { width: auto; float: left; column-width: auto; column-count: auto }
  two { width: auto; float: left; column-width: auto; column-count: 2 }

Are there better ways to express this than the pseudo-algorithm?

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

Received on Wednesday, 26 September 2012 19:10:16 UTC