[webkit-gtk] GtkLauncher scrolling problem

Gustavo Noronha Silva gns at gnome.org
Wed May 25 08:14:46 PDT 2011


Hey,

On Tue, 2011-05-24 at 14:08 +0000, Brendan Taylor wrote:
> On Tue, May 24, 2011 at 11:57:56AM +0200, Maxime de Roucy wrote:
> > If I handle the signal and set the gtkscrolledwindow policy to
> > GTK_POLICY_NEVER. The scrollbar does appear but the window is
> > automatically resized by the webkit webview to fit the whole web page.
> > Which isn't what I want.
> > 
> > So : It seams it is now impossible to use webkit without a scrollbar.
> 
> We're experiencing this too, it's quite annoying. We first noticed it 
> when migrating to GTK3, but seems to occur on GTK2 as well in some 
> cases.

The problem is GtkScrolledWindow does not have a "make it scrollable but
do not draw scrollbars" mode, because it assumes the widget does not
scroll by itself - so when you set the policy to NEVER you are
essentially telling it to respect the widget's size request. GTK+ 2
widgets request as big a size as is required for the whole of the
contents to be shown, which in this case is the full size of the page
contents.

You can enforce a size on the widget by overriding the size request:

http://developer.gnome.org/gtk/stable/GtkWidget.html#GtkWidget-size-request

Or by setting the allocation explicitly when handling the size-allocate
signal:

http://developer.gnome.org/gtk/stable/GtkWidget.html#gtk-widget-set-allocation

This is not specific to WebKitGTK+, it's also how GtkTextView works. In
GTK+ 3 the sizing story has been improved a bit, so the "size request"
concept has been split in two: a natural size (which would be the same
as current's size-request) and a "minimum size", which would enforce a
size on non-scrolling containers. More info on size request/allocation
negotiation here:

http://developer.gnome.org/gtk/stable/GtkContainer.html

I asked if the problem was in a specific page because even after you've
done all of the above, some pages will still display scrollbars, like
gmail, because it uses tricks to make the contents be the size of the
browser's viewport and then uses html structures to create the
scrollable part.

Cheers,

-- 
Gustavo Noronha Silva <gns at gnome.org>
GNOME Project



More information about the webkit-gtk mailing list