Bug 591408 - Fix for full screen regression: Only send one dom event to content. r=bz a=blocking

This commit is contained in:
Jim Mathies 2010-08-28 02:33:43 +02:00
Родитель 9b6c97dbeb
Коммит b96c1fc41a
1 изменённых файлов: 8 добавлений и 2 удалений

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

@ -3986,6 +3986,10 @@ nsGlobalWindow::SetFullScreen(PRBool aFullScreen)
if (itemType != nsIDocShellTreeItem::typeChrome) if (itemType != nsIDocShellTreeItem::typeChrome)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
// If we are already in full screen mode, just return.
if (mFullScreen == aFullScreen)
return NS_OK;
// dispatch a "fullscreen" DOM event so that XUL apps can // dispatch a "fullscreen" DOM event so that XUL apps can
// respond visually if we are kicked into full screen mode // respond visually if we are kicked into full screen mode
if (!DispatchCustomEvent("fullscreen")) { if (!DispatchCustomEvent("fullscreen")) {
@ -4001,12 +4005,14 @@ nsGlobalWindow::SetFullScreen(PRBool aFullScreen)
xulWin->SetIntrinsicallySized(PR_FALSE); xulWin->SetIntrinsicallySized(PR_FALSE);
} }
// Set this before so if widget sends an event indicating its
// gone full screen, the state trap above works.
mFullScreen = aFullScreen;
nsCOMPtr<nsIWidget> widget = GetMainWidget(); nsCOMPtr<nsIWidget> widget = GetMainWidget();
if (widget) if (widget)
widget->MakeFullScreen(aFullScreen); widget->MakeFullScreen(aFullScreen);
mFullScreen = aFullScreen;
return NS_OK; return NS_OK;
} }