summaryrefslogtreecommitdiff
path: root/layout/xul/nsXULPopupManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'layout/xul/nsXULPopupManager.cpp')
-rw-r--r--layout/xul/nsXULPopupManager.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/layout/xul/nsXULPopupManager.cpp b/layout/xul/nsXULPopupManager.cpp
index 5fc533e1b9..6e8cc3dda1 100644
--- a/layout/xul/nsXULPopupManager.cpp
+++ b/layout/xul/nsXULPopupManager.cpp
@@ -712,6 +712,21 @@ nsXULPopupManager::ShowMenu(nsIContent *aMenu,
nsAutoString position;
+#ifdef XP_MACOSX
+ nsCOMPtr<nsIDOMXULMenuListElement> menulist = do_QueryInterface(aMenu);
+ bool isNonEditableMenulist = false;
+ if (menulist) {
+ bool editable;
+ menulist->GetEditable(&editable);
+ isNonEditableMenulist = !editable;
+ }
+
+ if (isNonEditableMenulist) {
+ position.AssignLiteral("selection");
+ }
+ else
+#endif
+
if (onMenuBar || !onmenu)
position.AssignLiteral("after_start");
else
@@ -1799,6 +1814,15 @@ nsXULPopupManager::MayShowPopup(nsMenuPopupFrame* aPopup)
return false;
}
+#ifdef XP_MACOSX
+ if (rootWin) {
+ auto globalWin = nsGlobalWindow::Cast(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) {
@@ -2304,6 +2328,7 @@ nsXULPopupManager::HandleKeyboardEventWithKeyCode(
switch (keyCode) {
case nsIDOMKeyEvent::DOM_VK_UP:
case nsIDOMKeyEvent::DOM_VK_DOWN:
+#ifndef XP_MACOSX
// roll up the popup when alt+up/down are pressed within a menulist.
bool alt;
aKeyEvent->GetAltKey(&alt);
@@ -2312,6 +2337,7 @@ nsXULPopupManager::HandleKeyboardEventWithKeyCode(
break;
}
MOZ_FALLTHROUGH;
+#endif
case nsIDOMKeyEvent::DOM_VK_LEFT:
case nsIDOMKeyEvent::DOM_VK_RIGHT:
@@ -2340,7 +2366,9 @@ nsXULPopupManager::HandleKeyboardEventWithKeyCode(
break;
case nsIDOMKeyEvent::DOM_VK_TAB:
+#ifndef XP_MACOSX
case nsIDOMKeyEvent::DOM_VK_F10:
+#endif
if (aTopVisibleMenuItem &&
!aTopVisibleMenuItem->Frame()->GetContent()->AttrValueIs(kNameSpaceID_None,
nsGkAtoms::activateontab, nsGkAtoms::_true, eCaseMatters)) {