Bug 948213 - Australis menu panel stays open when opening items in subviews, r=jaws,mconley

This commit is contained in:
Gijs Kruitbosch 2014-01-31 20:05:05 +00:00
parent 61099468ba
commit d94b5be9b6
5 changed files with 31 additions and 33 deletions

View File

@ -26,9 +26,11 @@
exitLabel="&appMenuCustomizeExit.label;"
tooltiptext="&appMenuCustomize.tooltip;"
exitTooltiptext="&appMenuCustomizeExit.tooltip;"
closemenu="none"
oncommand="gCustomizeMode.toggle();"/>
<toolbarseparator/>
<toolbarbutton id="PanelUI-help" label="&helpMenu.label;"
closemenu="none"
tooltiptext="&appMenuHelp.tooltip;"
oncommand="PanelUI.showHelpView(this.parentNode);"/>
<toolbarseparator/>

View File

@ -61,7 +61,6 @@ const PanelUI = {
}
this.helpView.addEventListener("ViewShowing", this._onHelpViewShow, false);
this.helpView.addEventListener("ViewHiding", this._onHelpViewHide, false);
this._eventListenersAdded = true;
},
@ -74,7 +73,6 @@ const PanelUI = {
this.panel.removeEventListener(event, this);
}
this.helpView.removeEventListener("ViewShowing", this._onHelpViewShow);
this.helpView.removeEventListener("ViewHiding", this._onHelpViewHide);
this.menuButton.removeEventListener("mousedown", this);
this.menuButton.removeEventListener("keypress", this);
},
@ -167,9 +165,6 @@ const PanelUI = {
handleEvent: function(aEvent) {
switch (aEvent.type) {
case "command":
this.onCommandHandler(aEvent);
break;
case "popupshowing":
// Fall through
case "popupshown":
@ -419,12 +414,6 @@ const PanelUI = {
fragment.appendChild(button);
}
items.appendChild(fragment);
this.addEventListener("command", PanelUI);
},
_onHelpViewHide: function(aEvent) {
this.removeEventListener("command", PanelUI);
},
_updateQuitTooltip: function() {

View File

@ -635,33 +635,33 @@ let CustomizableUIInternal = {
return [null, null];
},
registerMenuPanel: function(aPanel) {
registerMenuPanel: function(aPanelContents) {
if (gBuildAreas.has(CustomizableUI.AREA_PANEL) &&
gBuildAreas.get(CustomizableUI.AREA_PANEL).has(aPanel)) {
gBuildAreas.get(CustomizableUI.AREA_PANEL).has(aPanelContents)) {
return;
}
let document = aPanel.ownerDocument;
let document = aPanelContents.ownerDocument;
aPanel.toolbox = document.getElementById("navigator-toolbox");
aPanel.customizationTarget = aPanel;
aPanelContents.toolbox = document.getElementById("navigator-toolbox");
aPanelContents.customizationTarget = aPanelContents;
this.addPanelCloseListeners(aPanel);
this.addPanelCloseListeners(this._getPanelForNode(aPanelContents));
let placements = gPlacements.get(CustomizableUI.AREA_PANEL);
this.buildArea(CustomizableUI.AREA_PANEL, placements, aPanel);
for (let child of aPanel.children) {
this.buildArea(CustomizableUI.AREA_PANEL, placements, aPanelContents);
for (let child of aPanelContents.children) {
if (child.localName != "toolbarbutton") {
if (child.localName == "toolbaritem") {
this.ensureButtonContextMenu(child, aPanel);
this.ensureButtonContextMenu(child, aPanelContents);
}
continue;
}
this.ensureButtonContextMenu(child, aPanel);
this.ensureButtonContextMenu(child, aPanelContents);
child.setAttribute("wrap", "true");
}
this.registerBuildArea(CustomizableUI.AREA_PANEL, aPanel);
this.registerBuildArea(CustomizableUI.AREA_PANEL, aPanelContents);
},
onWidgetAdded: function(aWidgetId, aArea, aPosition) {
@ -1314,11 +1314,20 @@ let CustomizableUIInternal = {
}
}
if (aEvent.target.getAttribute("closemenu") == "none" ||
aEvent.target.getAttribute("widget-type") == "view") {
if (aEvent.originalTarget.getAttribute("closemenu") == "none" ||
aEvent.originalTarget.getAttribute("widget-type") == "view") {
return;
}
if (aEvent.originalTarget.getAttribute("closemenu") == "single") {
let panel = this._getPanelForNode(aEvent.originalTarget);
let multiview = panel.querySelector("panelmultiview");
if (multiview.showingSubView) {
multiview.showMainView();
return;
}
}
// If we get here, we can actually hide the popup:
this.hidePanelForNode(aEvent.target);
},

View File

@ -291,7 +291,6 @@ const CustomizableWidgets = [{
}
items.appendChild(fragment);
aEvent.target.addEventListener("command", win.PanelUI);
},
onViewHiding: function(aEvent) {
let doc = aEvent.target.ownerDocument;
@ -307,7 +306,6 @@ const CustomizableWidgets = [{
}
parent.appendChild(items);
aEvent.target.removeEventListener("command", win.PanelUI);
}
}, {
id: "add-ons-button",

View File

@ -174,6 +174,13 @@ CustomizeMode.prototype = {
window.PanelUI.menuButton.open = true;
window.PanelUI.beginBatchUpdate();
// The menu panel is lazy, and registers itself when the popup shows. We
// need to force the menu panel to register itself, or else customization
// is really not going to work. We pass "true" to ensureRegistered to
// indicate that we're handling calling startBatchUpdate and
// endBatchUpdate.
yield window.PanelUI.ensureReady(true);
// Hide the palette before starting the transition for increased perf.
this.visiblePalette.hidden = true;
@ -200,13 +207,6 @@ CustomizeMode.prototype = {
// Let everybody in this window know that we're about to customize.
this.dispatchToolboxEvent("customizationstarting");
// The menu panel is lazy, and registers itself when the popup shows. We
// need to force the menu panel to register itself, or else customization
// is really not going to work. We pass "true" to ensureRegistered to
// indicate that we're handling calling startBatchUpdate and
// endBatchUpdate.
yield window.PanelUI.ensureReady(true);
this._mainViewContext = mainView.getAttribute("context");
if (this._mainViewContext) {
mainView.removeAttribute("context");