[webkit-gtk] default scroll bars

Carlos Garcia Campos cgarcia at igalia.com
Wed Jul 13 23:49:55 PDT 2011


El Thu, 14 Jul 2011 04:38:20 +0000 (UTC)
biswa <biswaranjan.nitrkl at gmail.com> escribió:
> Gavin Lambert <gavinl at ...> writes:
> Hello,
> The displayed page I checked with is smaller than the widget and
> theres nothing to scroll on the page.However the scroll bars still
> appear. 
> 
> In webkit(not webkit2) the problem as was discussed previously in
> this forum is a bit different. There, if i create a scroll widget,
> then set the scroll policy to GTK_POLICY_NEVER and add a webview to
> the scroll widget, still the scroll bars appear. 

In WebKit1, WebKitWebView implements GtkScrollable and you are supposed
to use it inside a GtkScrolledWindow.

> For example, if the sample is as following
>            
>            window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
>            webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
>            scrolledWindow = gtk_scrolled_window_new(NULL, NULL);
>            gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledWindow), 
> GTK_POLICY_NEVER, GTK_POLICY_NEVER);
>            gtk_container_add(GTK_CONTAINER(scrolledWindow), 
> GTK_WIDGET(webView));
>            gtk_container_add(GTK_CONTAINER(window),
> GTK_WIDGET(scrolledWindow)); 
> and then if i load and display a webpage, the scroll bars still
> appear.
> 
>          However, if i change the code to something like this.
>   
>            window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
>            webView = WEBKIT_WEB_VIEW(webkit_web_view_new());
>            eventbox = gtk_event_box_new();
>            gtk_container_add(GTK_CONTAINER(eventbox),
> GTK_WIDGET(webView)); gtk_container_add(GTK_CONTAINER(window),
> GTK_WIDGET(eventbox));
> 
> and display a webpage, then no scroll bars appear.
> 
>      However if i use webkit2 API and write a similar sample as,
>            window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
>            webView = WKViewCreate(WKContextGetSharedProcessContext(),
> 0); eventbox = gtk_event_box_new();
>            gtk_container_add(GTK_CONTAINER(eventbox),
> GTK_WIDGET(webView)); gtk_container_add(GTK_CONTAINER(window),
> GTK_WIDGET(eventbox));

Why are you using a GtkEventBox?

> and load and display the same webpage as i did previously, the
> scroll bars still appear. :(. 
>     Can you provide me some information on this and on how(if i can)
> to disable the scroll bars when i use webkit2. 

When using the C API, WKView doesn't implement GtkScrollable, so it
shouldn't be used with a GtkScrolledWindow. In this case the view will
use WebKit internal scrollbars instead of the GTK ones like with any
other frame. 
When using the GTK+ API (not available yet) WebKitWebView will
implement GtkScrollable so that you will be able to use the view inside
a GtkScrolledWindow and use gtk_scrolled_window_set_policy().

Regards, 
-- 
Carlos Garcia Campos
http://pgp.rediris.es:11371/pks/lookup?op=get&search=0xF3D322D0EC4582C3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.webkit.org/pipermail/webkit-gtk/attachments/20110714/95e14ae6/attachment.bin>


More information about the webkit-gtk mailing list