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

Le 29/10/2012 16:27, Håkon Wium Lie a écrit :
> I agree that it could be helpful to replace the term "available-width"
> in the spec.

It is defined in the spec as the used width. I’ll just assume we have 
renamed the variable to "used-width". I think that everyone agrees on 
that much.


After a long f2f discussion with Rossen, I think I understand how the 
current spec is supposed to work.

For a bit of context, I’ll take as an example the layout of 
(non-multicol) floats with `width: auto`. By the time we get to a 
float’s layout, we know the size of its containing block. Then there are 
two sequential steps.

1. Determine the used width of this float. It is defined in §10.3.5 of 
CSS21 as:

shrink-to-fit = min(max(preferred minimum width, available width), 
preferred width)

The preferred and preferred minimum width are not defined in 2.1, but 
are in css3-sizing as min-content and max-content. These may be based on 
the min-content and max-content widths of some children, recursively.

2. Do the actual block container layout of the float’s content.

These are really separate and sequential. 1 needs to be finished before 
we can start 2.


Back to multicol. The current spec tries to define with the same 
pseudo-algorithm two completely different things:

A. What it calls `used-width = unknown`: the equivalent of 1 (if the 
multicol element is itself a float) or some other situation that 
requires min-content or max-content (eg. if the element has a table-cell 
ancestor.)
B. The equivalent of 2, the actual layout (when used-width is known.)

The facts are:

* We have have little interop on A:
http://lists.w3.org/Archives/Public/www-archive/2012Nov/att-0006/multicol-intrinsic.html
* css3-sizing has an algorithm for min-measure and max-measure. We can 
discuss the details of that algorithm, but it’s there.

I believe that:

* `used-width = unknown` is a really convoluted and non-obvious way to 
express this
* A and B are very different and should be defined separately
* The current spec does not do a great job at defining A
* css3-sizing together with CSS21 is enough to replace A


Therefore, my proposal is the same as it was presented to the group on 
Monday:

* Remove the concept of `used-width = unknown` and the parts of the 
pseudo-algorithm that use it
* used-width (previously available-width) is still defined as "the used 
width" determined by 10.3 of CSS 2.1
* Add something saying that the min-content/preferred minimum width and 
max-content/preferred width are undefined (like in CSS 2.1) but are 
expected to be defined in css3-sizing. (This is a non-normative reference.)


> I believe we can agree that:
>
>    [...]
>    - there should be a way to enter lines 06-07
>
> [...]
>
> Another way to phrase the above is that we'd like to preserve a way to
> set the exact number of columns and the exact width of columns,
> without making the element float (which seems arbitrary).

I believe this is a different issue that can be treated separately from 
the above. Yes, there was agreement on having some condition to trigger 
this behavior but it not being the default. This could be done in 
css3-sizing. For example:

If all of these hold:

* column-width is not auto
* column-count is not auto
* Either
   - float is not none (as current implementations do)
   - (Maybe) width is fit-content (consistent with float)
   - (Maybe) width is from-column (new keyword for this purpose)

Then the definition of both min-measure and max-measure change to:

(column-width + column-gap) * column-count - column-gap

(Note that none of these values allow percentages.)

-- 
Simon Sapin

Received on Friday, 2 November 2012 09:51:59 UTC