From 2da0f7fe474e2ce3e725692fb8e30aef1b852ae1 Mon Sep 17 00:00:00 2001 From: "bryner%brianryner.com" Date: Tue, 19 Jul 2005 18:02:55 +0000 Subject: [PATCH] Fix stuck focus ring when restoring a presentation by making sure to save the focus before we clear the focused content state. Bug 298077, r+sr=dbaron, a=brendan. git-svn-id: svn://10.0.0.236/trunk@176250 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 4ac4e27d8d7..40f3100d18f 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -5576,6 +5576,7 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer) PRBool styleDisabled; // |newMUDV| also serves as a flag to set the data from the above vars nsCOMPtr newMUDV; + PRBool savePresentation = mSavingOldViewer; if (mContentViewer || parent) { nsCOMPtr oldMUDV; @@ -5584,6 +5585,16 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer) // XXX: it would be far better to just reuse the document viewer , // since we know we're just displaying the same document as before oldMUDV = do_QueryInterface(mContentViewer); + + // Tell the old content viewer to hibernate in session history when + // it is destroyed. + + if (savePresentation && NS_FAILED(CaptureState())) { + if (mOSHE) { + mOSHE->SyncPresentationState(); + } + savePresentation = PR_FALSE; + } } else { // No old content viewer, so get state from parent's content viewer @@ -5707,17 +5718,6 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer) } } - // Tell the old content viewer to hibernate in session history when - // it is destroyed. - - PRBool savePresentation = mSavingOldViewer; - if (savePresentation && NS_FAILED(CaptureState())) { - if (mOSHE) { - mOSHE->SyncPresentationState(); - } - savePresentation = PR_FALSE; - } - mContentViewer->Close(savePresentation ? mOSHE.get() : nsnull); aNewViewer->SetPreviousViewer(mContentViewer);