зеркало из https://github.com/mozilla/pjs.git
Merge backout.
This commit is contained in:
Коммит
e88e289834
|
@ -1210,28 +1210,31 @@ nsXULPopupManager::MayShowPopup(nsMenuPopupFrame* aPopup)
|
|||
|
||||
nsCOMPtr<nsISupports> cont = aPopup->PresContext()->GetContainer();
|
||||
nsCOMPtr<nsIDocShellTreeItem> dsti = do_QueryInterface(cont);
|
||||
nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(dsti);
|
||||
if (!baseWin)
|
||||
if (!dsti)
|
||||
return PR_FALSE;
|
||||
|
||||
// chrome shells can always open popups, but other types of shells can only
|
||||
// open popups when they are focused
|
||||
PRInt32 type = -1;
|
||||
if (NS_FAILED(dsti->GetItemType(&type)))
|
||||
return PR_FALSE;
|
||||
|
||||
// chrome shells can always open popups, but other types of shells can only
|
||||
// open popups when they are focused and visible
|
||||
if (type != nsIDocShellTreeItem::typeChrome) {
|
||||
// only allow popups in active windows
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_GetInterface(dsti);
|
||||
if (!win)
|
||||
return PR_FALSE;
|
||||
|
||||
// only allow popups in active windows
|
||||
PRBool active;
|
||||
nsIFocusController* focusController = win->GetRootFocusController();
|
||||
focusController->GetActive(&active);
|
||||
if (!active)
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> baseWin = do_QueryInterface(dsti);
|
||||
if (!baseWin)
|
||||
return PR_FALSE;
|
||||
|
||||
// only allow popups in visible frames
|
||||
PRBool visible;
|
||||
baseWin->GetVisibility(&visible);
|
||||
|
@ -1239,17 +1242,6 @@ nsXULPopupManager::MayShowPopup(nsMenuPopupFrame* aPopup)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// platforms respond differently when an popup is opened in a minimized
|
||||
// window, so this is always disabled.
|
||||
nsCOMPtr<nsIWidget> mainWidget;
|
||||
baseWin->GetMainWidget(getter_AddRefs(mainWidget));
|
||||
if (mainWidget) {
|
||||
PRInt32 sizeMode;
|
||||
mainWidget->GetSizeMode(&sizeMode);
|
||||
if (sizeMode == nsSizeMode_Minimized)
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
// cannot open a popup that is a submenu of a menupopup that isn't open.
|
||||
nsIFrame* parent = aPopup->GetParent();
|
||||
if (parent && parent->GetType() == nsGkAtoms::menuFrame) {
|
||||
|
|
|
@ -19,28 +19,9 @@ var gBlockHiding = true;
|
|||
var gShownNotAllowed = true;
|
||||
var gHiddenNotAllowed = true;
|
||||
|
||||
var is = function(l, r, v) { window.opener.wrappedJSObject.SimpleTest.is(l, r, v); }
|
||||
|
||||
function runTest()
|
||||
{
|
||||
is(window.windowState, window.STATE_NORMAL, "window is normal");
|
||||
window.minimize();
|
||||
is(window.windowState, window.STATE_MINIMIZED, "window is minimized");
|
||||
|
||||
document.getElementById("menu").open = true;
|
||||
|
||||
setTimeout(runTestAfterMinimize, 0);
|
||||
}
|
||||
|
||||
function runTestAfterMinimize()
|
||||
{
|
||||
var menu = document.getElementById("menu");
|
||||
is(menu.firstChild.state, "closed", "popup not opened when window minimized");
|
||||
|
||||
window.restore();
|
||||
is(window.windowState, window.STATE_NORMAL, "window is restored");
|
||||
|
||||
menu.open = true;
|
||||
}
|
||||
|
||||
function popupShowing(event)
|
||||
|
|
|
@ -250,9 +250,6 @@ public:
|
|||
virtual void SetTransparencyMode(nsTransparencyMode aMode);
|
||||
NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, PRBool aActive);
|
||||
|
||||
// dispatch an NS_SIZEMODE event on miniaturize or deminiaturize
|
||||
void DispatchSizeModeEvent(nsSizeMode aSizeMode);
|
||||
|
||||
virtual gfxASurface* GetThebesSurface();
|
||||
|
||||
// be notified that a some form of drag event needs to go into Gecko
|
||||
|
|
|
@ -909,9 +909,7 @@ NS_METHOD nsCocoaWindow::SetSizeMode(PRInt32 aMode)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aMode == nsSizeMode_Normal) {
|
||||
if ([mWindow isMiniaturized])
|
||||
[mWindow deminiaturize:nil];
|
||||
else if (previousMode == nsSizeMode_Maximized && [mWindow isZoomed])
|
||||
if (previousMode == nsSizeMode_Maximized && [mWindow isZoomed])
|
||||
[mWindow zoom:nil];
|
||||
}
|
||||
else if (aMode == nsSizeMode_Minimized) {
|
||||
|
@ -1158,17 +1156,6 @@ nsCocoaWindow::DispatchEvent(nsGUIEvent* event, nsEventStatus& aStatus)
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
nsCocoaWindow::DispatchSizeModeEvent(nsSizeMode aSizeMode)
|
||||
{
|
||||
nsSizeModeEvent event(PR_TRUE, NS_SIZEMODE, this);
|
||||
event.mSizeMode = aSizeMode;
|
||||
event.time = PR_IntervalNow();
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
DispatchEvent(&event, status);
|
||||
}
|
||||
|
||||
void
|
||||
nsCocoaWindow::ReportSizeEvent(NSRect *r)
|
||||
{
|
||||
|
@ -1571,20 +1558,6 @@ NS_IMETHODIMP nsCocoaWindow::EndSecureKeyboardInput()
|
|||
}
|
||||
|
||||
|
||||
- (void)windowDidMiniaturize:(NSNotification *)aNotification
|
||||
{
|
||||
if (mGeckoWindow)
|
||||
mGeckoWindow->DispatchSizeModeEvent(nsSizeMode_Minimized);
|
||||
}
|
||||
|
||||
|
||||
- (void)windowDidDeminiaturize:(NSNotification *)aNotification
|
||||
{
|
||||
if (mGeckoWindow)
|
||||
mGeckoWindow->DispatchSizeModeEvent(nsSizeMode_Normal);
|
||||
}
|
||||
|
||||
|
||||
- (void)sendFocusEvent:(PRUint32)eventType
|
||||
{
|
||||
if (!mGeckoWindow)
|
||||
|
|
Загрузка…
Ссылка в новой задаче