[webkit-gtk] default scroll bars

biswa biswaranjan.nitrkl at gmail.com
Wed Jul 13 21:38:20 PDT 2011


Gavin Lambert <gavinl at ...> writes:

> 
> Quoth biswa:
> > I am trying to display a webpage using webkit2 API.
> >  i created a gtk top level window and
> > added a webview to it.
> > I see that when the webpage is displayed,
> > scroll bars are provided by default.
> > Is there some way to disable those scroll bars.
> 
> Is the displayed page larger than the widget?  If so, I don't think the
> widget lets you disable the scrollbars -- you have to change the page itself
> to either make the content smaller or disable overflow via CSS.
> 
> If it's displaying scrollbars even with blank or small content, then you
> should be able to fix that at the widget level.
> 

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. 

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));

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. 



More information about the webkit-gtk mailing list