Re: Advanced Floats

David Woolley wrote:
> 
> Brad Kemper wrote:
> 
>>
>> Are iterative balancing algorithms difficult to write? Or do they slow 
>> the browser to a crawl or something? 
> 
> They imply that the page cannot be incrementally rendered, which is 
> considered an undesirable, although not forbidden, characteristic for 
> new CSS features.

I am not sure of what is that "iterative balancing algorithm" here,
and why it cannot be incrementally rendered but I would like you to 
consider algorithm that I use for flex length units computation:

Consider this markup:

<root>
   <header />
   <body height=*>....</body>
   <footer />
</root>

This markup/styling means:
<header> - on the top of root
<footer> - on the bottom of root as:
<body> - takes rest that left from <header> and <footer> in the <root> 
or it gets intrinsic height if there is no free space left in
the <root>.

Computation is simple:

Phase 1: Do layout as if all flex values defined as having 0 value.
          (standard layout algorithm)
Phase 2: If height of content inside the <root> is less than
          its height (so we get free space to distribute) do
          "shrink-to-fit" balancing.

This algorithm works as good for incremental rendering as
a standard layout algorithm.

Phase 2 ("shrink-to-fit" phase) is in effect only
when measured size of delivered content is less than
the view. At the moment when content of the document
exceeds view height then it stops shrinking.

> 
> They are also a cost every time the window is resized.
> 

Yes it is additional pass (phase 2) but a) it is
conditional and b) all modern UAs already have effective algorithms
in place for such balancing.

Load this page in your favorite UA:

    http://blocknote.net/404.htm

as you may see it does "shrink-to-fit" pretty effectively.

-- 
Andrew Fedoniouk.

http://terrainformatica.com

Received on Sunday, 6 January 2008 20:04:50 UTC