From d91c1d95c0bf343a8fefebed66aaa4ac6dcb210e Mon Sep 17 00:00:00 2001 From: "aaronleventhal%moonset.net" Date: Sat, 5 Feb 2005 17:00:46 +0000 Subject: [PATCH] Backing out fix for bug 249136 because it caused bug 279285 --- layout/base/nsPresShell.cpp | 46 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 5ca320fa4e5..479bc2ea017 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -5515,38 +5515,36 @@ nsresult PresShell::RetargetEventToParent(nsIView *aView, PRBool& aHandled, nsIContent* aZombieFocusedContent) { - // Send this event straight up to the parent pres shell. + // Send this events straight up to the parent pres shell. // We do this for non-mouse events in zombie documents. // That way at least the UI key bindings can work. + // First, eliminate the focus ring in the current docshell, which + // is now a zombie. If we key navigate, it won't be within this + // docshell, until the newly loading document is displayed. + nsCOMPtr kungFuDeathGrip(this); // hold a reference to the ESM across event dispatch nsCOMPtr esm = mPresContext->EventStateManager(); + + esm->SetContentState(nsnull, NS_EVENT_STATE_FOCUS); + esm->SetFocusedContent(nsnull); + ContentStatesChanged(mDocument, aZombieFocusedContent, + nsnull, NS_EVENT_STATE_FOCUS); + + // Next, update the display so the old focus ring is no longer visible + nsCOMPtr container = mPresContext->GetContainer(); - if (aZombieFocusedContent) { - // If sub-content within current document is focused, - // eliminate the focus ring, because the current docshell - // is now a zombie. If we key navigate, it won't be within this - // docshell, until the newly loading document is displayed. - // Note: if document itself has focus, leave the focus alone so that - // we don't mess up the "open link in new foreground tab" feature -- - // there is no focus outline in that case anyway. - esm->SetContentState(nsnull, NS_EVENT_STATE_FOCUS); - esm->SetFocusedContent(nsnull); - ContentStatesChanged(mDocument, aZombieFocusedContent, - nsnull, NS_EVENT_STATE_FOCUS); - // Update the display so the old focus ring is no longer visible - nsCOMPtr docShell(do_QueryInterface(container)); - NS_ASSERTION(docShell, "No docshell for container."); - nsCOMPtr contentViewer; - docShell->GetContentViewer(getter_AddRefs(contentViewer)); - if (contentViewer) { - nsCOMPtr zombieViewer; - contentViewer->GetPreviousViewer(getter_AddRefs(zombieViewer)); - if (zombieViewer) { - zombieViewer->Show(); - } + nsCOMPtr docShell(do_QueryInterface(container)); + NS_ASSERTION(docShell, "No docshell for container."); + nsCOMPtr contentViewer; + docShell->GetContentViewer(getter_AddRefs(contentViewer)); + if (contentViewer) { + nsCOMPtr zombieViewer; + contentViewer->GetPreviousViewer(getter_AddRefs(zombieViewer)); + if (zombieViewer) { + zombieViewer->Show(); } }