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

--------------------------------------------------
From: "Tab Atkins Jr." <jackalmage@gmail.com>
Sent: Saturday, May 29, 2010 10:31 PM
To: "Andrew Fedoniouk" <news@terrainformatica.com>
Cc: <www-style@w3.org>
Subject: Re: [css3-flex] calc(flex) and concept of free space.

> On Sat, May 29, 2010 at 7:43 PM, Andrew Fedoniouk
> <news@terrainformatica.com> wrote:
 
>> 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.)
> 

So you are saying that this expression: 

width: calc(100px + 1px/100% * 1fx)

may or may not participate in free space
calculations. 

If  1px/100% is close to zero the 
expression will be calculated to "fixed 100px" 
and to be extracted from available free space. 
In all other cases it calculates to zero (for the 
need of free space calculation)

This means that layout calculation is using 
unstable algorithm by design - 
mathematically speaking it has singular points 
on some widths. 

This will not fly, sorry.

To make your idea viable in CSS you have two 
options:

1) Either to consider that calc() expression that 
has any mentioning of fx units in no circumstances 
is participating in free space amount calculations.
So while calculating free space (first pass) this
   width: calc(100px + 0fx)
is computed to zero. Just to avoid singularity around
special points.

or 2) flex units cannot participate in calc() expressions
at all. To be able to define additive flexes there is a 
need of either special flex-calc() function or 
flex(preferred-length, flex-weight) function.

In fact #1 is also about flex-calc() function - 
Existence of flex unit in expression implicitly turns "plain calc()"
to "flex calc()".

I hope I put all this clear enough.

-- 
Andrew Fedoniouk

http://terrainformatica.com




















 

Received on Sunday, 30 May 2010 17:06:57 UTC