mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 12:55:46 +00:00
Bug 989947 - disable popups during modal alerts on OS X, r=bz
This commit is contained in:
parent
b34a02ceac
commit
e62dfd0026
@ -8818,6 +8818,16 @@ nsGlobalWindow::LeaveModalState()
|
||||
nsGlobalWindow *inner = topWin->GetCurrentInnerWindowInternal();
|
||||
if (inner)
|
||||
inner->mLastDialogQuitTime = TimeStamp::Now();
|
||||
|
||||
if (topWin->mModalStateDepth == 0) {
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
NS_NewDOMEvent(getter_AddRefs(event), topWin, nullptr, nullptr);
|
||||
event->InitEvent(NS_LITERAL_STRING("endmodalstate"), true, false);
|
||||
event->SetTrusted(true);
|
||||
event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
|
||||
bool dummy;
|
||||
topWin->DispatchEvent(event, &dummy);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "nsIXULDocument.h"
|
||||
#include "nsIXULTemplateBuilder.h"
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsViewManager.h"
|
||||
#include "nsIComponentManager.h"
|
||||
@ -1594,18 +1595,18 @@ nsXULPopupManager::MayShowPopup(nsMenuPopupFrame* aPopup)
|
||||
if (!baseWin)
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> root;
|
||||
dsti->GetRootTreeItem(getter_AddRefs(root));
|
||||
if (!root) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> rootWin = root->GetWindow();
|
||||
|
||||
// chrome shells can always open popups, but other types of shells can only
|
||||
// open popups when they are focused and visible
|
||||
if (dsti->ItemType() != nsIDocShellTreeItem::typeChrome) {
|
||||
// only allow popups in active windows
|
||||
nsCOMPtr<nsIDocShellTreeItem> root;
|
||||
dsti->GetRootTreeItem(getter_AddRefs(root));
|
||||
if (!root) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> rootWin = root->GetWindow();
|
||||
|
||||
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (!fm || !rootWin)
|
||||
return false;
|
||||
@ -1630,6 +1631,15 @@ nsXULPopupManager::MayShowPopup(nsMenuPopupFrame* aPopup)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
if (rootWin) {
|
||||
nsGlobalWindow *globalWin = static_cast<nsGlobalWindow *>(rootWin.get());
|
||||
if (globalWin->IsInModalState()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// cannot open a popup that is a submenu of a menupopup that isn't open.
|
||||
nsMenuFrame* menuFrame = do_QueryFrame(aPopup->GetParent());
|
||||
if (menuFrame) {
|
||||
|
Loading…
Reference in New Issue
Block a user