Bug 506754, send NS_ACTIVATE when calling ShowWindow(mWnd, SW_RESTORE), r=ere

This commit is contained in:
Neil Deakin 2009-08-12 10:03:34 -04:00
Родитель 570542df91
Коммит 2ac881d164
2 изменённых файлов: 17 добавлений и 0 удалений

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

@ -20,12 +20,19 @@ var gBlockHiding = true;
var gShownNotAllowed = true;
var gHiddenNotAllowed = true;
var fm = Components.classes["@mozilla.org/focus-manager;1"].
getService(Components.interfaces.nsIFocusManager);
var is = function(l, r, v) { window.opener.wrappedJSObject.SimpleTest.is(l, r, v); }
var isnot = function(l, r, v) { window.opener.wrappedJSObject.SimpleTest.isnot(l, r, v); }
function runTest()
{
var menu = document.getElementById("menu");
is(fm.activeWindow, window, "active window at start");
is(fm.focusedWindow, window, "focused window at start");
is(window.windowState, window.STATE_NORMAL, "window is normal");
// the minimizing test sometimes fails on Linux so don't test it there
if (navigator.platform.indexOf("Lin") == 0) {
@ -35,6 +42,9 @@ function runTest()
window.minimize();
is(window.windowState, window.STATE_MINIMIZED, "window is minimized");
isnot(fm.activeWindow, window, "active window after minimize");
isnot(fm.focusedWindow, window, "focused window after minimize");
menu.open = true;
setTimeout(runTestAfterMinimize, 0);
@ -48,6 +58,9 @@ function runTestAfterMinimize()
window.restore();
is(window.windowState, window.STATE_NORMAL, "window is restored");
is(fm.activeWindow, window, "active window after restore");
is(fm.focusedWindow, window, "focused window after restore");
menu.open = true;
}

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

@ -1515,6 +1515,10 @@ NS_IMETHODIMP nsWindow::SetSizeMode(PRInt32 aMode) {
mode = SW_RESTORE;
}
::ShowWindow(mWnd, mode);
// we dispatch an activate event here to ensure that the right child window
// is focused
if (mode == SW_RESTORE || mode == SW_MAXIMIZE)
DispatchFocusToTopLevelWindow(NS_ACTIVATE);
}
return rv;
}