[webkit-gtk] Resizing issue
eric at yorba.org
Fri Dec 23 11:09:04 PST 2011
On Dec 23, 2011, at 7:49 AM, Martin Robinson wrote:
> On Tue, Dec 20, 2011 at 3:17 PM, Eric Gregory <eric at yorba.org> wrote:
>> Problem is, when I stretch out the window, the WebViews expand their height,
>> but don't shrink when the content no longer needs the height. In other
>> words, if you make the window really narrow horizontally and then make it
>> wide, the WebViews have a lot of unnecessary whitespace at the bottom.
> The issue here is that the WebKitWebView always asks for enough size
> to display its contents. When you expand the widget the content size
> gets bigger so it asks for more space. You have a couple options here.
> You can either pack the WebView into a GtkScrolledWindow or subclass
> it and override the get_preferred_height and get_preferred_width
> methods (or size-request if you are using GTK+ 2.x).
Thanks for the response, Martin!
Putting the WebView in a GtkScrolledWindow isn't an option for me, since I have several WebView objects that need to scroll together (the WebViews represent emails in a new email app.)
So that leaves us with the second option. I tried subclassing WebView and setting it to "height-for-width" mode and overriding those methods. But the problem is that I don't know the height needed to display the WebView. If I don't specify one, it just keeps getting taller and taller as I stretch the window from left to right and back!
The only idea I had was to ask WebWindowFeatures for the height, but that kept returning zero.
Any idea how to solve this?
More information about the webkit-gtk