diff options
author | Xan Lopez <xan@src.gnome.org> | 2008-07-01 05:27:22 +0800 |
---|---|---|
committer | Xan Lopez <xan@src.gnome.org> | 2008-07-01 05:27:22 +0800 |
commit | 9dc44b16830dfa9f1b82f6af82ff4578beb6bc36 (patch) | |
tree | 3ebe82b8db9b5f158a4f6d81cc69e9c498888db6 /embed/webkit | |
parent | 1e829eefa511c3463deddb7c3d99d4c27960e077 (diff) | |
download | gsoc2013-epiphany-9dc44b16830dfa9f1b82f6af82ff4578beb6bc36.tar gsoc2013-epiphany-9dc44b16830dfa9f1b82f6af82ff4578beb6bc36.tar.gz gsoc2013-epiphany-9dc44b16830dfa9f1b82f6af82ff4578beb6bc36.tar.bz2 gsoc2013-epiphany-9dc44b16830dfa9f1b82f6af82ff4578beb6bc36.tar.lz gsoc2013-epiphany-9dc44b16830dfa9f1b82f6af82ff4578beb6bc36.tar.xz gsoc2013-epiphany-9dc44b16830dfa9f1b82f6af82ff4578beb6bc36.tar.zst gsoc2013-epiphany-9dc44b16830dfa9f1b82f6af82ff4578beb6bc36.zip |
embed: restore restore_zoom_level.
svn path=/trunk/; revision=8328
Diffstat (limited to 'embed/webkit')
-rw-r--r-- | embed/webkit/webkit-embed.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/embed/webkit/webkit-embed.c b/embed/webkit/webkit-embed.c index ec9ceefb2..a4863ee21 100644 --- a/embed/webkit/webkit-embed.c +++ b/embed/webkit/webkit-embed.c @@ -59,6 +59,7 @@ struct WebKitEmbedPrivate WebKitEmbedLoadState load_state; char *loading_uri; EphyHistory *history; + guint is_setting_zoom : 1; }; static void @@ -156,6 +157,43 @@ update_load_state (WebKitEmbed *embed, WebKitWebView *web_view) } static void +restore_zoom_level (WebKitEmbed *embed, + const char *address) +{ + WebKitEmbedPrivate *priv = embed->priv; + + /* restore zoom level */ + if (ephy_embed_utils_address_has_web_scheme (address)) { + EphyHistory *history; + EphyNode *host; + WebKitWebView *web_view; + GValue value = { 0, }; + float zoom = 1.0, current_zoom; + + history = EPHY_HISTORY + (ephy_embed_shell_get_global_history (embed_shell)); + host = ephy_history_get_host (history, address); + + if (host != NULL && ephy_node_get_property + (host, EPHY_NODE_HOST_PROP_ZOOM, &value)) { + zoom = g_value_get_float (&value); + g_value_unset (&value); + } + + web_view = priv->web_view; + + g_object_get (G_OBJECT (web_view), "zoom-level", ¤t_zoom, + NULL); + + if (zoom != current_zoom) { + priv->is_setting_zoom = TRUE; + g_object_set (G_OBJECT (web_view), "zoom-level", zoom, NULL); + priv->is_setting_zoom = FALSE; + } + } +} + +static void webkit_embed_load_committed_cb (WebKitWebView *web_view, WebKitWebFrame *web_frame, EphyEmbed *embed) @@ -164,6 +202,7 @@ webkit_embed_load_committed_cb (WebKitWebView *web_view, ephy_base_embed_location_changed (EPHY_BASE_EMBED (embed), uri); + restore_zoom_level (WEBKIT_EMBED (embed), uri); ephy_history_add_page (WEBKIT_EMBED (embed)->priv->history, uri, FALSE, |