Bug 901207 - [Australis] Cmd/Ctrl+K should open menu panel when search bar was moved there. r=Gijs DONTBUILD

This commit is contained in:
Jared Wein
2013-12-10 17:50:08 -05:00
parent 082c639540
commit 0eeca4a6a3
6 changed files with 187 additions and 11 deletions

View File

@@ -6,6 +6,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
"resource:///modules/CustomizableUI.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ScrollbarSampler",
"resource:///modules/ScrollbarSampler.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/Promise.jsm");
/**
* Maintains the state and dispatches events for the main menu panel.
*/
@@ -116,9 +118,11 @@ const PanelUI = {
* @param aEvent the event (if any) that triggers showing the menu.
*/
show: function(aEvent) {
if (this.panel.state == "open" || this.panel.state == "showing" ||
let deferred = Promise.defer();
if (this.panel.state == "open" ||
document.documentElement.hasAttribute("customizing")) {
return;
deferred.resolve();
return deferred.promise;
}
this.ensureReady().then(() => {
@@ -144,7 +148,14 @@ const PanelUI = {
aEvent.sourceEvent.target.localName == "key";
this.panel.setAttribute("noautofocus", !keyboardOpened);
this.panel.openPopup(iconAnchor || anchor, "bottomcenter topright");
this.panel.addEventListener("popupshown", function onPopupShown() {
this.removeEventListener("popupshown", onPopupShown);
deferred.resolve();
});
});
return deferred.promise;
},
/**