Bug 1196163 part 3 - Derive value of window.fullScreen for content process from the sizemode of puppet widget. r=smaug

This commit is contained in:
Xidorn Quan 2015-08-29 11:12:41 +10:00
parent 753bfea20d
commit 41026f8b05
3 changed files with 13 additions and 5 deletions

View File

@ -6225,7 +6225,7 @@ nsGlobalWindow::GetMainWidget()
}
nsIWidget*
nsGlobalWindow::GetNearestWidget()
nsGlobalWindow::GetNearestWidget() const
{
nsIDocShell* docShell = GetDocShell();
NS_ENSURE_TRUE(docShell, nullptr);
@ -6666,8 +6666,16 @@ nsGlobalWindow::FullScreen() const
nsCOMPtr<nsIDocShellTreeItem> rootItem;
mDocShell->GetRootTreeItem(getter_AddRefs(rootItem));
if (rootItem == mDocShell) {
// We are the root window. Return our internal value.
return mFullScreen;
if (!XRE_IsContentProcess()) {
// We are the root window. Return our internal value.
return mFullScreen;
}
if (nsCOMPtr<nsIWidget> widget = GetNearestWidget()) {
// We are in content process, figure out the value from
// the sizemode of the puppet widget.
return widget->SizeMode() == nsSizeMode_Fullscreen;
}
return false;
}
nsCOMPtr<nsIDOMWindow> window = rootItem->GetWindow();

View File

@ -1509,7 +1509,7 @@ public:
bool WindowExists(const nsAString& aName, bool aLookForCallerOnJSStack);
already_AddRefed<nsIWidget> GetMainWidget();
nsIWidget* GetNearestWidget();
nsIWidget* GetNearestWidget() const;
void Freeze()
{

View File

@ -368,7 +368,7 @@ public:
/**
* Get the docshell in this window.
*/
nsIDocShell *GetDocShell()
nsIDocShell *GetDocShell() const
{
if (mOuterWindow) {
return mOuterWindow->mDocShell;