<div dir="ltr">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.<div><br></div><div>This gist is the best we ended up coming up with</div><div><a href="https://gist.github.com/mattdangerw/df1c737acf403b8e7799">https://gist.github.com/mattdangerw/df1c737acf403b8e7799</a><br></div><div><br></div><div>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!</div><div><br></div><div>On a side note, does anyone know why getClientRects and getBoundingClientRect do not appear to be available through the gobject WebKitDOM API?</div><div><br></div><div>Thanks again,</div><div>Matt</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Sep 22, 2015 at 8:45 PM Robert Schroll <<a href="mailto:rschroll@gmail.com">rschroll@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Tue, Sep 22, 2015 at 5:02 PM, Matthew Watson <<a href="mailto:mattdangerw@gmail.com" target="_blank">mattdangerw@gmail.com</a>><br>
wrote:<br>
> Thanks! This looks like a WebKit1 solution right?<br>
<br>
Correct. I had assumed that it'd be easy to move to WebKit2, but I<br>
didn't know about this:<br>
<br>
> We were looking for a way to do this with WebKit2, which gets a lot<br>
> trickier because webkit handles all scrolling internally<br>
<br>
Bummer!<br>
<br>
Another approach that I toyed with in Geary was to increase the height<br>
of the webview until it required no scrolling. This could be put in a<br>
Gtk.Layout or similar, which would handle scrolling. Unfortunately,<br>
this fails if your HTML content ever decreases in height. I could find<br>
no way (short of polling) to find out when this happens and adjust the<br>
webview's size. Maybe this isn't a concern for you.<br>
<br>
Of course, you need to access the DOM to find the content height, and...<br>
<br>
> and you can't access the dom without registering a plugin inside the<br>
> WebProcess.<br>
<br>
This may not be quite as bad as you're imagining it, at least if you're<br>
developing new code. Michael Catanzaro and I put together a<br>
demonstration of communicating with a plugin in the web process over<br>
DBus [1]. But as you say, trying to synchronize scrolling between two<br>
processes is a scary proposition.<br>
<br>
Good luck,<br>
Robert<br>
<br>
[1] <a href="https://github.com/rschroll/webkitdom/tree/extension" rel="noreferrer" target="_blank">https://github.com/rschroll/webkitdom/tree/extension</a><br>
<br>
</blockquote></div>