mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1134891 - Make the print progress dialog for Windows and Linux be opened by the browser window's nsIDOMWindow instead of the content window. r=smaug.
This commit is contained in:
parent
4f50fb6782
commit
1e1d367d71
@ -6,10 +6,16 @@
|
||||
#include "nsPrintProgress.h"
|
||||
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIXULWindow.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
|
||||
NS_IMPL_ADDREF(nsPrintProgress)
|
||||
NS_IMPL_RELEASE(nsPrintProgress)
|
||||
@ -71,12 +77,32 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent,
|
||||
|
||||
array->AppendElement(parameters);
|
||||
|
||||
// We will set the opener of the dialog to be the nsIDOMWindow for the
|
||||
// browser XUL window itself, as opposed to the content. That way, the
|
||||
// progress window has access to the opener.
|
||||
nsCOMPtr<nsPIDOMWindow> pParentWindow = do_QueryInterface(parent);
|
||||
NS_ENSURE_STATE(pParentWindow);
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell = pParentWindow->GetDocShell();
|
||||
NS_ENSURE_STATE(docShell);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeOwner> owner;
|
||||
docShell->GetTreeOwner(getter_AddRefs(owner));
|
||||
|
||||
nsCOMPtr<nsIXULWindow> ownerXULWindow = do_GetInterface(owner);
|
||||
nsCOMPtr<nsIDOMWindow> ownerWindow = do_GetInterface(ownerXULWindow);
|
||||
NS_ENSURE_STATE(ownerWindow);
|
||||
|
||||
MOZ_ASSERT_UNREACHABLE("This is a test to see if this can even compile. "
|
||||
"I don't remember if C++ is this cool.");
|
||||
|
||||
// Open the dialog.
|
||||
nsCOMPtr<nsIDOMWindow> newWindow;
|
||||
rv = parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL),
|
||||
NS_LITERAL_STRING("_blank"),
|
||||
NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"),
|
||||
array, getter_AddRefs(newWindow));
|
||||
|
||||
rv = ownerWindow->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL),
|
||||
NS_LITERAL_STRING("_blank"),
|
||||
NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"),
|
||||
array, getter_AddRefs(newWindow));
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -6,11 +6,16 @@
|
||||
#include "nsPrintProgress.h"
|
||||
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsIXULWindow.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
#if 0
|
||||
NS_IMPL_ADDREF(nsPrintProgress)
|
||||
@ -100,12 +105,28 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent,
|
||||
|
||||
array->AppendElement(parameters);
|
||||
|
||||
// We will set the opener of the dialog to be the nsIDOMWindow for the
|
||||
// browser XUL window itself, as opposed to the content. That way, the
|
||||
// progress window has access to the opener.
|
||||
nsCOMPtr<nsPIDOMWindow> pParentWindow = do_QueryInterface(parent);
|
||||
NS_ENSURE_STATE(pParentWindow);
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell = pParentWindow->GetDocShell();
|
||||
NS_ENSURE_STATE(docShell);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeOwner> owner;
|
||||
docShell->GetTreeOwner(getter_AddRefs(owner));
|
||||
|
||||
nsCOMPtr<nsIXULWindow> ownerXULWindow = do_GetInterface(owner);
|
||||
nsCOMPtr<nsIDOMWindow> ownerWindow = do_GetInterface(ownerXULWindow);
|
||||
NS_ENSURE_STATE(ownerWindow);
|
||||
|
||||
// Open the dialog.
|
||||
nsCOMPtr<nsIDOMWindow> newWindow;
|
||||
rv = parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL),
|
||||
NS_LITERAL_STRING("_blank"),
|
||||
NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"),
|
||||
array, getter_AddRefs(newWindow));
|
||||
rv = ownerWindow->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL),
|
||||
NS_LITERAL_STRING("_blank"),
|
||||
NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"),
|
||||
array, getter_AddRefs(newWindow));
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
Loading…
Reference in New Issue
Block a user