Bug 323805, tab switching not working when for non-html and non-xul elements are focused, r=neil,sr=bz

This commit is contained in:
enndeakin%sympatico.ca 2007-08-22 05:06:08 +00:00
Родитель a9f2dcab3e
Коммит 565ae7a264
1 изменённых файлов: 19 добавлений и 2 удалений

Просмотреть файл

@ -695,7 +695,15 @@
// Clear focus outline before we draw on top of it.
// Only blur the focused element if it isn't a tab,
// to avoid breaking keyboard tab navigation
this.mCurrentBrowser.focusedElement.blur();
var elem = this.mCurrentBrowser.focusedElement;
if (elem instanceof HTMLElement || elem instanceof XULElement) {
elem.blur();
}
else {
var content = elem.ownerDocument.defaultView;
if (content instanceof Components.interfaces.nsIInterfaceRequestor)
content.getInterface(Components.interfaces.nsIDOMWindowUtils).focus(null);
}
}
this.mCurrentBrowser.setAttribute("type", "content-targetable");
}
@ -801,7 +809,16 @@
.getService(Components.interfaces.nsIWindowWatcher);
if (ww.activeWindow == window) {
cmdDispatcher.suppressFocusScroll = true;
whatToFocus.focus();
if (whatToFocus instanceof HTMLElement ||
whatToFocus instanceof XULElement ||
whatToFocus instanceof Window) {
whatToFocus.focus();
}
else if (whatToFocus instanceof Node) {
var content = window.content;
if (content instanceof Components.interfaces.nsIInterfaceRequestor)
content.getInterface(Components.interfaces.nsIDOMWindowUtils).focus(whatToFocus);
}
cmdDispatcher.suppressFocusScroll = false;
}
else {