From 5f583ed9cae8e0124cab18330fdc9e046f6b09e5 Mon Sep 17 00:00:00 2001 From: "martijn.martijn@gmail.com" Date: Mon, 4 Jun 2007 16:15:29 -0700 Subject: [PATCH] Bug 127013 - fullScreen property operates inconsistently for frames, patch by Michael Ventnor, r+sr=jst --- dom/src/base/nsGlobalWindow.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/dom/src/base/nsGlobalWindow.cpp b/dom/src/base/nsGlobalWindow.cpp index 29518733475d..218211558ece 100644 --- a/dom/src/base/nsGlobalWindow.cpp +++ b/dom/src/base/nsGlobalWindow.cpp @@ -3343,8 +3343,10 @@ nsGlobalWindow::SetFullScreen(PRBool aFullScreen) { FORWARD_TO_OUTER(SetFullScreen, (aFullScreen), NS_ERROR_NOT_INITIALIZED); + PRBool rootWinFullScreen; + GetFullScreen(&rootWinFullScreen); // Only chrome can change our fullScreen mode. - if (aFullScreen == mFullScreen || + if (aFullScreen == rootWinFullScreen || !nsContentUtils::IsCallerTrustedForWrite()) { return NS_OK; } @@ -3390,6 +3392,18 @@ nsGlobalWindow::GetFullScreen(PRBool* aFullScreen) { FORWARD_TO_OUTER(GetFullScreen, (aFullScreen), NS_ERROR_NOT_INITIALIZED); + // Get the fullscreen value of the root window, to always have the value + // accurate, even when called from content. + nsCOMPtr treeItem = do_QueryInterface(mDocShell); + nsCOMPtr rootItem; + treeItem->GetRootTreeItem(getter_AddRefs(rootItem)); + if (rootItem != treeItem) { + nsCOMPtr window = do_GetInterface(rootItem); + if (window) + return window->GetFullScreen(aFullScreen); + } + + // We are the root window, or something went wrong. Return our internal value. *aFullScreen = mFullScreen; return NS_OK; }