tag 486744 + patch thanks On Sun, Sep 28, 2008 at 02:52:19PM +0200, Mike Hommey wrote: > reassign 486744 epiphany-gecko > thanks > > See https://bugzilla.mozilla.org/show_bug.cgi?id=444894#c19
I tried two approaches, one looking much better than the other. The first patch (the longest one) solves the crash, while apparently keeping epiphany's zoom behaviour of keeping zoom level on a website, but changing the zoom level back to 1.0 when going to a new website. The second patch (the one-liner) solves the crash too, but has odd behaviour wrt zoom level when going back/forward in history: it keeps the current zoom level when going on a new website, but will reset to 1.0 when hitting the back and forward buttons. The first patch sounds like the right fix, though I don't know what weird side effects could show up. Mike
--- epiphany-browser-2.22.3.orig/embed/mozilla/EphyBrowser.h +++ epiphany-browser-2.22.3/embed/mozilla/EphyBrowser.h @@ -208,6 +208,7 @@ nsCOMPtr<nsIWebBrowser> mWebBrowser; private: GtkWidget *mEmbed; + float mZoom; nsCOMPtr<nsIWebBrowserFocus> mWebBrowserFocus; nsCOMPtr<nsIDOMDocument> mTargetDocument; --- epiphany-browser-2.22.3.orig/embed/mozilla/EphyBrowser.cpp +++ epiphany-browser-2.22.3/embed/mozilla/EphyBrowser.cpp @@ -830,6 +830,7 @@ #endif , mContextMenuListener(nsnull) , mInitialized(PR_FALSE) +, mZoom(0.0) { LOG ("EphyBrowser ctor (%p)", this); } @@ -1192,7 +1193,9 @@ nsCOMPtr<nsIMarkupDocumentViewer> mdv = do_QueryInterface(contentViewer); NS_ENSURE_TRUE (mdv, NS_ERROR_FAILURE); - return mdv->SetTextZoom (aZoom); + nsresult rv = mdv->SetTextZoom (aZoom); + mZoom = aZoom; + return rv; } nsresult EphyBrowser::GetContentViewer (nsIContentViewer **aViewer) @@ -1207,6 +1210,10 @@ nsresult EphyBrowser::GetZoom (float *aZoom) { + if (mZoom != 0) { + *aZoom = mZoom; + return NS_OK; + } NS_ENSURE_TRUE (mWebBrowser, NS_ERROR_FAILURE); nsCOMPtr<nsIContentViewer> contentViewer; @@ -1216,7 +1223,9 @@ nsCOMPtr<nsIMarkupDocumentViewer> mdv = do_QueryInterface(contentViewer); NS_ENSURE_TRUE (mdv, NS_ERROR_FAILURE); - return mdv->GetTextZoom (aZoom); + nsresult rv = mdv->GetTextZoom (aZoom); + mZoom = *aZoom; + return rv; } nsresult
--- epiphany-browser-2.22.3.orig/embed/mozilla/mozilla-embed.cpp +++ epiphany-browser-2.22.3/embed/mozilla/mozilla-embed.cpp @@ -1001,7 +1001,6 @@ char *address; address = gtk_moz_embed_get_location (moz_embed); ephy_base_embed_popups_manager_reset (EPHY_BASE_EMBED (membed)); - ephy_base_embed_restore_zoom_level (EPHY_BASE_EMBED (membed), address); g_free (address); } }