|
|
|
|
| 159 |
#include "nsIURIFixup.h" |
159 |
#include "nsIURIFixup.h" |
| 160 |
#include "nsCDefaultURIFixup.h" |
160 |
#include "nsCDefaultURIFixup.h" |
| 161 |
#include "nsEventDispatcher.h" |
161 |
#include "nsEventDispatcher.h" |
| 162 |
#include "nsIObserverService.h" |
162 |
#include "nsIObserverService.h" |
| 163 |
#include "nsIXULAppInfo.h" |
163 |
#include "nsIXULAppInfo.h" |
| 164 |
#include "nsNetUtil.h" |
164 |
#include "nsNetUtil.h" |
| 165 |
#ifdef MOZ_XUL |
165 |
#ifdef MOZ_XUL |
| 166 |
#include "nsXULPopupManager.h" |
166 |
#include "nsXULPopupManager.h" |
|
|
167 |
#include "nsIDOMXULControlElement.h" |
| 168 |
#include "nsIFrame.h" |
| 169 |
#include "nsPresShellIterator.h" |
| 167 |
#endif |
170 |
#endif |
| 168 |
|
171 |
|
| 169 |
#include "plbase64.h" |
172 |
#include "plbase64.h" |
| 170 |
|
173 |
|
| 171 |
#ifdef NS_PRINTING |
174 |
#ifdef NS_PRINTING |
| 172 |
#include "nsIPrintSettings.h" |
175 |
#include "nsIPrintSettings.h" |
| 173 |
#include "nsIPrintSettingsService.h" |
176 |
#include "nsIPrintSettingsService.h" |
| 174 |
#include "nsIWebBrowserPrint.h" |
177 |
#include "nsIWebBrowserPrint.h" |
|
Lines 3816-3831
nsGlobalWindow::GetMainWidget()
|
Link Here
|
|---|
|
| 3816 |
|
3819 |
|
| 3817 |
if (treeOwnerAsWin) { |
3820 |
if (treeOwnerAsWin) { |
| 3818 |
treeOwnerAsWin->GetMainWidget(&widget); |
3821 |
treeOwnerAsWin->GetMainWidget(&widget); |
| 3819 |
} |
3822 |
} |
| 3820 |
|
3823 |
|
| 3821 |
return widget; |
3824 |
return widget; |
| 3822 |
} |
3825 |
} |
| 3823 |
|
3826 |
|
|
|
3827 |
nsIWidget* |
| 3828 |
nsGlobalWindow::GetNearetWidget() |
| 3829 |
{ |
| 3830 |
nsIDocShell* docShell = GetDocShell(); |
| 3831 |
NS_ENSURE_TRUE(docShell, nsnull); |
| 3832 |
nsCOMPtr<nsIPresShell> winShell; |
| 3833 |
docShell->GetPresShell(getter_AddRefs(winShell)); |
| 3834 |
NS_ENSURE_TRUE(winShell, nsnull); |
| 3835 |
nsIFrame* rootFrame = winShell->GetRootFrame(); |
| 3836 |
NS_ENSURE_TRUE(rootFrame, nsnull); |
| 3837 |
return rootFrame->GetView()->GetNearestWidget(nsnull); |
| 3838 |
} |
| 3839 |
|
| 3824 |
NS_IMETHODIMP |
3840 |
NS_IMETHODIMP |
| 3825 |
nsGlobalWindow::SetFullScreen(PRBool aFullScreen) |
3841 |
nsGlobalWindow::SetFullScreen(PRBool aFullScreen) |
| 3826 |
{ |
3842 |
{ |
| 3827 |
FORWARD_TO_OUTER(SetFullScreen, (aFullScreen), NS_ERROR_NOT_INITIALIZED); |
3843 |
FORWARD_TO_OUTER(SetFullScreen, (aFullScreen), NS_ERROR_NOT_INITIALIZED); |
| 3828 |
|
3844 |
|
| 3829 |
NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE); |
3845 |
NS_ENSURE_TRUE(mDocShell, NS_ERROR_FAILURE); |
| 3830 |
|
3846 |
|
| 3831 |
PRBool rootWinFullScreen; |
3847 |
PRBool rootWinFullScreen; |
|
Lines 8784-8799
nsGlobalChromeWindow::SetBrowserDOMWindo
|
Link Here
|
|---|
|
| 8784 |
{ |
8800 |
{ |
| 8785 |
FORWARD_TO_OUTER_CHROME(SetBrowserDOMWindow, (aBrowserWindow), |
8801 |
FORWARD_TO_OUTER_CHROME(SetBrowserDOMWindow, (aBrowserWindow), |
| 8786 |
NS_ERROR_NOT_INITIALIZED); |
8802 |
NS_ERROR_NOT_INITIALIZED); |
| 8787 |
|
8803 |
|
| 8788 |
mBrowserDOMWindow = aBrowserWindow; |
8804 |
mBrowserDOMWindow = aBrowserWindow; |
| 8789 |
return NS_OK; |
8805 |
return NS_OK; |
| 8790 |
} |
8806 |
} |
| 8791 |
|
8807 |
|
|
|
8808 |
NS_IMETHODIMP |
| 8809 |
nsGlobalChromeWindow::NotifyDefaultButtonLoaded(nsIDOMElement* aDefaultButton) |
| 8810 |
{ |
| 8811 |
#ifdef MOZ_XUL |
| 8812 |
NS_ENSURE_ARG(aDefaultButton); |
| 8813 |
|
| 8814 |
// Don't snap to a disabled button. |
| 8815 |
nsCOMPtr<nsIDOMXULControlElement> xulControl = |
| 8816 |
do_QueryInterface(aDefaultButton); |
| 8817 |
NS_ENSURE_TRUE(xulControl, NS_ERROR_FAILURE); |
| 8818 |
PRBool disabled; |
| 8819 |
nsresult rv = xulControl->GetDisabled(&disabled); |
| 8820 |
NS_ENSURE_SUCCESS(rv, rv); |
| 8821 |
if (disabled) |
| 8822 |
return NS_OK; |
| 8823 |
|
| 8824 |
// Get the button rect in screen coordinates. |
| 8825 |
nsCOMPtr<nsIContent> content(do_QueryInterface(aDefaultButton)); |
| 8826 |
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE); |
| 8827 |
nsIDocument *doc = content->GetDocument(); |
| 8828 |
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE); |
| 8829 |
nsIPresShell *shell = doc->GetPrimaryShell(); |
| 8830 |
NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE); |
| 8831 |
nsIFrame *frame = shell->GetPrimaryFrameFor(content); |
| 8832 |
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); |
| 8833 |
nsIntRect buttonRect = frame->GetScreenRect(); |
| 8834 |
|
| 8835 |
// Get the widget rect in screen coordinates. |
| 8836 |
nsIWidget *widget = GetNearetWidget(); |
| 8837 |
NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE); |
| 8838 |
nsIntRect widgetRect; |
| 8839 |
rv = widget->GetScreenBounds(widgetRect); |
| 8840 |
NS_ENSURE_SUCCESS(rv, rv); |
| 8841 |
|
| 8842 |
// Convert the buttonRect coordinates from screen to the widget. |
| 8843 |
buttonRect -= widgetRect.TopLeft(); |
| 8844 |
rv = widget->OnDefaultButtonLoaded(buttonRect); |
| 8845 |
if (rv == NS_ERROR_NOT_IMPLEMENTED) |
| 8846 |
return NS_OK; |
| 8847 |
NS_ENSURE_SUCCESS(rv, rv); |
| 8848 |
return NS_OK; |
| 8849 |
#else |
| 8850 |
return NS_ERROR_NOT_IMPLEMENTED; |
| 8851 |
#endif |
| 8852 |
} |
| 8853 |
|
| 8792 |
// nsGlobalModalWindow implementation |
8854 |
// nsGlobalModalWindow implementation |
| 8793 |
|
8855 |
|
| 8794 |
// QueryInterface implementation for nsGlobalModalWindow |
8856 |
// QueryInterface implementation for nsGlobalModalWindow |
| 8795 |
NS_IMPL_CYCLE_COLLECTION_CLASS(nsGlobalModalWindow) |
8857 |
NS_IMPL_CYCLE_COLLECTION_CLASS(nsGlobalModalWindow) |
| 8796 |
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsGlobalModalWindow, |
8858 |
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsGlobalModalWindow, |
| 8797 |
nsGlobalWindow) |
8859 |
nsGlobalWindow) |
| 8798 |
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mArguments) |
8860 |
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mArguments) |
| 8799 |
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END |
8861 |
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END |