Bug 1354071 - use a panelmultiview for the overflow panel, r?mikedeboer
MozReview-Commit-ID: ERZuwC6eYQf
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -1487,17 +1487,18 @@ var CustomizableUIInternal = {
aWidget.id);
}
} else if (aWidget.type == "view") {
let ownerWindow = aNode.ownerGlobal;
let area = this.getPlacementOfWidget(aNode.id).area;
let anchor = aNode;
if (area != CustomizableUI.AREA_PANEL) {
let wrapper = this.wrapWidget(aWidget.id).forWindow(ownerWindow);
- if (wrapper && wrapper.anchor) {
+
+ if (wrapper && !wrapper.overflowed && wrapper.anchor) {
this.hidePanelForNode(aNode);
anchor = wrapper.anchor;
}
}
ownerWindow.PanelUI.showSubView(aWidget.viewId, anchor, area);
}
},
--- a/browser/components/customizableui/content/panelUI.inc.xul
+++ b/browser/components/customizableui/content/panelUI.inc.xul
@@ -375,20 +375,24 @@
<panel id="widget-overflow"
role="group"
type="arrow"
noautofocus="true"
context="toolbar-context-menu"
position="bottomcenter topright"
hidden="true">
- <vbox id="widget-overflow-scroller">
- <vbox id="widget-overflow-list" class="widget-overflow-list"
- overflowfortoolbar="nav-bar"/>
- </vbox>
+ <panelmultiview mainViewId="widget-overflow-mainView">
+ <panelview id="widget-overflow-mainView">
+ <vbox id="widget-overflow-scroller">
+ <vbox id="widget-overflow-list" class="widget-overflow-list"
+ overflowfortoolbar="nav-bar"/>
+ </vbox>
+ </panelview>
+ </panelmultiview>
</panel>
<panel id="customization-tipPanel"
type="arrow"
flip="none"
side="left"
position="leftcenter topright"
noautohide="true"
--- a/browser/components/customizableui/content/panelUI.js
+++ b/browser/components/customizableui/content/panelUI.js
@@ -426,18 +426,19 @@ const PanelUI = {
return;
}
if (!aAnchor) {
Cu.reportError("Expected an anchor when opening subview with id: " + aViewId);
return;
}
- if (aPlacementArea == CustomizableUI.AREA_PANEL) {
- this.multiView.showSubView(aViewId, aAnchor);
+ let container = aAnchor.closest("panelmultiview");
+ if (container) {
+ container.showSubView(aViewId, aAnchor);
} else if (!aAnchor.open) {
aAnchor.open = true;
let tempPanel = document.createElement("panel");
tempPanel.setAttribute("type", "arrow");
tempPanel.setAttribute("id", "customizationui-widget-panel");
tempPanel.setAttribute("class", "cui-widget-panel");
tempPanel.setAttribute("viewId", aViewId);
--- a/browser/components/customizableui/content/panelUI.xml
+++ b/browser/components/customizableui/content/panelUI.xml
@@ -173,16 +173,24 @@
</method>
<method name="showSubView">
<parameter name="aViewId"/>
<parameter name="aAnchor"/>
<body><![CDATA[
Task.spawn(function*() {
let viewNode = this.querySelector("#" + aViewId);
+ if (!viewNode) {
+ viewNode = document.getElementById(aViewId);
+ if (viewNode) {
+ this._subViews.appendChild(viewNode);
+ } else {
+ throw new Error(`Subview ${aViewId} doesn't exist!`);
+ }
+ }
viewNode.setAttribute("current", true);
// Emit the ViewShowing event so that the widget definition has a chance
// to lazily populate the subview with things.
let detail = {
blockers: new Set(),
addBlocker(aPromise) {
this.blockers.add(aPromise);
},