Re: [css3-regions] Feedback on regions document

On May 12, 2011, at 9:38 PM, Vincent Hardy wrote:

> We actually thought about this, and we tried to express it in the spec., but it is done a bit indirectly (in the section about how flow breaking rules (2.3). A container block that does not have a width/height set would behave like any normal container block that flows its normal content. In other words, it would possibly consume all the flow because it would not ever overflow.
>> 
>> So if we had the "article_flow" flow through region A and region B, and region A did not have a width/height set, then it would be able to fit all the boxes in the flow and content would never reach region be. It would behave as if we had had:
>> 
>> <div id="region_A">
>>       <div id="article">..</div>
>> </div>
>> 
>> Does that answer your question?
> 

No, I'm talking about layout systems that rely on the concept of intrinsic preferred width (both a minimum width where you break everything and a maximum where you break nothing).

Here's a simple example:

<div style="position:absolute;border:2px solid red">I am only wide enough to fit this text on one line.</div>

If you display that in a Web browser, you'll see that the text is all on one line, and the border snugly fits the text.  The positioned element used its maximum intrinsic width in this case.

If that div becomes a region, how do you know how wide it is going to be? Let's go further and even say it is the first region in a chain of regions for a given flow and its height is set at 100px.  How do we know how wide it's going to be?  Hint: the answer can't be "let's flow into that height to see what fits and then size to the width of the contents."  Layout engines just don't work that way.   They determine the width first and then lay out contents to determine the height, not the other way around.  You can't reverse that, especially not for the table algorithm.

Intrinsic widths are also (in some engines at least) designed to be computable with a simplified algorithm (I think CSS3 was planning to define this?), without having to do a full-blown layout,.

My suggestion therefore is to use an intrinsic width of 0 for the content and/or to use all of the content.  I think the former is simpler.

In practice authors are going to have to specify height or max-height to prevent a region from just consuming all of the content anyway, so it doesn't seem like a big deal that they would also specify a min-width or width in the case of layout systems that use intrinsic widths.

dave
(hyatt@apple.com)

Received on Friday, 13 May 2011 16:12:20 UTC