[webkit-gtk] WebKit2 zoom API

Carlos Garcia Campos cgarcia at igalia.com
Tue Dec 27 02:45:50 PST 2011

I've started to think about the zoom API in WebKit2. 

In WebKit1 we have:
 - WebKitWebView:zoom-level property
 - webkit_web_view_zoom_in/out and webkit_web_view_set_zoom_level() to
modify zoom-level property
 - The zoom level affects only the text by default, in order to scale
the page contents we have to set WebKitWebView:full-content-zoom
property to TRUE, there's webkit_web_view_set_full_content_zoom() to do
it. I wonder why this is a property of WebView instead of a web setting.
 - There's also zoom-step web setting used by zoom_in/out.

In the WebKit2 C API we have methods to change both Text zoom level and
page zoom level: WKPageSetTextZoomFactor() and WKPageSetPageZoomFactor()

I've looked at how different apps use the current WK1 API:

 - epiphany:
  + Uses zoom-level property
  + Sets full-content-zoom unconditionally to TRUE
  + It implements zoom_in/out by its own without using zoom-level
property instead of zoom_in/out

 - midori:
  + Uses zoom-level property
  + Sets full-content-zoom depending on a custom web view setting
  + It implements zoom_in/out by its own without using zoom-level
property instead of zoom_in/out

 - devhelp:
  + Uses zoom-level property

 - yelp:
  + Doesn't use the webkit zoom API at all, it changes the font size.

 - liferea:
  + Uses webkit_web_view_set_zoom_level()
  + Uses default full-content-zoom on purpose:

 - sugar:
  + It seems to use only zoom_in/out. I'm not sure because it uses the
python bindings so it's more difficult to grep.

If you know more cases, feel free to add them.

 - Nobody seems to use zoom-step web setting
 - Only sugar seems to use zoom_in/out
 - Browsers seem to prefer scaling the page contents instead of text

Based on this, my proposal for WebKit2 is:
 - WebKitWebView:zoom-level property
 - webkit_web_view_set_zoom_level() and webkit_web_view_get_zoom_level()
 - WebKitSettings:zoom-text-only set to FALSE by default
 - I'm not sure about zoom_in/out, we would need to know why people
don't use them, and then try to add API adapted to users needs, or just
don't add them and let users implement it by their own.

Carlos Garcia Campos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.webkit.org/pipermail/webkit-gtk/attachments/20111227/00c0f9e8/attachment.bin>

More information about the webkit-gtk mailing list