From 784f48c63df7aeda7ebc7834e7593f2a5c66c079 Mon Sep 17 00:00:00 2001 From: "nisheeth%netscape.com" Date: Thu, 8 Jul 1999 01:40:50 +0000 Subject: [PATCH] Fix for bug 9358. Page reloads were not working because the webshell was trying to scroll the document rather than loading it via netlib. Now, we are fine. Some work needs to happen in session history to pass in a newly define url reload type so that the webshell can be smart about scrolling the document for history traversal rather than loading via netlib. Will work with Radha to make the necessary session history changes. git-svn-id: svn://10.0.0.236/trunk@38761 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsWebShell.cpp | 20 +++++++++----------- mozilla/webshell/src/nsWebShell.cpp | 20 +++++++++----------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index fa6b6005ecf..c440490ef07 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -1827,7 +1827,7 @@ nsWebShell::DoLoadURL(const nsString& aUrlSpec, #ifdef NECKO if ((aType == nsIChannel::LOAD_NORMAL) && (nsnull != mContentViewer)) #else - if ((aType == nsURLReload) && (nsnull != mContentViewer)) + if ((aType == nsURLReload || aType == nsURLReloadFromHistory) && (nsnull != mContentViewer)) #endif { nsCOMPtr docViewer; @@ -1860,9 +1860,8 @@ nsWebShell::DoLoadURL(const nsString& aUrlSpec, if (NS_FAILED(rv)) return rv; #endif // NECKO - if (EqualBaseURLs(docURL, url)) - { - // See if there's a destination anchor + if (EqualBaseURLs(docURL, url)) { + // See if there's a destination anchor #ifdef NECKO char* ref = nsnull; nsCOMPtr url2 = do_QueryInterface(url); @@ -1879,23 +1878,22 @@ nsWebShell::DoLoadURL(const nsString& aUrlSpec, if (NS_SUCCEEDED(rv) && presShell) { if (nsnull != ref) { // Go to the anchor in the current document - presShell->GoToAnchor(nsAutoString(ref)); + rv = presShell->GoToAnchor(nsAutoString(ref)); + return rv; } - else { + else if (aType == nsURLReloadFromHistory) { // Go to the top of the current document nsCOMPtr viewMgr; rv = presShell->GetViewManager(getter_AddRefs(viewMgr)); if (NS_SUCCEEDED(rv) && viewMgr) { nsIScrollableView* view; rv = viewMgr->GetRootScrollableView(&view); - if (NS_SUCCEEDED(rv) && view) { - view->ScrollTo(0, 0, NS_VMREFRESH_IMMEDIATE); - } + if (NS_SUCCEEDED(rv) && view) + rv = view->ScrollTo(0, 0, NS_VMREFRESH_IMMEDIATE); } + return rv; } } - - return NS_OK; } // EqualBaseURLs(docURL, url) } } diff --git a/mozilla/webshell/src/nsWebShell.cpp b/mozilla/webshell/src/nsWebShell.cpp index fa6b6005ecf..c440490ef07 100644 --- a/mozilla/webshell/src/nsWebShell.cpp +++ b/mozilla/webshell/src/nsWebShell.cpp @@ -1827,7 +1827,7 @@ nsWebShell::DoLoadURL(const nsString& aUrlSpec, #ifdef NECKO if ((aType == nsIChannel::LOAD_NORMAL) && (nsnull != mContentViewer)) #else - if ((aType == nsURLReload) && (nsnull != mContentViewer)) + if ((aType == nsURLReload || aType == nsURLReloadFromHistory) && (nsnull != mContentViewer)) #endif { nsCOMPtr docViewer; @@ -1860,9 +1860,8 @@ nsWebShell::DoLoadURL(const nsString& aUrlSpec, if (NS_FAILED(rv)) return rv; #endif // NECKO - if (EqualBaseURLs(docURL, url)) - { - // See if there's a destination anchor + if (EqualBaseURLs(docURL, url)) { + // See if there's a destination anchor #ifdef NECKO char* ref = nsnull; nsCOMPtr url2 = do_QueryInterface(url); @@ -1879,23 +1878,22 @@ nsWebShell::DoLoadURL(const nsString& aUrlSpec, if (NS_SUCCEEDED(rv) && presShell) { if (nsnull != ref) { // Go to the anchor in the current document - presShell->GoToAnchor(nsAutoString(ref)); + rv = presShell->GoToAnchor(nsAutoString(ref)); + return rv; } - else { + else if (aType == nsURLReloadFromHistory) { // Go to the top of the current document nsCOMPtr viewMgr; rv = presShell->GetViewManager(getter_AddRefs(viewMgr)); if (NS_SUCCEEDED(rv) && viewMgr) { nsIScrollableView* view; rv = viewMgr->GetRootScrollableView(&view); - if (NS_SUCCEEDED(rv) && view) { - view->ScrollTo(0, 0, NS_VMREFRESH_IMMEDIATE); - } + if (NS_SUCCEEDED(rv) && view) + rv = view->ScrollTo(0, 0, NS_VMREFRESH_IMMEDIATE); } + return rv; } } - - return NS_OK; } // EqualBaseURLs(docURL, url) } }