From 44f512c44ba1ffd3338cc91fdd1580105e9deef1 Mon Sep 17 00:00:00 2001 From: "aaronl%netscape.com" Date: Thu, 6 Mar 2003 18:42:49 +0000 Subject: [PATCH] Bug 192454. Window is focused again if onclick='window.open' and href = '#foo'. r=bryner, sr=jst --- content/events/src/nsEventStateManager.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index f6d7ee8368c..9eea3060313 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -4620,9 +4620,8 @@ void nsEventStateManager::FocusElementButNotDocument(nsIContent *aContent) { // Focus an element in the current document, but don't switch document/window focus! - if (gLastFocusedDocument == mDocument || !gLastFocusedContent) { + if (gLastFocusedDocument == mDocument) { // If we're already focused in this document, - // or if there was no last focus // use normal focus method if (mCurrentFocus != aContent) { if (aContent) @@ -4633,6 +4632,10 @@ void nsEventStateManager::FocusElementButNotDocument(nsIContent *aContent) return; } + if (!gLastFocusedContent) { + return; + } + // The last focus wasn't in this document, so we may be getting our position from the selection // while the window focus is currently somewhere else such as the find dialog