W3C home > Mailing lists > Public > www-style@w3.org > September 2005

Re: [CSS21] Shrink-to-fit

From: Staffan Mhln <staffan.mahlen@comhem.se>
Date: Thu, 15 Sep 2005 14:41:29 +0200
Message-ID: <43296BF9.6000505@comhem.se>
To: "L. David Baron" <dbaron@dbaron.org>
CC: www-style@w3.org

L. David Baron wrote:
> On Friday 2005-09-02 18:06 +0200, Staffan Mhln wrote:
<snip/>
>> I don't have that many UAs installed, and 
>>since one of them cannot really be used to test this type of feature i 
>>only tried with two browsers.
> 
> It would be useful if you said which two.

Firefox 1.0.6 and Opera 8.02.

>>Essentially, what i (and i think some UAs) may be confused about is what 
>>the terms: "preferred minimum width" and "preferred width" actually 
>>refer to. The rec of course states:
>>"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"
> 
> I've written drafts of more detailed definitions, although they're only
> partial.  A slightly out-of-date version of my draft is
> http://groups.google.com/group/netscape.public.mozilla.layout/msg/0455a21b048ffac3

A very interesting read, thanks. This description seems to be more about 
how you calculate the values than how they are used though.

<snip/>

>><html>
> Presumably you meant to include an xmlns attribute here.

Thanks.

<snip/>
>>  <pre>
>>min(max(preferred minimum width, <b>0</b>), preferred width).</pre>
<snip/>
> 
> This test displays as you expect in trunk Firefox (both red and green
> boxes the width of their text).  I think Firefox 1.0.x had a bug with
> absolutely positioned elements that would make them narrower, though.
> 

Thats probably what i saw in Firefox, but Opera also does something like 
that in this example.

<snip/>
>>  <pre>
>>min(max(<b>400px?</b>, 200px), preferred width).</pre>
<snip/>
> 
> Firefox displays this as you expect (red and green boxes both 400px
> wide), although it took me quite a while to figure out what it was you
> expected.
> 

When i tested Firefox did not quite do that. Was there something in 
particular that made the example difficult (i did consider using 
'min-width', but thought that would be a bad idea)?

<snip/>
>>  <pre>
>>min(max(<b>width("**opportunity_to_see_how_wide_the_parent_gets.")</b>, 
>>500px),
>>    <b>width("this_text_shall_cause_a_single_line_break** 
>>**opportunity_to_see_how_wide_the_parent_gets."))</b>.</pre>

<snip/>
> 
> I think the question you're asking here is whether there should be a
> second pass after the min(max(,),) expression that shrinks things down
> to the largest actual line.  I believe IE does this and that Mozilla
> does this in some cases but not others, but that a bunch of other
> browsers (KHTML, at least) do not.  Not doing it has the advantages that
> it's easier to specify and that it's easier to do across different
> implementation designs for shrink-wrapping (in particular, whether or
> not to do shrink wrap width calculation by doing something a lot like
> layout, which I think is what IE does and what Mozilla currently does
> (although hopefully not for long)).
> 

Excellent, and thanks for the quick reply. This was what i was hoping 
for but since both Opera and Mozilla disagreed i was a bit concerned. I 
agree that the rec way is better really.

  /Staffan
Received on Thursday, 15 September 2005 12:41:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:40 GMT