Issue #1829 - Revert "Issue #1751"

This commit is contained in:
Brian Smith 2022-04-26 11:34:08 -05:00 • committed by roytam1
commit 13fcc4a046
949 changed files with 95662 additions and 444 deletions

View file

@ -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)) {