Bug #95940. Make sure that the embed reload flags are in sync for the widget and the nsIWebNavigation interfaces in a backwards compatible way. r=valeski,sr=shaver, a=asa

This commit is contained in:
blizzard%redhat.com 2001-08-31 22:47:02 +00:00
parent 6e56d084cb
commit 91a062439b
3 changed files with 39 additions and 3 deletions

View File

@ -161,14 +161,17 @@ typedef enum
GTK_MOZ_EMBED_STATUS_FAILED_USERCANCELED = 2152398850U
} GtkMozEmbedStatusFlags;
/* These are straight out of nsIWebNavigation.h */
/* These used to be straight out of nsIWebNavigation.h until the API
changed. Now there's a mapping table that maps these values to the
internal values. */
typedef enum
{
GTK_MOZ_EMBED_FLAG_RELOADNORMAL = 0,
GTK_MOZ_EMBED_FLAG_RELOADBYPASSCACHE = 1,
GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXY = 2,
GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXYANDCACHE = 3
GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXYANDCACHE = 3,
GTK_MOZ_EMBED_FLAG_RELOADCHARSETCHANGE = 4
} GtkMozEmbedReloadFlags;
/* These are straight out of nsIWebBrowserChrome.h */

View File

@ -86,6 +86,8 @@ static GtkFlagValue gtk_moz_embed_reload_flags_values[] = {
{ GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXYANDCACHE,
"GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXYANDCACHE",
"reloadbypassproxyandcache" },
{ GTK_MOZ_EMBED_FLAG_RELOADCHARSETCHANGE,
"GTK_MOZ_EMBED_FLAG_RELOADCHARSETCHANGE", "reloadcharset" },
{ 0,
NULL, NULL }
};
@ -947,8 +949,33 @@ gtk_moz_embed_reload(GtkMozEmbed *embed, gint32 flags)
embedPrivate = (EmbedPrivate *)embed->data;
PRUint32 reloadFlags = 0;
// map the external API to the internal web navigation API.
switch (flags) {
case GTK_MOZ_EMBED_FLAG_RELOADNORMAL:
reloadFlags = 0;
break;
case GTK_MOZ_EMBED_FLAG_RELOADBYPASSCACHE:
reloadFlags = nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE;
break;
case GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXY:
reloadFlags = nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY;
break;
case GTK_MOZ_EMBED_FLAG_RELOADBYPASSPROXYANDCACHE:
reloadFlags = (nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY |
nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE);
break;
case GTK_MOZ_EMBED_FLAG_RELOADCHARSETCHANGE:
reloadFlags = nsIWebNavigation::LOAD_FLAGS_CHARSET_CHANGE;
break;
default:
reloadFlags = 0;
break;
}
if (embedPrivate->mNavigation)
embedPrivate->mNavigation->Reload(flags);
embedPrivate->mNavigation->Reload(reloadFlags);
}
void

View File

@ -537,7 +537,13 @@ void
reload_clicked_cb (GtkButton *button, TestGtkBrowser *browser)
{
g_print("reload_clicked_cb\n");
GdkModifierType state = (GdkModifierType)0;
gint x, y;
gdk_window_get_pointer(NULL, &x, &y, &state);
gtk_moz_embed_reload(GTK_MOZ_EMBED(browser->mozEmbed),
(state & GDK_SHIFT_MASK) ?
GTK_MOZ_EMBED_FLAG_RELOADBYPASSCACHE :
GTK_MOZ_EMBED_FLAG_RELOADNORMAL);
}