Bug 44257 -- fix tabbing from URL bar to document. r=saari, sr=shaver.

This commit is contained in:
bryner%uiuc.edu 2001-03-28 02:08:06 +00:00
Родитель 7ed41a9893
Коммит 40d99f0540
1 изменённых файлов: 14 добавлений и 5 удалений

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

@ -71,6 +71,7 @@
#include "nsIPrincipal.h"
#include "nsPIDOMWindow.h"
#include "nsIDOMDocument.h"
// For reporting errors with the console service.
// These can go away if error reporting is propagated up past nsDocShell.
@ -1971,10 +1972,18 @@ NS_IMETHODIMP nsDocShell::GetMainWidget(nsIWidget** aMainWidget)
NS_IMETHODIMP nsDocShell::SetFocus()
{
nsCOMPtr<nsIWidget> mainWidget;
GetMainWidget(getter_AddRefs(mainWidget));
if(mainWidget)
mainWidget->SetFocus();
nsCOMPtr<nsIDOMDocument> domDoc;
mContentViewer->GetDOMDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
if (doc) {
nsCOMPtr<nsIScriptGlobalObject> sgo;
doc->GetScriptGlobalObject(getter_AddRefs(sgo));
if (sgo) {
nsCOMPtr<nsIDOMWindowInternal> domwin(do_QueryInterface(sgo));
if (domwin)
domwin->Focus();
}
}
return NS_OK;
}