Bug 92210 - Window steals focus if you switch to another app during "Transferring data from...". r=saari, sr=hyatt.

This commit is contained in:
bryner%netscape.com 2001-08-21 21:18:45 +00:00
Родитель 3e9c57d306
Коммит d1b47d9b27
4 изменённых файлов: 52 добавлений и 2 удалений

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

@ -961,6 +961,31 @@ nsresult nsDocShell::FindTarget(const PRUnichar *aWindowTarget,
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::GetEldestPresContext(nsIPresContext** aPresContext)
{
nsresult rv = NS_OK;
NS_ENSURE_ARG_POINTER(aPresContext);
*aPresContext = nsnull;
nsCOMPtr<nsIContentViewer> viewer = mContentViewer;
while (viewer) {
nsCOMPtr<nsIContentViewer> prevViewer;
viewer->GetPreviousViewer(getter_AddRefs(prevViewer));
if (prevViewer)
viewer = prevViewer;
else {
nsCOMPtr<nsIDocumentViewer> docv(do_QueryInterface(viewer));
if (docv)
rv = docv->GetPresContext(*aPresContext);
break;
}
}
return rv;
}
NS_IMETHODIMP
nsDocShell::GetPresContext(nsIPresContext ** aPresContext)
{
@ -999,6 +1024,24 @@ nsDocShell::GetPresShell(nsIPresShell ** aPresShell)
return rv;
}
NS_IMETHODIMP
nsDocShell::GetEldestPresShell(nsIPresShell** aPresShell)
{
nsresult rv = NS_OK;
NS_ENSURE_ARG_POINTER(aPresShell);
*aPresShell = nsnull;
nsCOMPtr<nsIPresContext> presContext;
(void) GetEldestPresContext(getter_AddRefs(presContext));
if (presContext) {
rv = presContext->GetShell(aPresShell);
}
return rv;
}
NS_IMETHODIMP
nsDocShell::GetContentViewer(nsIContentViewer ** aContentViewer)
{

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

@ -210,6 +210,7 @@ protected:
nsIStreamListener ** aContentHandler, nsIContentViewer ** aViewer);
NS_IMETHOD SetupNewViewer(nsIContentViewer * aNewViewer);
NS_IMETHOD GetEldestPresContext(nsIPresContext** aPresContext);
NS_IMETHOD CreateFixupURI(const PRUnichar * aStringURI, nsIURI ** aURI);
NS_IMETHOD GetCurrentDocumentOwner(nsISupports ** aOwner);
virtual nsresult DoURILoad(nsIURI * aURI,

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

@ -144,10 +144,16 @@ interface nsIDocShell : nsISupports
[noscript] readonly attribute nsIPresContext presContext;
/**
* Presentation context for the currently loaded document. This may be null.
* Presentation shell for the currently loaded document. This may be null.
*/
[noscript] readonly attribute nsIPresShell presShell;
/**
* Presentation shell for the oldest document, if this docshell is
* currently transitioning between documents.
*/
[noscript] readonly attribute nsIPresShell eldestPresShell;
/**
* Content Viewer that is currently loaded for this DocShell. This may
* change as the underlying content changes.

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

@ -1747,7 +1747,7 @@ NS_IMETHODIMP GlobalWindowImpl::Focus()
nsCOMPtr<nsIPresShell> presShell;
if (mDocShell) {
mDocShell->GetPresShell(getter_AddRefs(presShell));
mDocShell->GetEldestPresShell(getter_AddRefs(presShell));
}
nsresult result = NS_OK;