Bug 539601 - [OS X] window.sizeMode incorrect when using full screen mode [r=mstange]

This commit is contained in:
Paul O’Shannessy 2012-02-08 11:59:18 -08:00
Родитель 0028544886
Коммит e5e8d88896
2 изменённых файлов: 17 добавлений и 10 удалений

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

@ -43,10 +43,8 @@ function openFullscreenWindow() {
function childFocused() {
ok(win.fullScreen, "window should be fullscreen");
// bug 670026
((navigator.platform.indexOf("Mac") < 0) ? is : todo_is)
(win.windowState, win.STATE_FULLSCREEN,
"window state should be fullscreen");
is(win.windowState, win.STATE_FULLSCREEN,
"window state should be fullscreen");
// The select doesn't open if the mouse click is fired too soon
// (on X11 at least).
@ -97,10 +95,8 @@ function finish() {
synthesizeMouseAtCenter(select, {}, win);
}
// bug 670026
((navigator.platform.indexOf("Mac") < 0) ? is : todo_is)
(win.windowState, win.STATE_FULLSCREEN,
"window state should still be fullscreen");
is(win.windowState, win.STATE_FULLSCREEN,
"window state should still be fullscreen");
win.close();
SimpleTest.finish();

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

@ -1087,6 +1087,10 @@ NS_METHOD nsCocoaWindow::SetSizeMode(PRInt32 aMode)
if (![mWindow isZoomed])
[mWindow zoom:nil];
}
else if (aMode == nsSizeMode_Fullscreen) {
if (!mFullScreen)
MakeFullScreen(true);
}
return NS_OK;
@ -1169,6 +1173,7 @@ NS_METHOD nsCocoaWindow::MakeFullScreen(bool aFullScreen)
NS_ENSURE_SUCCESS(rv, rv);
mFullScreen = aFullScreen;
DispatchSizeModeEvent();
return NS_OK;
@ -1375,8 +1380,14 @@ nsCocoaWindow::DispatchEvent(nsGUIEvent* event, nsEventStatus& aStatus)
return NS_OK;
}
// aFullScreen should be the window's mFullScreen. We don't have access to that
// from here, so we need to pass it in. mFullScreen should be the canonical
// indicator that a window is currently full screen and it makes sense to keep
// all sizemode logic here.
static nsSizeMode
GetWindowSizeMode(NSWindow* aWindow) {
GetWindowSizeMode(NSWindow* aWindow, bool aFullScreen) {
if (aFullScreen)
return nsSizeMode_Fullscreen;
if ([aWindow isMiniaturized])
return nsSizeMode_Minimized;
if (([aWindow styleMask] & NSResizableWindowMask) && [aWindow isZoomed])
@ -1416,7 +1427,7 @@ nsCocoaWindow::ReportMoveEvent()
void
nsCocoaWindow::DispatchSizeModeEvent()
{
nsSizeMode newMode = GetWindowSizeMode(mWindow);
nsSizeMode newMode = GetWindowSizeMode(mWindow, mFullScreen);
if (mSizeMode == newMode)
return;