Re: scroll bar size in width calculations

On Jan 8, 2008 8:39 PM, Andrew Fedoniouk <news@terrainformatica.com> wrote:

> Height of HTML document by its nature is a function from its width.
>   height = F( width )
> When this height exceeds height of the view then v-scrollbar appears
> that is effectively changes 'width' in the equation above so you have
> second dependency:
>   width = B( height )
>
> System of these two equitations is a classical "positive feedback"
> condition. Solution of such a system may "hunt" or oscillate at some
> input values (e.g. when intrinsic dimensions of the content is close to
> the size of the view). More on this: Nyquist criterion [1] and around.
>

It's not that bad because there are only 4 possible solutions to the
scrollbar problem: show/hide vertical scrollbar x show/hide horizontal
scrollbar. In the worst case you can check each of these solutions to see
which ones are feasible, where "feasible" means that each scrollbar is
showing if and only if it is needed. If multiple solutions are feasible,
then you pick one using whatever heuristic you like. Our heuristics are
basically, in order of priority,
1) prefer to show no scrollbars
2) prefer to preserve the current vertical scrollbar visibility (this is for
performance, showing/hiding the vertical scrollbar changes the available
width of the contents, so it's expensive)
3) prefer to hide the horizontal scrollbar (showing/hiding the horizontal
scrollbar is cheap)

If no solutions are feasible then we show whatever scrollbars we're allowed
to, so at least the user can scroll to see all the content.

http://mxr.mozilla.org/seamonkey/source/layout/generic/nsGfxScrollFrame.cpp#606
if you're interested :-).

Rob
-- 
"He was pierced for our transgressions, he was crushed for our iniquities;
the punishment that brought us peace was upon him, and by his wounds we are
healed. We all, like sheep, have gone astray, each of us has turned to his
own way; and the LORD has laid on him the iniquity of us all." [Isaiah
53:5-6]

Received on Tuesday, 8 January 2008 07:52:48 UTC