[webkit-gtk] Gtk and html content in the same scroll view

Matthew Watson mattdangerw at gmail.com
Fri Oct 2 18:30:23 PDT 2015

We also tried increasing the webview height so it would not need a scroll,
but some of our article content is really big. And trying to make a webview
with 30,000+ pixels in height was causing some fun X errors.

This gist is the best we ended up coming up with

This registers a webkit plugin to spy on a divs dimensions, and signals the
UI process through dbus. It performs pretty well for scrolling, with only
occasional slippage. Re-sizing is another story and the gtk widget
obviously lags behind the web content. Especially when the web content
reflows on the page. If anyone has ideas there, we are all ears!

On a side note, does anyone know why getClientRects and
getBoundingClientRect do not appear to be available through the gobject

Thanks again,

On Tue, Sep 22, 2015 at 8:45 PM Robert Schroll <rschroll at gmail.com> wrote:

> On Tue, Sep 22, 2015 at 5:02 PM, Matthew Watson <mattdangerw at gmail.com>
> wrote:
> > Thanks! This looks like a WebKit1 solution right?
> Correct.  I had assumed that it'd be easy to move to WebKit2, but I
> didn't know about this:
> > We were looking for a way to do this with WebKit2, which gets a lot
> > trickier because webkit handles all scrolling internally
> Bummer!
> Another approach that I toyed with in Geary was to increase the height
> of the webview until it required no scrolling.  This could be put in a
> Gtk.Layout or similar, which would handle scrolling.  Unfortunately,
> this fails if your HTML content ever decreases in height.  I could find
> no way (short of polling) to find out when this happens and adjust the
> webview's size.  Maybe this isn't a concern for you.
> Of course, you need to access the DOM to find the content height, and...
> > and you can't access the dom without registering a plugin inside the
> > WebProcess.
> This may not be quite as bad as you're imagining it, at least if you're
> developing new code.  Michael Catanzaro and I put together a
> demonstration of communicating with a plugin in the web process over
> DBus [1].  But as you say, trying to synchronize scrolling between two
> processes is a scary proposition.
> Good luck,
> Robert
> [1] https://github.com/rschroll/webkitdom/tree/extension
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-gtk/attachments/20151003/de43b401/attachment.html>

More information about the webkit-gtk mailing list