The process separation in WebKit2 has some advantages, but it also makes many things more complex. I believe scrolling is one of those things: it happens in the web process because scrollbars are now handled by webkit, and not the Gtk widget. The same should hold for touch handling: it is partly done in the web process. Carlos Garcia Campos has written a blog post about using WebKitWebExtension to help in this. Note that the design has lots of implications on your code as well: Part of the code will be running in a totally different process.
The rest of the answer is not tested, please consider this more like an educated guess:
I believe the way to control scrolling is through the DOM API, more specifically DOMDOMWindow.scroll*
functions. The complex part is getting a reference to the DOMDOMWindow
-- You'll need to implement a WebExtension
which will be running in the web process and will allow you to get notified when a WebPage
is created. The WebPage.get_dom_document()
call gives you a DOMDocument
and DOMDocument.get_default_view()
should then give you the DOMDOMWindow
you need.
For the DOM API documentation, Mozilla is probably a better reference than the spartan WebKit-GTK-DOM documentation.
If I was doing what you are trying to do, my first stop would be the #webkitgtk+ IRC channel on Freenode to check if the above really is a sane way to do what you want...