W3C home > Mailing lists > Public > www-style@w3.org > January 2008

Re: scroll bar size in width calculations

From: Robert O'Callahan <robert@ocallahan.org>
Date: Tue, 8 Jan 2008 20:52:43 +1300
Message-ID: <11e306600801072352ndc24f36qc362a27c4ac0da8c@mail.gmail.com>
To: "Andrew Fedoniouk" <news@terrainformatica.com>
Cc: "Brad Kemper" <brkemper@comcast.net>, "Rossen Atanassov" <ratan@windows.microsoft.com>, fantasai <fantasai.lists@inkedblade.net>, "Alex Mogilevsky" <alexmog@exchange.microsoft.com>, "CSS Style" <www-style@w3.org>, "Sam Fortiner" <samfort@microsoft.com>, "Harel Williams" <harelw@microsoft.com>, "Scott Dickens" <sdickens@exchange.microsoft.com>, "Boris Zbarsky" <bzbarsky@mit.edu>
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 GMT

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