aboutsummaryrefslogtreecommitdiffstats
path: root/embed
diff options
context:
space:
mode:
authorXan Lopez <xan@gnome.org>2009-05-28 22:55:53 +0800
committerXan Lopez <xan@gnome.org>2009-05-28 23:40:33 +0800
commit5e83fc07ff785200e9dd5078ce903fb0b053e526 (patch)
treee370822b5aec8c5e720b59160bc23298cd328166 /embed
parent46fdef44c6e95fdaa841552a368d052b1164b983 (diff)
downloadgsoc2013-epiphany-5e83fc07ff785200e9dd5078ce903fb0b053e526.tar
gsoc2013-epiphany-5e83fc07ff785200e9dd5078ce903fb0b053e526.tar.gz
gsoc2013-epiphany-5e83fc07ff785200e9dd5078ce903fb0b053e526.tar.bz2
gsoc2013-epiphany-5e83fc07ff785200e9dd5078ce903fb0b053e526.tar.lz
gsoc2013-epiphany-5e83fc07ff785200e9dd5078ce903fb0b053e526.tar.xz
gsoc2013-epiphany-5e83fc07ff785200e9dd5078ce903fb0b053e526.tar.zst
gsoc2013-epiphany-5e83fc07ff785200e9dd5078ce903fb0b053e526.zip
Preserve back/forward history when opening links in new tabs/windows.
Bug #583459.
Diffstat (limited to 'embed')
-rw-r--r--embed/ephy-embed-utils.h1
-rw-r--r--embed/webkit/webkit-embed.c31
2 files changed, 32 insertions, 0 deletions
diff --git a/embed/ephy-embed-utils.h b/embed/ephy-embed-utils.h
index a5c64bb7d..e98860ed8 100644
--- a/embed/ephy-embed-utils.h
+++ b/embed/ephy-embed-utils.h
@@ -36,6 +36,7 @@
G_BEGIN_DECLS
#define EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED(embed) (WEBKIT_WEB_VIEW (gtk_bin_get_child (GTK_BIN (gtk_bin_get_child (GTK_BIN (embed))))))
+#define EPHY_WEBKIT_BACK_FORWARD_LIMIT 100
char * ephy_embed_utils_link_message_parse (char *message);
const char * ephy_embed_utils_get_title_composite (EphyEmbed *embed);
diff --git a/embed/webkit/webkit-embed.c b/embed/webkit/webkit-embed.c
index 481e51432..cb6e9dcb1 100644
--- a/embed/webkit/webkit-embed.c
+++ b/embed/webkit/webkit-embed.c
@@ -858,6 +858,37 @@ impl_shistory_copy (EphyEmbed *source,
gboolean copy_forward,
gboolean copy_current)
{
+ WebKitWebView *source_view, *dest_view;
+ WebKitWebBackForwardList* source_bflist, *dest_bflist;
+ WebKitWebHistoryItem *item;
+ GList *items;
+
+ source_view = WEBKIT_EMBED (source)->priv->web_view;
+ dest_view = WEBKIT_EMBED (dest)->priv->web_view;
+
+ source_bflist = webkit_web_view_get_back_forward_list (source_view);
+ dest_bflist = webkit_web_view_get_back_forward_list (dest_view);
+
+ if (copy_back) {
+ items = webkit_web_back_forward_list_get_back_list_with_limit (source_bflist, EPHY_WEBKIT_BACK_FORWARD_LIMIT);
+ /* We want to add the items in the reverse order here, so the
+ history ends up the same */
+ items = g_list_reverse (items);
+ for (; items; items = items->next) {
+ item = (WebKitWebHistoryItem*)items->data;
+ webkit_web_back_forward_list_add_item (dest_bflist, g_object_ref (item));
+ }
+ g_list_free (items);
+ }
+
+ /* The ephy/gecko behavior is to add the current item of the source
+ embed at the end of the back history, so keep doing that */
+ item = webkit_web_back_forward_list_get_current_item (source_bflist);
+ webkit_web_back_forward_list_add_item (dest_bflist, g_object_ref (item));
+
+ /* We ignore the 'copy_current' flag, it's unused in Epiphany */
+ /* We ignore the 'copy_forward' flag, ephy/gecko did nothing with it
+ either AFAICT*/
}
static void