W3C home > Mailing lists > Public > www-style@w3.org > May 2010

Re: [css3-flex] calc(flex) and concept of free space.

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Sat, 29 May 2010 22:31:44 -0700
Message-ID: <AANLkTikj-2J-thAwcAxVAeojJXIDCqsBVWdkZVunF7BT@mail.gmail.com>
To: Andrew Fedoniouk <news@terrainformatica.com>
Cc: www-style@w3.org
On Sat, May 29, 2010 at 7:43 PM, Andrew Fedoniouk
<news@terrainformatica.com> wrote:
> First of all, Tab, don't get all this personally.
> You did and do a great job to make all this to happen.
>
> Simply consider my questions as coming from ordinary Web developer who get
> used to write things like <td width="70%" /><td width="30%" />
> and would expect flexes to be "percents made right".

Don't worry, I'm not.  ^_^  I just really, seriously don't understand
how you can arrive at the sort of understanding that you do here.


>>> So you say that here
>>>
>>>  A {  width: calc(100px + 10%); }
>>>
>>> 100px participates in min-content-width calculations, and
>>> here
>>>  B {  width: calc(100px + 10fx); }
>>>
>>> it is not?
>>
>> I have no idea what you are talking about here.
>>
>
> Say you have a container with horizontal block flow and overflow: auto and
> with these two children:
>
> <div flow:horizontal overflow: auto>
>  <A width:calc(100px + 1%)  />
>  <B width:calc(100px + 1fx)  />
> </div>
>
> Question: what is the minimal width of the div container that will trigger
> h-scrollbar
> to appear? In other words what is min-intrinsic width
> of its content?

A scrollbar will appear at 100px+1%.  That's the minimum width of all
the children.  Any larger than that, and B can shrink to fit.

(I might have a bug in my algorith.  Step 6.1.4 says to use the
preflex lengths (larger of minimum and preferred size) for all layout
that needs to be done before flexes are evaluated, but the
scrollbar-triggering width should be based on the minimum size of each
length.  I'm not sure if that's a problem or not.)


> The same question about this:
> <div flow:horizontal overflow: auto>
>  <A width:calc(100px + 0%)  />
>  <B width:calc(100px + 0fx)  />
> </div>

The scrollbar will appear at 200px.  Neither A nor B have flexible widths.


>>> Say here:
>>> B {  width: calc(100px + 0fx); }
>>> 100px is that "preferred" width? And so final width can take any value
>>> either less or over that 100px?
>>
>> That length is not flexible.
>
> That is what I suspected.
>
> So intrinsic width of this div
> <div>
>  <a  width: calc(100px + 0.0001fx) />
> </div>
>
> is  zero.

For the purpose of triggering a scrollbar, yeah.


> And intrinsic width of this one
>
> <div>
>  <a  width: calc(100px + 0fx) />
> </div>
>
> is 100px.
>
> Correct?

Yes.


> If "yes" then here:
>
> <div overflow:auto>
>  <a  width: calc(100px + 1px/100% * 1fx) />
> </div>
>
> all its width values except some in the middle
> will cause horizontal scrollbar to appear suddenly?
> So all this setup is dependent on bit capacity.
> Or did I miss something again?

Yes, there's a discontinuity close to 0.  Something with no
flexibility can't flex, and if you specify a flexibility very close to
0, you run the risk of an implementation rounding that off to 0.

That situation is definitely far off of normal author behavior, so I'm
not at all worried about it.

(For your example, small values won't cause a scrollbar either.  You
won't get a scrollbar unless/until 100% is large enough that 1px/100%
becomes too small for the impl to represent, and it rounds the number
off to 0.)

~TJ
Received on Sunday, 30 May 2010 05:32:36 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:27 GMT