Fix (again) setting of focused window/element on focus controller. This ensures that we do the right thing when given either an element or a window to focus. Bug 89214, r=neil, sr=jag.

This commit is contained in:
bryner%netscape.com 2003-06-12 01:08:21 +00:00
parent 9abcc83528
commit e78f794d7c

View File

@ -675,9 +675,13 @@ function WindowFocusTimerCallback(element)
// set the element in command dispatcher so focus will restore properly
// when the window does become active
document.commandDispatcher.focusedWindow = window;
if (element instanceof Components.interfaces.nsIDOMElement)
if (element instanceof Components.interfaces.nsIDOMWindow) {
document.commandDispatcher.focusedWindow = element;
document.commandDispatcher.focusedElement = null;
} else if (element instanceof Components.interfaces.nsIDOMElement) {
document.commandDispatcher.focusedWindow = element.ownerDocument.defaultView;
document.commandDispatcher.focusedElement = element;
}
}
}