зеркало из https://github.com/mozilla/gecko-dev.git
Bug 616797 Menubar doesn't appear by Alt key after using accelerator to open a popup menu and closing it by click r=enn, a=final+
This commit is contained in:
Родитель
6d04c2e76b
Коммит
c374f78d82
|
@ -259,6 +259,11 @@ nsMenuBarListener::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
if (result) {
|
||||
mMenuBarFrame->SetActive(PR_TRUE);
|
||||
result->OpenMenu(PR_TRUE);
|
||||
|
||||
// The opened menu will listen next keyup event.
|
||||
// Therefore, we should clear the keydown flags here.
|
||||
mAccessKeyDown = mAccessKeyDownCanceled = PR_FALSE;
|
||||
|
||||
aKeyEvent->StopPropagation();
|
||||
aKeyEvent->PreventDefault();
|
||||
retVal = NS_OK; // I am consuming event
|
||||
|
|
|
@ -111,7 +111,8 @@ function eventOccurred(event)
|
|||
events = events();
|
||||
if (events) {
|
||||
if (events.length <= gTestEventIndex) {
|
||||
ok(false, "Extra " + event.type + " event fired " + gPopupTests[gTestIndex].testname);
|
||||
ok(false, "Extra " + event.type + " event fired for " + event.target.id +
|
||||
" " +gPopupTests[gTestIndex].testname);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -567,6 +567,51 @@ var popupTests = [
|
|||
result: function (testname) {
|
||||
checkActive(document.getElementById("menubar"), "", testname);
|
||||
}
|
||||
},
|
||||
|
||||
// Fllowing 3 tests are a test of bug 616797, don't insert any new tests
|
||||
// between them.
|
||||
{
|
||||
testname: "Open file menu by accelerator",
|
||||
condition: function() { return (navigator.platform.indexOf("Win") == 0) },
|
||||
events: function() {
|
||||
return [ "DOMMenuBarActive menubar", "popupshowing filepopup",
|
||||
"DOMMenuItemActive filemenu", "DOMMenuItemActive item1",
|
||||
"popupshown filepopup" ];
|
||||
},
|
||||
test: function() {
|
||||
synthesizeKey("VK_ALT", { type: "keydown" });
|
||||
synthesizeKey("F", { altKey: true });
|
||||
synthesizeKey("VK_ALT", { type: "keyup" });
|
||||
}
|
||||
},
|
||||
{
|
||||
testname: "Close file menu by click at outside of popup menu",
|
||||
condition: function() { return (navigator.platform.indexOf("Win") == 0) },
|
||||
events: function() {
|
||||
return [ "popuphiding filepopup", "popuphidden filepopup",
|
||||
"DOMMenuItemInactive item1", "DOMMenuInactive filepopup",
|
||||
"DOMMenuBarInactive menubar", "DOMMenuItemInactive filemenu",
|
||||
"DOMMenuItemInactive filemenu" ];
|
||||
},
|
||||
test: function() {
|
||||
// XXX hidePopup() causes DOMMenuItemInactive event to be fired twice.
|
||||
document.getElementById("filepopup").hidePopup();
|
||||
}
|
||||
},
|
||||
{
|
||||
testname: "Alt keydown set focus the menubar",
|
||||
condition: function() { return (navigator.platform.indexOf("Win") == 0) },
|
||||
events: function() {
|
||||
return [ "DOMMenuBarActive menubar", "DOMMenuItemActive filemenu" ];
|
||||
},
|
||||
test: function() {
|
||||
synthesizeKey("VK_ALT", { });
|
||||
},
|
||||
result: function (testname) {
|
||||
checkClosed("filemenu", testname);
|
||||
synthesizeKey("VK_ALT", { }); // unfocus menubar
|
||||
}
|
||||
}
|
||||
|
||||
];
|
||||
|
|
Загрузка…
Ссылка в новой задаче