Bug 1354117 - remove old panel code from customize mode and update related CSS, r?jaws draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 02 Aug 2017 11:51:58 +0100
changeset 621137 22e7d3f2e658bfa552bdbaa34f691843919592a2
parent 621136 fa270b0a427405582ece7222a4c6873f68d0b77c
child 621138 2e6b36cfdb08fc4a08972aa2fefbd9b35de32cbf
push id72277
push usergijskruitbosch@gmail.com
push dateFri, 04 Aug 2017 12:03:53 +0000
reviewersjaws
bugs1354117
milestone57.0a1
Bug 1354117 - remove old panel code from customize mode and update related CSS, r?jaws MozReview-Commit-ID: IwKUWMTagCK
browser/base/content/browser.css
browser/components/customizableui/CustomizeMode.jsm
browser/components/customizableui/DragPositionManager.jsm
browser/components/customizableui/content/customizeMode.inc.xul
browser/components/customizableui/content/panelUI.js
browser/themes/shared/customizableui/customizeMode.inc.css
browser/themes/shared/customizableui/panelUI.inc.css
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -1249,107 +1249,79 @@ toolbarpaletteitem[place="palette"] > #d
   #PanelUI-recentlyClosedTabs > toolbarbutton > .toolbarbutton-icon,
   #PanelUI-historyItems > toolbarbutton > .toolbarbutton-icon {
     image-rendering: -moz-crisp-edges;
   }
 }
 
 #customization-container {
   -moz-box-orient: horizontal;
-}
-
-#customization-container[photon] {
-  display: flex;
   flex-direction: column;
 }
 
-#customization-container[photon] > #customization-content-container {
+#customization-container:not([hidden]) {
+  /* In a separate rule to avoid 'display:flex' causing the node to be
+   * displayed while the container is still hidden. */
+  display: flex;
+}
+
+#customization-content-container {
   display: flex;
   flex-grow: 1; /* Grow so there isn't empty space below the footer */
   min-height: 0; /* Allow this to shrink so the footer doesn't get pushed out. */
 }
 
-#customization-container[photon] > #customization-content-container > #customization-palette-container {
-  flex-grow: 1;
-}
-
-#customization-container[photon] #customization-panelHolder {
+#customization-panelHolder {
   padding-top: 10px;
   padding-bottom: 10px;
 }
 
 #customization-panelHolder > #widget-overflow-fixed-list {
   flex: 0 1 auto; /* Size to content, but allow ourselves to shrink */
   display: flex;
   flex-direction: column;
   overflow-y: auto;
   overflow-x: hidden;
 }
 
-#customization-container:not([photon]) #customization-panelHolder {
-  overflow-y: hidden;
-}
-
-#customization-container[photon] #customization-panel-container {
-  display: flex;
-  flex-direction: column;
-  flex: none;
-}
-
-#customization-container[photon] #customization-panelWrapper,
-#customization-container[photon] #customization-panelWrapper > .panel-arrowcontent,
-#customization-container[photon] #customization-panelHolder {
+#customization-panelWrapper,
+#customization-panelWrapper > .panel-arrowcontent,
+#customization-panelHolder {
   flex-direction: column;
   display: flex;
   min-height: 0;
 }
 
-#customization-container[photon] #customization-panelWrapper {
+#customization-panelWrapper {
   flex: 1 1 auto;
   height: 0; /* Don't let my contents affect ancestors' content-based sizing */
   align-items: end; /* align to the end on the cross-axis (affects arrow) */
 }
 
 #customization-panelWrapper,
 #customization-panelWrapper > .panel-arrowcontent {
   -moz-box-flex: 1;
 }
 
-#customization-container:not([photon]) #customization-panelWrapper > .panel-arrowcontent {
-  overflow: hidden;
-}
-
-#customization-panelHolder > #PanelUI-mainView {
+#customization-panel-container {
+  overflow-y: auto;
   display: flex;
   flex-direction: column;
-  /* Hack alert - by manually setting the preferred height to 0, we convince
-     #PanelUI-mainView to shrink when the window gets smaller in customization
-     mode. Not sure why that is - might have to do with our intermingling of
-     XUL flex, and CSS3 Flexbox. */
-  height: 0;
-}
-
-#customization-panelHolder > #PanelUI-mainView > #PanelUI-contents-scroller {
-  display: flex;
-  flex: auto;
-  flex-direction: column;
-}
-
-#customization-panel-container {
-  overflow-y: auto;
+  flex: none;
 }
 
 toolbarpaletteitem[dragover] {
   border-left-color: transparent;
   border-right-color: transparent;
 }
 
 #customization-palette-container {
   display: flex;
   flex-direction: column;
+  flex-grow: 1;
 }
 
 #customization-palette:not([hidden]) {
   display: block;
   flex: 1 1 auto;
   overflow: auto;
   min-height: 3em;
 }
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -37,19 +37,16 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource://gre/modules/LightweightThemeManager.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "SessionStore",
                                   "resource:///modules/sessionstore/SessionStore.jsm");
 XPCOMUtils.defineLazyGetter(this, "gWidgetsBundle", function() {
   const kUrl = "chrome://browser/locale/customizableui/customizableWidgets.properties";
   return Services.strings.createBundle(kUrl);
 });
 
-XPCOMUtils.defineLazyPreferenceGetter(this, "gPhotonStructure",
-  "browser.photon.structure.enabled", false);
-
 let gDebug;
 XPCOMUtils.defineLazyGetter(this, "log", () => {
   let scope = {};
   Cu.import("resource://gre/modules/Console.jsm", scope);
   gDebug = Services.prefs.getBoolPref(kPrefCustomizationDebug, false);
   let consoleOptions = {
     maxLogLevel: gDebug ? "all" : "log",
     prefix: "CustomizeMode",
@@ -136,20 +133,16 @@ CustomizeMode.prototype = {
   // restore gNavToolbox.palette to its original state after exiting
   // customization mode.
   _stowedPalette: null,
   _dragOverItem: null,
   _customizing: false,
   _skipSourceNodeCheck: null,
   _mainViewContext: null,
 
-  get panelUIContents() {
-    return this.document.getElementById("PanelUI-contents");
-  },
-
   get _handler() {
     return this.window.CustomizationHandler;
   },
 
   uninit() {
     if (AppConstants.CAN_DRAW_IN_TITLEBAR) {
       Services.prefs.removeObserver(kDrawInTitlebarPref, this);
     }
@@ -284,90 +277,24 @@ CustomizeMode.prototype = {
       // customization mode when pressing ESC.
       document.addEventListener("keypress", this);
 
       // Same goes for the menu button - if we're customizing, a click on the
       // menu button means a quick exit from customization mode.
       window.PanelUI.hide();
 
       let panelHolder = document.getElementById("customization-panelHolder");
-      let panelContainer = document.getElementById("customization-panel-container");
-      let customizationContainer = document.getElementById("customization-container");
-      let paletteContainer = document.getElementById("customization-palette-container");
-      let contentContainer = document.getElementById("customization-content-container");
-      let footer = document.getElementById("customization-footer");
-      let doneButton = document.getElementById("customization-done-button");
       let panelContextMenu = document.getElementById(kPanelItemContextMenu);
       this._previousPanelContextMenuParent = panelContextMenu.parentNode;
       document.getElementById("mainPopupSet").appendChild(panelContextMenu);
-      if (gPhotonStructure) {
-        if (!customizationContainer.hasAttribute("photon")) {
-          contentContainer.appendChild(paletteContainer);
-          contentContainer.appendChild(panelContainer);
-          customizationContainer.appendChild(footer);
-          customizationContainer.setAttribute("photon", "true");
-          doneButton.hidden = false;
-        }
-        panelHolder.appendChild(window.PanelUI.overflowFixedList);
-        window.PanelUI.overflowFixedList.setAttribute("customizing", true);
-        window.PanelUI.menuButton.disabled = true;
-        document.getElementById("nav-bar-overflow-button").disabled = true;
-      } else {
-        if (customizationContainer.hasAttribute("photon")) {
-          customizationContainer.insertBefore(paletteContainer, contentContainer);
-          customizationContainer.appendChild(panelContainer);
-          paletteContainer.appendChild(footer);
-          customizationContainer.removeAttribute("photon");
-          doneButton.hidden = true;
-        }
-        window.PanelUI.menuButton.addEventListener("command", this);
-        window.PanelUI.menuButton.open = true;
-        window.PanelUI.beginBatchUpdate();
+      panelHolder.appendChild(window.PanelUI.overflowFixedList);
 
-        // The menu panel is lazy, and registers itself when the popup shows.
-        // If it hasn't been opened yet, we need to force the menu panel to
-        // register itself, or else customization is not going to work.
-        // We pass "true" to ensureReady to indicate that we're handling
-        // calling startBatchUpdate and endBatchUpdate.
-        if (!window.PanelUI.isReady) {
-          await window.PanelUI.ensureReady(true);
-          // Up to now, it will have been hidden, and its XBL bindings won't have
-          // been constructed. Unhiding it won't trigger the construction of
-          // those bindings immediately, but the next layout flush will.
-          // Because we don't want to sync flush layout, we wait for the next
-          // natural style/layout flush.
-          await new Promise(resolve => window.requestIdleCallback(resolve));
-        }
-
-        // Hide the palette before starting the transition for increased perf.
-        this.visiblePalette.hidden = true;
-        this.visiblePalette.removeAttribute("showing");
-
-        if (!AppConstants.MOZ_PHOTON_THEME) {
-          // Disable the button-text fade-out mask
-          // during the transition for increased perf.
-          window.PanelUI.contents.setAttribute("customize-transitioning", "true");
-        }
-
-        // Move the mainView in the panel to the holder so that we can see it
-        // while customizing.
-        let mainView = window.PanelUI.mainView;
-        panelHolder.appendChild(mainView);
-
-        let customizeButton = document.getElementById("PanelUI-customize");
-        customizeButton.setAttribute("enterLabel", customizeButton.getAttribute("label"));
-        customizeButton.setAttribute("label", customizeButton.getAttribute("exitLabel"));
-        customizeButton.setAttribute("enterTooltiptext", customizeButton.getAttribute("tooltiptext"));
-        customizeButton.setAttribute("tooltiptext", customizeButton.getAttribute("exitTooltiptext"));
-
-        this._mainViewContext = mainView.getAttribute("context");
-        if (this._mainViewContext) {
-          mainView.removeAttribute("context");
-        }
-      }
+      window.PanelUI.overflowFixedList.setAttribute("customizing", true);
+      window.PanelUI.menuButton.disabled = true;
+      document.getElementById("nav-bar-overflow-button").disabled = true;
 
       this._transitioning = true;
 
       let customizer = document.getElementById("customization-container");
       customizer.parentNode.selectedPanel = customizer;
       customizer.hidden = false;
 
       this._wrapToolbarItemSync(CustomizableUI.AREA_TABSTRIP);
@@ -378,42 +305,30 @@ CustomizeMode.prototype = {
 
       await this._doTransition(true);
 
       Services.obs.addObserver(this, "lightweight-theme-window-updated");
 
       // Let everybody in this window know that we're about to customize.
       CustomizableUI.dispatchToolboxEvent("customizationstarting", {}, window);
 
-      if (!gPhotonStructure) {
-        this._showPanelCustomizationPlaceholders();
-      }
-
       await this._wrapToolbarItems();
       this.populatePalette();
 
       this._addDragHandlers(this.visiblePalette);
 
       window.gNavToolbox.addEventListener("toolbarvisibilitychange", this);
 
-      if (!gPhotonStructure) {
-        document.getElementById("PanelUI-help").setAttribute("disabled", true);
-        document.getElementById("PanelUI-quit").setAttribute("disabled", true);
-      }
-
       this._updateResetButton();
       this._updateUndoResetButton();
 
       this._skipSourceNodeCheck = Services.prefs.getPrefType(kSkipSourceNodePref) == Ci.nsIPrefBranch.PREF_BOOL &&
                                   Services.prefs.getBoolPref(kSkipSourceNodePref);
 
       CustomizableUI.addListener(this);
-      if (!gPhotonStructure) {
-        window.PanelUI.endBatchUpdate();
-      }
       this._customizing = true;
       this._transitioning = false;
 
       // Show the palette now that the transition has finished.
       this.visiblePalette.hidden = false;
       window.setTimeout(() => {
         // Force layout reflow to ensure the animation runs,
         // and make it async so it doesn't affect the timing.
@@ -423,36 +338,24 @@ CustomizeMode.prototype = {
       this._updateEmptyPaletteNotice();
 
       this._updateLWThemeButtonIcon();
       if (!AppConstants.MOZ_PHOTON_THEME) {
         this.maybeShowTip(panelHolder);
       }
 
       this._handler.isEnteringCustomizeMode = false;
-      if (!gPhotonStructure) {
-        window.PanelUI.contents.removeAttribute("customize-transitioning");
-      }
 
       CustomizableUI.dispatchToolboxEvent("customizationready", {}, window);
-      this._enableOutlinesTimeout = window.setTimeout(() => {
-        this.document.getElementById("nav-bar").setAttribute("showoutline", "true");
-        if (!gPhotonStructure) {
-          this.panelUIContents.setAttribute("showoutline", "true");
-        }
-        delete this._enableOutlinesTimeout;
-      }, 0);
 
       if (!this._wantToBeInCustomizeMode) {
         this.exit();
       }
     })().catch(e => {
       log.error("Error entering customize mode", e);
-      // We should ensure this has been called, and calling it again doesn't hurt:
-      window.PanelUI.endBatchUpdate();
       this._handler.isEnteringCustomizeMode = false;
       // Exit customize mode to ensure proper clean-up when entering failed.
       this.exit();
     });
   },
 
   exit() {
     this._wantToBeInCustomizeMode = false;
@@ -473,52 +376,30 @@ CustomizeMode.prototype = {
                 "We'll exit after resetting has finished.");
       return;
     }
 
     this.hideTip();
 
     this._handler.isExitingCustomizeMode = true;
 
-    if (this._enableOutlinesTimeout) {
-      this.window.clearTimeout(this._enableOutlinesTimeout);
-    } else {
-      this.document.getElementById("nav-bar").removeAttribute("showoutline");
-      this.panelUIContents.removeAttribute("showoutline");
-    }
-
     this._removeExtraToolbarsIfEmpty();
 
     CustomizableUI.removeListener(this);
 
     this.document.removeEventListener("keypress", this);
-    if (!gPhotonStructure) {
-      this.window.PanelUI.menuButton.removeEventListener("command", this);
-      this.window.PanelUI.menuButton.open = false;
-
-      this.window.PanelUI.beginBatchUpdate();
-
-      this._removePanelCustomizationPlaceholders();
-    }
 
     let window = this.window;
     let document = this.document;
 
     // Hide the palette before starting the transition for increased perf.
     this.visiblePalette.hidden = true;
     this.visiblePalette.removeAttribute("showing");
     this.paletteEmptyNotice.hidden = true;
 
-    if (!gPhotonStructure) {
-      // Disable the button-text fade-out mask
-      // during the transition for increased perf.
-      let panelContents = window.PanelUI.contents;
-      panelContents.setAttribute("customize-transitioning", "true");
-    }
-
     // Disable the reset and undo reset buttons while transitioning:
     let resetButton = this.document.getElementById("customization-reset-button");
     let undoResetButton = this.document.getElementById("customization-undo-reset-button");
     undoResetButton.hidden = resetButton.disabled = true;
 
     this._transitioning = true;
 
     (async () => {
@@ -559,74 +440,43 @@ CustomizeMode.prototype = {
       // And drop all area references.
       this.areas.clear();
 
       // Let everybody in this window know that we're starting to
       // exit customization mode.
       CustomizableUI.dispatchToolboxEvent("customizationending", {}, window);
 
       window.PanelUI.menuButton.disabled = false;
-      if (gPhotonStructure) {
-        let overflowContainer = document.getElementById("widget-overflow-scroller");
-        overflowContainer.appendChild(window.PanelUI.overflowFixedList);
-        document.getElementById("nav-bar-overflow-button").disabled = false;
-      } else {
-        window.PanelUI.setMainView(window.PanelUI.mainView);
-
-        let customizeButton = document.getElementById("PanelUI-customize");
-        customizeButton.setAttribute("exitLabel", customizeButton.getAttribute("label"));
-        customizeButton.setAttribute("label", customizeButton.getAttribute("enterLabel"));
-        customizeButton.setAttribute("exitTooltiptext", customizeButton.getAttribute("tooltiptext"));
-        customizeButton.setAttribute("tooltiptext", customizeButton.getAttribute("enterTooltiptext"));
-
-        // We have to use setAttribute/removeAttribute here instead of the
-        // property because the XBL property will be set later, and right
-        // now we'd be setting an expando, which breaks the XBL property.
-        document.getElementById("PanelUI-help").removeAttribute("disabled");
-        document.getElementById("PanelUI-quit").removeAttribute("disabled");
-        this.panelUIContents.removeAttribute("customize-transitioning");
-      }
+      let overflowContainer = document.getElementById("widget-overflow-scroller");
+      overflowContainer.appendChild(window.PanelUI.overflowFixedList);
+      document.getElementById("nav-bar-overflow-button").disabled = false;
       let panelContextMenu = document.getElementById(kPanelItemContextMenu);
       this._previousPanelContextMenuParent.appendChild(panelContextMenu);
 
       // We need to set this._customizing to false before removing the tab
       // or the TabSelect event handler will think that we are exiting
       // customization mode for a second time.
       this._customizing = false;
 
-      if (!gPhotonStructure) {
-        let mainView = window.PanelUI.mainView;
-        if (this._mainViewContext) {
-          mainView.setAttribute("context", this._mainViewContext);
-        }
-      }
-
       let customizableToolbars = document.querySelectorAll("toolbar[customizable=true]:not([autohide=true])");
       for (let toolbar of customizableToolbars)
         toolbar.removeAttribute("customizing");
 
-      if (!gPhotonStructure) {
-        this.window.PanelUI.endBatchUpdate();
-      }
       delete this._lastLightweightTheme;
       this._changed = false;
       this._transitioning = false;
       this._handler.isExitingCustomizeMode = false;
       CustomizableUI.dispatchToolboxEvent("aftercustomization", {}, window);
       CustomizableUI.notifyEndCustomizing(window);
 
       if (this._wantToBeInCustomizeMode) {
         this.enter();
       }
     })().catch(e => {
       log.error("Error exiting customize mode", e);
-      if (!gPhotonStructure) {
-        // We should ensure this has been called, and calling it again doesn't hurt:
-        window.PanelUI.endBatchUpdate();
-      }
       this._handler.isExitingCustomizeMode = false;
     });
   },
 
   /**
    * The customize mode transition has 4 phases when entering:
    * 1) Pre-customization mode
    *    This is the starting phase of the browser.
@@ -805,18 +655,17 @@ CustomizeMode.prototype = {
     }
   },
 
   addToPanel(aNode) {
     aNode = this._getCustomizableChildForNode(aNode);
     if (aNode.localName == "toolbarpaletteitem" && aNode.firstChild) {
       aNode = aNode.firstChild;
     }
-    let panel = gPhotonStructure ? CustomizableUI.AREA_FIXED_OVERFLOW_PANEL
-                                 : CustomizableUI.AREA_PANEL;
+    let panel = CustomizableUI.AREA_FIXED_OVERFLOW_PANEL;
     CustomizableUI.addWidgetToArea(aNode.id, panel);
     if (!this._customizing) {
       CustomizableUI.dispatchToolboxEvent("customizationchange");
     }
 
     if (AppConstants.MOZ_PHOTON_ANIMATIONS &&
         Services.prefs.getBoolPref("toolkit.cosmeticAnimations.enabled")) {
       let overflowButton = this.document.getElementById("nav-bar-overflow-button");
@@ -855,20 +704,18 @@ CustomizeMode.prototype = {
       for (let widget of unusedWidgets) {
         let paletteItem = this.makePaletteItem(widget, "palette");
         if (!paletteItem) {
           continue;
         }
         fragment.appendChild(paletteItem);
       }
 
-      if (gPhotonStructure) {
-        let flexSpace = CustomizableUI.createSpecialWidget("spring", this.document);
-        fragment.appendChild(this.wrapToolbarItem(flexSpace, "palette"));
-      }
+      let flexSpace = CustomizableUI.createSpecialWidget("spring", this.document);
+      fragment.appendChild(this.wrapToolbarItem(flexSpace, "palette"));
 
       this.visiblePalette.appendChild(fragment);
       this._stowedPalette = this.window.gNavToolbox.palette;
       this.window.gNavToolbox.palette = this.visiblePalette;
     } catch (ex) {
       log.error(ex);
     }
   },
@@ -1159,17 +1006,17 @@ CustomizeMode.prototype = {
   async _wrapToolbarItems() {
     for (let area of CustomizableUI.areas) {
       await this._wrapToolbarItem(area);
     }
   },
 
   _addDragHandlers(aTarget) {
     // Allow dropping on the padding of the arrow panel.
-    if (gPhotonStructure && aTarget.id == CustomizableUI.AREA_FIXED_OVERFLOW_PANEL) {
+    if (aTarget.id == CustomizableUI.AREA_FIXED_OVERFLOW_PANEL) {
       aTarget = this.document.getElementById("customization-panelHolder");
     }
     aTarget.addEventListener("dragstart", this, true);
     aTarget.addEventListener("dragover", this, true);
     aTarget.addEventListener("dragexit", this, true);
     aTarget.addEventListener("drop", this, true);
     aTarget.addEventListener("dragend", this, true);
   },
@@ -1180,17 +1027,17 @@ CustomizeMode.prototype = {
         this.wrapToolbarItem(child, CustomizableUI.getPlaceForItem(child));
       }
     }
   },
 
   _removeDragHandlers(aTarget) {
     // Remove handler from different target if it was added to
     // allow dropping on the padding of the arrow panel.
-    if (gPhotonStructure && aTarget.id == CustomizableUI.AREA_FIXED_OVERFLOW_PANEL) {
+    if (aTarget.id == CustomizableUI.AREA_FIXED_OVERFLOW_PANEL) {
       aTarget = this.document.getElementById("customization-panelHolder");
     }
     aTarget.removeEventListener("dragstart", this, true);
     aTarget.removeEventListener("dragover", this, true);
     aTarget.removeEventListener("dragexit", this, true);
     aTarget.removeEventListener("drop", this, true);
     aTarget.removeEventListener("dragend", this, true);
   },
@@ -1244,45 +1091,42 @@ CustomizeMode.prototype = {
 
   reset() {
     this.resetting = true;
     // Disable the reset button temporarily while resetting:
     let btn = this.document.getElementById("customization-reset-button");
     BrowserUITelemetry.countCustomizationEvent("reset");
     btn.disabled = true;
     return (async () => {
-      this._removePanelCustomizationPlaceholders();
       await this.depopulatePalette();
       await this._unwrapToolbarItems();
 
       CustomizableUI.reset();
 
       this._updateLWThemeButtonIcon();
 
       await this._wrapToolbarItems();
       this.populatePalette();
 
       this.persistCurrentSets(true);
 
       this._updateResetButton();
       this._updateUndoResetButton();
       this._updateEmptyPaletteNotice();
-      this._showPanelCustomizationPlaceholders();
       this.resetting = false;
       if (!this._wantToBeInCustomizeMode) {
         this.exit();
       }
     })().catch(log.error);
   },
 
   undoReset() {
     this.resetting = true;
 
     return (async () => {
-      this._removePanelCustomizationPlaceholders();
       await this.depopulatePalette();
       await this._unwrapToolbarItems();
 
       CustomizableUI.undoReset();
 
       this._updateLWThemeButtonIcon();
 
       await this._wrapToolbarItems();
@@ -1319,19 +1163,16 @@ CustomizeMode.prototype = {
   onWidgetRemoved(aWidgetId, aArea) {
     this._onUIChange();
   },
 
   onWidgetBeforeDOMChange(aNodeToChange, aSecondaryNode, aContainer) {
     if (aContainer.ownerGlobal != this.window || this.resetting) {
       return;
     }
-    if (aContainer.id == CustomizableUI.AREA_PANEL) {
-      this._removePanelCustomizationPlaceholders();
-    }
     // If we get called for widgets that aren't in the window yet, they might not have
     // a parentNode at all.
     if (aNodeToChange.parentNode) {
       this.unwrapToolbarItem(aNodeToChange.parentNode);
     }
     if (aSecondaryNode) {
       this.unwrapToolbarItem(aSecondaryNode.parentNode);
     }
@@ -1357,29 +1198,22 @@ CustomizeMode.prototype = {
       // API also does the right thing (and adds it to the palette)
       let widgetId = aNodeToChange.id;
       let widget = CustomizableUI.getWidget(widgetId);
       if (widget.provider == CustomizableUI.PROVIDER_API) {
         let paletteItem = this.makePaletteItem(widget, "palette");
         this.visiblePalette.appendChild(paletteItem);
       }
     }
-    if (aContainer.id == CustomizableUI.AREA_PANEL) {
-      this._showPanelCustomizationPlaceholders();
-    }
   },
 
   onWidgetDestroyed(aWidgetId) {
     let wrapper = this.document.getElementById("wrapper-" + aWidgetId);
     if (wrapper) {
-      let wasInPanel = wrapper.parentNode == this.panelUIContents;
       wrapper.remove();
-      if (wasInPanel) {
-        this._showPanelCustomizationPlaceholders();
-      }
     }
   },
 
   onWidgetAfterCreation(aWidgetId, aArea) {
     // If the node was added to an area, we would have gotten an onWidgetAdded notification,
     // plus associated DOM change notifications, so only do stuff for the palette:
     if (!aArea) {
       let widgetNode = this.document.getElementById(aWidgetId);
@@ -1391,26 +1225,24 @@ CustomizeMode.prototype = {
       }
     }
   },
 
   onAreaNodeRegistered(aArea, aContainer) {
     if (aContainer.ownerDocument == this.document) {
       this._wrapItemsInArea(aContainer);
       this._addDragHandlers(aContainer);
-      DragPositionManager.add(this.window, aArea, aContainer);
       this.areas.add(aContainer);
     }
   },
 
   onAreaNodeUnregistered(aArea, aContainer, aReason) {
     if (aContainer.ownerDocument == this.document && aReason == CustomizableUI.REASON_AREA_UNREGISTERED) {
       this._unwrapItemsInArea(aContainer);
       this._removeDragHandlers(aContainer);
-      DragPositionManager.remove(this.window, aArea, aContainer);
       this.areas.delete(aContainer);
     }
   },
 
   openAddonsManagerThemes(aEvent) {
     aEvent.target.parentNode.parentNode.hidePopup();
     this.window.BrowserOpenAddonsMgr("addons://list/theme");
   },
@@ -1675,22 +1507,16 @@ CustomizeMode.prototype = {
         this._onDragDrop(aEvent);
         break;
       case "dragexit":
         this._onDragExit(aEvent);
         break;
       case "dragend":
         this._onDragEnd(aEvent);
         break;
-      case "command":
-        if (aEvent.originalTarget == this.window.PanelUI.menuButton) {
-          this.exit();
-          aEvent.preventDefault();
-        }
-        break;
       case "mousedown":
         this._onMouseDown(aEvent);
         break;
       case "mouseup":
         this._onMouseUp(aEvent);
         break;
       case "keypress":
         if (aEvent.keyCode == aEvent.DOM_VK_ESCAPE) {
@@ -1794,20 +1620,18 @@ CustomizeMode.prototype = {
     // Hack needed so that the dragimage will still show the
     // item as it appeared before it was hidden.
     this._initializeDragAfterMove = () => {
       // For automated tests, we sometimes start exiting customization mode
       // before this fires, which leaves us with placeholders inserted after
       // we've exited. So we need to check that we are indeed customizing.
       if (this._customizing && !this._transitioning) {
         item.hidden = true;
-        this._showPanelCustomizationPlaceholders();
         DragPositionManager.start(this.window);
-        let canUsePrevSibling = placeForItem == "toolbar" ||
-                                (placeForItem == "panel" && gPhotonStructure);
+        let canUsePrevSibling = placeForItem == "toolbar" || placeForItem == "panel";
         if (item.nextSibling) {
           this._setDragActive(item.nextSibling, "before", draggedItem.id, placeForItem);
           this._dragOverItem = item.nextSibling;
         } else if (canUsePrevSibling && item.previousSibling) {
           this._setDragActive(item.previousSibling, "after", draggedItem.id, placeForItem);
           this._dragOverItem = item.previousSibling;
         }
       }
@@ -1887,17 +1711,17 @@ CustomizeMode.prototype = {
           let existingDir = dragOverItem.getAttribute("dragover");
           if (existingDir == "before") {
             dropTargetCenter += (parseInt(dragOverItem.style.borderInlineStartWidth) || 0) / 2;
           } else {
             dropTargetCenter -= (parseInt(dragOverItem.style.borderInlineEndWidth) || 0) / 2;
           }
           let before = this._dir == "ltr" ? aEvent.clientX < dropTargetCenter : aEvent.clientX > dropTargetCenter;
           dragValue = before ? "before" : "after";
-        } else if (targetAreaType == "menu-panel" && gPhotonStructure) {
+        } else if (targetAreaType == "menu-panel") {
           let itemRect = this._dwu.getBoundsWithoutFlushing(dragOverItem);
           let dropTargetCenter = itemRect.top + (itemRect.height / 2);
           let existingDir = dragOverItem.getAttribute("dragover");
           if (existingDir == "before") {
             dropTargetCenter += (parseInt(dragOverItem.style.borderBlockStartWidth) || 0) / 2;
           } else {
             dropTargetCenter -= (parseInt(dragOverItem.style.borderBlockEndWidth) || 0) / 2;
           }
@@ -1910,18 +1734,16 @@ CustomizeMode.prototype = {
 
     if (this._dragOverItem && dragOverItem != this._dragOverItem) {
       this._cancelDragActive(this._dragOverItem, dragOverItem);
     }
 
     if (dragOverItem != this._dragOverItem || dragValue != dragOverItem.getAttribute("dragover")) {
       if (dragOverItem != targetArea.customizationTarget) {
         this._setDragActive(dragOverItem, dragValue, draggedItemId, targetAreaType);
-      } else if (targetAreaType == "toolbar") {
-        this._updateToolbarCustomizationOutline(this.window, targetArea);
       }
       this._dragOverItem = dragOverItem;
     }
 
     aEvent.preventDefault();
     aEvent.stopPropagation();
   },
 
@@ -1962,25 +1784,22 @@ CustomizeMode.prototype = {
     while (targetNode.classList.contains(kPlaceholderClass) && targetNode.nextSibling) {
       targetNode = targetNode.nextSibling;
     }
     if (targetNode.tagName == "toolbarpaletteitem") {
       targetNode = targetNode.firstChild;
     }
 
     this._cancelDragActive(this._dragOverItem, null, true);
-    this._removePanelCustomizationPlaceholders();
 
     try {
       this._applyDrop(aEvent, targetArea, originArea, draggedItemId, targetNode);
     } catch (ex) {
       log.error(ex, ex.stack);
     }
-
-    this._showPanelCustomizationPlaceholders();
   },
 
   _applyDrop(aEvent, aTargetArea, aOriginArea, aDraggedItemId, aTargetNode) {
     let document = aEvent.target.ownerDocument;
     let draggedItem = document.getElementById(aDraggedItemId);
     draggedItem.hidden = false;
     draggedItem.removeAttribute("mousedown");
 
@@ -2160,18 +1979,16 @@ CustomizeMode.prototype = {
       draggedWrapper.hidden = false;
       draggedWrapper.removeAttribute("mousedown");
     }
 
     if (this._dragOverItem) {
       this._cancelDragActive(this._dragOverItem);
       this._dragOverItem = null;
     }
-    this._updateToolbarCustomizationOutline(this.window);
-    this._showPanelCustomizationPlaceholders();
     DragPositionManager.stop();
   },
 
   _isUnwantedDragDrop(aEvent) {
     // The simulated events generated by synthesizeDragStart/synthesizeDrop in
     // mochitests are used only for testing whether the right data is being put
     // into the dataTransfer. Neither cause a real drop to occur, so they don't
     // set the source node. There isn't a means of testing real drag and drops,
@@ -2199,21 +2016,20 @@ CustomizeMode.prototype = {
     if (aAreaType == "panel") {
       aAreaType = "menu-panel";
     }
     if (aItem.getAttribute("dragover") != aValue) {
       aItem.setAttribute("dragover", aValue);
 
       let window = aItem.ownerGlobal;
       let draggedItem = window.document.getElementById(aDraggedItemId);
-      if (aAreaType == "palette" || (aAreaType == "menu-panel" && !gPhotonStructure)) {
+      if (aAreaType == "palette") {
         this._setGridDragActive(aItem, draggedItem, aValue);
       } else {
         let targetArea = this._getCustomizableParent(aItem);
-        this._updateToolbarCustomizationOutline(window, targetArea);
         let makeSpaceImmediately = false;
         if (!gDraggingInToolbars.has(targetArea.id)) {
           gDraggingInToolbars.add(targetArea.id);
           let draggedWrapper = this.document.getElementById("wrapper-" + aDraggedItemId);
           let originArea = this._getCustomizableParent(draggedWrapper);
           makeSpaceImmediately = originArea == targetArea;
         }
         let propertyToMeasure = aAreaType == "toolbar" ? "width" : "height";
@@ -2237,24 +2053,22 @@ CustomizeMode.prototype = {
           // Force a layout flush:
           aItem.getBoundingClientRect();
           aItem.removeAttribute("notransition");
         }
       }
     }
   },
   _cancelDragActive(aItem, aNextItem, aNoTransition) {
-    this._updateToolbarCustomizationOutline(aItem.ownerGlobal);
     let currentArea = this._getCustomizableParent(aItem);
     if (!currentArea) {
       return;
     }
     let areaType = CustomizableUI.getAreaType(currentArea.id);
-    let needPositionManager = !areaType || (areaType == "menu-panel" && !gPhotonStructure);
-    if (!needPositionManager) {
+    if (areaType) {
       if (aNoTransition) {
         aItem.setAttribute("notransition", "true");
       }
       aItem.removeAttribute("dragover");
       // Remove all property values in the case that the end padding
       // had been set.
       aItem.style.removeProperty("border-inline-start-width");
       aItem.style.removeProperty("border-inline-end-width");
@@ -2347,17 +2161,17 @@ CustomizeMode.prototype = {
       CustomizableUI.onWidgetDrag(aDraggedItem.id);
     } else {
       aDraggedItem.parentNode.hidden = true;
     }
     return size;
   },
 
   _getCustomizableParent(aElement) {
-    if (gPhotonStructure && aElement) {
+    if (aElement) {
       // Deal with drag/drop on the padding of the panel in photon.
       let containingPanelHolder = aElement.closest("#customization-panelHolder");
       if (containingPanelHolder) {
         return containingPanelHolder.firstChild;
       }
     }
 
     let areas = CustomizableUI.areas;
@@ -2392,17 +2206,17 @@ CustomizeMode.prototype = {
     if (boundsContainer == this.panelUIContents) {
       boundsContainer = boundsContainer.parentNode;
     }
     let bounds = boundsContainer.getBoundingClientRect();
     dragX = Math.min(bounds.right, Math.max(dragX, bounds.left));
     dragY = Math.min(bounds.bottom, Math.max(dragY, bounds.top));
 
     let targetNode;
-    if (aAreaType == "toolbar" || (aAreaType == "menu-panel" && gPhotonStructure)) {
+    if (aAreaType == "toolbar" || aAreaType == "menu-panel") {
       targetNode = aAreaElement.ownerDocument.elementFromPoint(dragX, dragY);
       while (targetNode && targetNode.parentNode != expectedParent) {
         targetNode = targetNode.parentNode;
       }
     } else {
       let positionManager = DragPositionManager.getManagerForArea(aAreaElement);
       // Make it relative to the container:
       dragX -= bounds.left;
@@ -2451,99 +2265,27 @@ CustomizeMode.prototype = {
     while (aElement && aElement.localName != "toolbarpaletteitem") {
       if (aElement.localName == "toolbar")
         return null;
       aElement = aElement.parentNode;
     }
     return aElement;
   },
 
-  _showPanelCustomizationPlaceholders() {
-    let doc = this.document;
-    let contents = this.panelUIContents;
-    let narrowItemsAfterWideItem = 0;
-    let node = contents.lastChild;
-    while (node && !node.classList.contains(CustomizableUI.WIDE_PANEL_CLASS) &&
-           (!node.firstChild || !node.firstChild.classList.contains(CustomizableUI.WIDE_PANEL_CLASS))) {
-      if (!node.hidden && !node.classList.contains(kPlaceholderClass)) {
-        narrowItemsAfterWideItem++;
-      }
-      node = node.previousSibling;
-    }
-
-    let orphanedItems = narrowItemsAfterWideItem % CustomizableUI.PANEL_COLUMN_COUNT;
-    let placeholders = CustomizableUI.PANEL_COLUMN_COUNT - orphanedItems;
-
-    let currentPlaceholderCount = contents.querySelectorAll("." + kPlaceholderClass).length;
-    if (placeholders > currentPlaceholderCount) {
-      while (placeholders-- > currentPlaceholderCount) {
-        let placeholder = doc.createElement("toolbarpaletteitem");
-        placeholder.classList.add(kPlaceholderClass);
-        // XXXjaws The toolbarbutton child here is only necessary to get
-        //  the styling right here.
-        let placeholderChild = doc.createElement("toolbarbutton");
-        placeholderChild.classList.add(kPlaceholderClass + "-child");
-        placeholder.appendChild(placeholderChild);
-        contents.appendChild(placeholder);
-      }
-    } else if (placeholders < currentPlaceholderCount) {
-      while (placeholders++ < currentPlaceholderCount) {
-        contents.querySelectorAll("." + kPlaceholderClass)[0].remove();
-      }
-    }
-  },
-
-  _removePanelCustomizationPlaceholders() {
-    let contents = this.panelUIContents;
-    let oldPlaceholders = contents.getElementsByClassName(kPlaceholderClass);
-    while (oldPlaceholders.length) {
-      contents.removeChild(oldPlaceholders[0]);
-    }
-  },
-
-  /**
-   * Update toolbar customization targets during drag events to add or remove
-   * outlines to indicate that an area is customizable.
-   *
-   * @param aWindow                       The XUL window in which outlines should be updated.
-   * @param {Element} [aToolbarArea=null] The element of the customizable toolbar area to add the
-   *                                      outline to. If aToolbarArea is falsy, the outline will be
-   *                                      removed from all toolbar areas.
-   */
-  _updateToolbarCustomizationOutline(aWindow, aToolbarArea = null) {
-    // Remove the attribute from existing customization targets
-    for (let area of CustomizableUI.areas) {
-      if (CustomizableUI.getAreaType(area) != CustomizableUI.TYPE_TOOLBAR) {
-        continue;
-      }
-      let target = CustomizableUI.getCustomizeTargetForArea(area, aWindow);
-      target.removeAttribute("customizing-dragovertarget");
-    }
-
-    // Now set the attribute on the desired target
-    if (aToolbarArea) {
-      if (CustomizableUI.getAreaType(aToolbarArea.id) != CustomizableUI.TYPE_TOOLBAR)
-        return;
-      let target = CustomizableUI.getCustomizeTargetForArea(aToolbarArea.id, aWindow);
-      target.setAttribute("customizing-dragovertarget", true);
-    }
-  },
-
   _findVisiblePreviousSiblingNode(aReferenceNode) {
     while (aReferenceNode &&
            aReferenceNode.localName == "toolbarpaletteitem" &&
            aReferenceNode.firstChild.hidden) {
       aReferenceNode = aReferenceNode.previousSibling;
     }
     return aReferenceNode;
   },
 
   onPanelContextMenuShowing(event) {
-    let inPermanentArea = !gPhotonStructure ||
-                          !!event.target.triggerNode.closest("#widget-overflow-fixed-list");
+    let inPermanentArea = !!event.target.triggerNode.closest("#widget-overflow-fixed-list");
     let doc = event.target.ownerDocument;
     doc.getElementById("customizationPanelItemContextMenuUnpin").hidden = !inPermanentArea;
     doc.getElementById("customizationPanelItemContextMenuPin").hidden = inPermanentArea;
   },
 };
 
 function __dumpDragData(aEvent, caller) {
   if (!gDebug) {
--- a/browser/components/customizableui/DragPositionManager.jsm
+++ b/browser/components/customizableui/DragPositionManager.jsm
@@ -2,19 +2,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 Components.utils.import("resource:///modules/CustomizableUI.jsm");
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 
-XPCOMUtils.defineLazyPreferenceGetter(this, "gPhotonStructure",
-  "browser.photon.structure.enabled", false);
-
 var gManagers = new WeakMap();
 
 const kPaletteId = "customization-palette";
 const kPlaceholderClass = "panel-customization-placeholder";
 
 this.EXPORTED_SYMBOLS = ["DragPositionManager"];
 
 function AreaPositionManager(aContainer) {
@@ -378,45 +375,27 @@ AreaPositionManager.prototype = {
       rv = rv[aDirection + "Sibling"];
     } while (rv && rv.getAttribute("hidden") == "true")
     return rv;
   }
 }
 
 var DragPositionManager = {
   start(aWindow) {
-    let areas = gPhotonStructure ? [] : [CustomizableUI.AREA_PANEL];
-    areas = areas.map((area) => CustomizableUI.getCustomizeTargetForArea(area, aWindow));
-    areas.push(aWindow.document.getElementById(kPaletteId));
+    let areas = [aWindow.document.getElementById(kPaletteId)];
     for (let areaNode of areas) {
       let positionManager = gManagers.get(areaNode);
       if (positionManager) {
         positionManager.update(areaNode);
       } else {
         gManagers.set(areaNode, new AreaPositionManager(areaNode));
       }
     }
   },
 
-  add(aWindow, aArea, aContainer) {
-    if (aArea != CustomizableUI.AREA_PANEL) {
-      return;
-    }
-
-    gManagers.set(aContainer, new AreaPositionManager(aContainer));
-  },
-
-  remove(aWindow, aArea, aContainer) {
-    if (aArea != CustomizableUI.AREA_PANEL) {
-      return;
-    }
-
-    gManagers.delete(aContainer);
-  },
-
   stop() {
     gManagers = new WeakMap();
   },
 
   getManagerForArea(aArea) {
     return gManagers.get(aArea);
   }
 };
--- a/browser/components/customizableui/content/customizeMode.inc.xul
+++ b/browser/components/customizableui/content/customizeMode.inc.xul
@@ -1,141 +1,141 @@
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <box id="customization-container" flex="1" hidden="true">
-  <box flex="1" id="customization-palette-container">
-    <label id="customization-header">
-      &customizeMode.menuAndToolbars.header2;
-    </label>
-    <hbox id="customization-empty" hidden="true">
-      <label>&customizeMode.menuAndToolbars.empty;</label>
-      <label onclick="BrowserOpenAddonsMgr('addons://discover/');"
-             onkeypress="BrowserOpenAddonsMgr('addons://discover/');"
-             id="customization-more-tools"
-             class="text-link">
-        &customizeMode.menuAndToolbars.emptyLink;
+  <box id="customization-content-container">
+    <box flex="1" id="customization-palette-container">
+      <label id="customization-header">
+        &customizeMode.menuAndToolbars.header2;
       </label>
-    </hbox>
-    <vbox id="customization-palette" class="customization-palette"/>
-    <spacer id="customization-spacer"/>
-    <hbox id="customization-footer">
+      <hbox id="customization-empty" hidden="true">
+        <label>&customizeMode.menuAndToolbars.empty;</label>
+        <label onclick="BrowserOpenAddonsMgr('addons://discover/');"
+               onkeypress="BrowserOpenAddonsMgr('addons://discover/');"
+               id="customization-more-tools"
+               class="text-link">
+          &customizeMode.menuAndToolbars.emptyLink;
+        </label>
+      </hbox>
+      <vbox id="customization-palette" class="customization-palette" hidden="true"/>
+      <spacer id="customization-spacer"/>
+    </box>
+    <vbox id="customization-panel-container">
+      <vbox id="customization-panelWrapper">
+        <box class="panel-arrowbox">
+          <image class="panel-arrow" side="top"/>
+        </box>
+        <box class="panel-arrowcontent" side="top" flex="1">
+          <hbox id="customization-panelHolder"/>
+          <box class="panel-inner-arrowcontentfooter" hidden="true"/>
+        </box>
+      </vbox>
+    </vbox>
+  </box>
+  <hbox id="customization-footer">
 #ifdef CAN_DRAW_IN_TITLEBAR
-      <checkbox id="customization-titlebar-visibility-checkbox" class="customizationmode-checkbox"
-                label="&customizeMode.titlebar;"
+    <checkbox id="customization-titlebar-visibility-checkbox" class="customizationmode-checkbox"
+              label="&customizeMode.titlebar;"
 #NB: because oncommand fires after click, by the time we've fired, the checkbox binding
 #    will already have switched the button's state, so this is correct:
-                oncommand="gCustomizeMode.toggleTitlebar(this.checked)"/>
+              oncommand="gCustomizeMode.toggleTitlebar(this.checked)"/>
 #endif
-      <button id="customization-toolbar-visibility-button" label="&customizeMode.toolbars2;" class="customizationmode-button" type="menu">
-        <menupopup id="customization-toolbar-menu" onpopupshowing="onViewToolbarsPopupShowing(event)"/>
-      </button>
-      <button id="customization-lwtheme-button" label="&customizeMode.lwthemes;" class="customizationmode-button" type="menu">
-        <panel type="arrow" id="customization-lwtheme-menu"
-               onpopupshowing="gCustomizeMode.onLWThemesMenuShowing(event);"
-               position="topcenter bottomleft"
-               flip="none"
-               role="menu">
-          <label id="customization-lwtheme-menu-header" value="&customizeMode.lwthemes.myThemes;"/>
-          <label id="customization-lwtheme-menu-recommended" value="&customizeMode.lwthemes.recommended;"/>
-          <hbox id="customization-lwtheme-menu-footer">
-            <toolbarbutton class="customization-lwtheme-menu-footeritem"
-                           label="&customizeMode.lwthemes.menuManage;"
-                           accesskey="&customizeMode.lwthemes.menuManage.accessKey;"
-                           tabindex="0"
-                           oncommand="gCustomizeMode.openAddonsManagerThemes(event);"/>
-            <toolbarbutton class="customization-lwtheme-menu-footeritem"
-                           label="&customizeMode.lwthemes.menuGetMore;"
-                           accesskey="&customizeMode.lwthemes.menuGetMore.accessKey;"
-                           tabindex="0"
-                           oncommand="gCustomizeMode.getMoreThemes(event);"/>
-          </hbox>
-        </panel>
-      </button>
+    <button id="customization-toolbar-visibility-button" label="&customizeMode.toolbars2;" class="customizationmode-button" type="menu">
+      <menupopup id="customization-toolbar-menu" onpopupshowing="onViewToolbarsPopupShowing(event)"/>
+    </button>
+    <button id="customization-lwtheme-button" label="&customizeMode.lwthemes;" class="customizationmode-button" type="menu">
+      <panel type="arrow" id="customization-lwtheme-menu"
+             onpopupshowing="gCustomizeMode.onLWThemesMenuShowing(event);"
+             position="topcenter bottomleft"
+             flip="none"
+             role="menu">
+        <label id="customization-lwtheme-menu-header" value="&customizeMode.lwthemes.myThemes;"/>
+        <label id="customization-lwtheme-menu-recommended" value="&customizeMode.lwthemes.recommended;"/>
+        <hbox id="customization-lwtheme-menu-footer">
+          <toolbarbutton class="customization-lwtheme-menu-footeritem"
+                         label="&customizeMode.lwthemes.menuManage;"
+                         accesskey="&customizeMode.lwthemes.menuManage.accessKey;"
+                         tabindex="0"
+                         oncommand="gCustomizeMode.openAddonsManagerThemes(event);"/>
+          <toolbarbutton class="customization-lwtheme-menu-footeritem"
+                         label="&customizeMode.lwthemes.menuGetMore;"
+                         accesskey="&customizeMode.lwthemes.menuGetMore.accessKey;"
+                         tabindex="0"
+                         oncommand="gCustomizeMode.getMoreThemes(event);"/>
+        </hbox>
+      </panel>
+    </button>
 #ifdef MOZ_PHOTON_THEME
-      <button id="customization-uidensity-button"
-              label="&customizeMode.uidensity;"
-              class="customizationmode-button"
-              type="menu">
-        <panel type="arrow" id="customization-uidensity-menu"
-               onpopupshowing="gCustomizeMode.onUIDensityMenuShowing();"
-               position="topcenter bottomleft"
-               flip="none"
-               role="menu">
-          <menuitem id="customization-uidensity-menuitem-compact"
-                    class="menuitem-iconic customization-uidensity-menuitem"
-                    role="menuitemradio"
-                    label="&customizeMode.uidensity.menuCompact.label;"
-                    accesskey="&customizeMode.uidensity.menuCompact.accessKey;"
-                    tooltiptext="&customizeMode.uidensity.menuCompact.tooltip;"
-                    tabindex="0"
-                    onfocus="gCustomizeMode.updateUIDensity(this.mode);"
-                    onmouseover="gCustomizeMode.updateUIDensity(this.mode);"
-                    onblur="gCustomizeMode.resetUIDensity();"
-                    onmouseout="gCustomizeMode.resetUIDensity();"
-                    oncommand="gCustomizeMode.setUIDensity(this.mode);" />
-          <menuitem id="customization-uidensity-menuitem-normal"
-                    class="menuitem-iconic customization-uidensity-menuitem"
-                    role="menuitemradio"
-                    label="&customizeMode.uidensity.menuNormal.label;"
-                    accesskey="&customizeMode.uidensity.menuNormal.accessKey;"
-                    tooltiptext="&customizeMode.uidensity.menuNormal.tooltip;"
-                    tabindex="0"
-                    onfocus="gCustomizeMode.updateUIDensity(this.mode);"
-                    onmouseover="gCustomizeMode.updateUIDensity(this.mode);"
-                    onblur="gCustomizeMode.resetUIDensity();"
-                    onmouseout="gCustomizeMode.resetUIDensity();"
-                    oncommand="gCustomizeMode.setUIDensity(this.mode);" />
+    <button id="customization-uidensity-button"
+            label="&customizeMode.uidensity;"
+            class="customizationmode-button"
+            type="menu">
+      <panel type="arrow" id="customization-uidensity-menu"
+             onpopupshowing="gCustomizeMode.onUIDensityMenuShowing();"
+             position="topcenter bottomleft"
+             flip="none"
+             role="menu">
+        <menuitem id="customization-uidensity-menuitem-compact"
+                  class="menuitem-iconic customization-uidensity-menuitem"
+                  role="menuitemradio"
+                  label="&customizeMode.uidensity.menuCompact.label;"
+                  accesskey="&customizeMode.uidensity.menuCompact.accessKey;"
+                  tooltiptext="&customizeMode.uidensity.menuCompact.tooltip;"
+                  tabindex="0"
+                  onfocus="gCustomizeMode.updateUIDensity(this.mode);"
+                  onmouseover="gCustomizeMode.updateUIDensity(this.mode);"
+                  onblur="gCustomizeMode.resetUIDensity();"
+                  onmouseout="gCustomizeMode.resetUIDensity();"
+                  oncommand="gCustomizeMode.setUIDensity(this.mode);" />
+        <menuitem id="customization-uidensity-menuitem-normal"
+                  class="menuitem-iconic customization-uidensity-menuitem"
+                  role="menuitemradio"
+                  label="&customizeMode.uidensity.menuNormal.label;"
+                  accesskey="&customizeMode.uidensity.menuNormal.accessKey;"
+                  tooltiptext="&customizeMode.uidensity.menuNormal.tooltip;"
+                  tabindex="0"
+                  onfocus="gCustomizeMode.updateUIDensity(this.mode);"
+                  onmouseover="gCustomizeMode.updateUIDensity(this.mode);"
+                  onblur="gCustomizeMode.resetUIDensity();"
+                  onmouseout="gCustomizeMode.resetUIDensity();"
+                  oncommand="gCustomizeMode.setUIDensity(this.mode);" />
 #ifndef XP_MACOSX
-          <menuitem id="customization-uidensity-menuitem-touch"
-                    class="menuitem-iconic customization-uidensity-menuitem"
-                    role="menuitemradio"
-                    label="&customizeMode.uidensity.menuTouch.label;"
-                    accesskey="&customizeMode.uidensity.menuTouch.accessKey;"
-                    tooltiptext="&customizeMode.uidensity.menuTouch.tooltip;"
-                    tabindex="0"
-                    onfocus="gCustomizeMode.updateUIDensity(this.mode);"
-                    onmouseover="gCustomizeMode.updateUIDensity(this.mode);"
-                    onblur="gCustomizeMode.resetUIDensity();"
-                    onmouseout="gCustomizeMode.resetUIDensity();"
-                    oncommand="gCustomizeMode.setUIDensity(this.mode);">
-          </menuitem>
-          <spacer hidden="true" id="customization-uidensity-touch-spacer"/>
-          <checkbox id="customization-uidensity-autotouchmode-checkbox"
-                    hidden="true"
-                    label="&customizeMode.uidensity.autoTouchMode.checkbox.label;"
-                    oncommand="gCustomizeMode.updateAutoTouchMode(this.checked)"/>
+        <menuitem id="customization-uidensity-menuitem-touch"
+                  class="menuitem-iconic customization-uidensity-menuitem"
+                  role="menuitemradio"
+                  label="&customizeMode.uidensity.menuTouch.label;"
+                  accesskey="&customizeMode.uidensity.menuTouch.accessKey;"
+                  tooltiptext="&customizeMode.uidensity.menuTouch.tooltip;"
+                  tabindex="0"
+                  onfocus="gCustomizeMode.updateUIDensity(this.mode);"
+                  onmouseover="gCustomizeMode.updateUIDensity(this.mode);"
+                  onblur="gCustomizeMode.resetUIDensity();"
+                  onmouseout="gCustomizeMode.resetUIDensity();"
+                  oncommand="gCustomizeMode.setUIDensity(this.mode);">
+        </menuitem>
+        <spacer hidden="true" id="customization-uidensity-touch-spacer"/>
+        <checkbox id="customization-uidensity-autotouchmode-checkbox"
+                  hidden="true"
+                  label="&customizeMode.uidensity.autoTouchMode.checkbox.label;"
+                  oncommand="gCustomizeMode.updateAutoTouchMode(this.checked)"/>
 #endif
-        </panel>
-      </button>
+      </panel>
+    </button>
 #endif
 
-      <spacer id="customization-footer-spacer"/>
-      <button id="customization-undo-reset-button"
-              class="customizationmode-button"
-              hidden="true"
-              oncommand="gCustomizeMode.undoReset();"
-              label="&undoCmd.label;"/>
-      <button id="customization-reset-button"
-              oncommand="gCustomizeMode.reset();"
-              label="&customizeMode.restoreDefaults;"
-              class="customizationmode-button"/>
-      <button id="customization-done-button"
-              hidden="true"
-              oncommand="gCustomizeMode.exit();"
-              label="&customizeMode.done;"
-              class="customizationmode-button"/>
-    </hbox>
-  </box>
-  <box id="customization-content-container"/>
-  <vbox id="customization-panel-container">
-    <vbox id="customization-panelWrapper">
-      <box class="panel-arrowbox">
-        <image class="panel-arrow" side="top"/>
-      </box>
-      <box class="panel-arrowcontent" side="top" flex="1">
-        <hbox id="customization-panelHolder"/>
-        <box class="panel-inner-arrowcontentfooter" hidden="true"/>
-      </box>
-    </vbox>
-  </vbox>
+    <spacer id="customization-footer-spacer"/>
+    <button id="customization-undo-reset-button"
+            class="customizationmode-button"
+            hidden="true"
+            oncommand="gCustomizeMode.undoReset();"
+            label="&undoCmd.label;"/>
+    <button id="customization-reset-button"
+            oncommand="gCustomizeMode.reset();"
+            label="&customizeMode.restoreDefaults;"
+            class="customizationmode-button"/>
+    <button id="customization-done-button"
+            oncommand="gCustomizeMode.exit();"
+            label="&customizeMode.done;"
+            class="customizationmode-button"/>
+  </hbox>
 </box>
--- a/browser/components/customizableui/content/panelUI.js
+++ b/browser/components/customizableui/content/panelUI.js
@@ -648,35 +648,16 @@ const PanelUI = {
   },
 
   onAreaReset(aArea, aContainer) {
     if (gPhotonStructure && aContainer == this.overflowFixedList) {
       this.updateOverflowStatus();
     }
   },
 
-  /**
-   * Signal that we're about to make a lot of changes to the contents of the
-   * panels all at once. For performance, we ignore the mutations.
-   */
-  beginBatchUpdate() {
-    this._ensureEventListenersAdded();
-    this.multiView.ignoreMutations = true;
-  },
-
-  /**
-   * Signal that we're done making bulk changes to the panel. We now pay
-   * attention to mutations. This automatically synchronizes the multiview
-   * container with whichever view is displayed if the panel is open.
-   */
-  endBatchUpdate(aReason) {
-    this._ensureEventListenersAdded();
-    this.multiView.ignoreMutations = false;
-  },
-
   _adjustLabelsForAutoHyphens(aNode) {
     let toolbarButtons = aNode ? [aNode] :
                                  this.contents.querySelectorAll(".toolbarbutton-1");
     for (let node of toolbarButtons) {
       let label = node.getAttribute("label");
       if (!label) {
         continue;
       }
--- a/browser/themes/shared/customizableui/customizeMode.inc.css
+++ b/browser/themes/shared/customizableui/customizeMode.inc.css
@@ -625,26 +625,16 @@ toolbarpaletteitem[place=toolbar] > tool
 @media (min-resolution: 2dppx) {
   #customization-panelWrapper > .panel-arrowbox > .panel-arrow[side="top"] {
     list-style-image: var(--panel-arrow-image-vertical,
                           url("chrome://global/skin/arrow/panelarrow-vertical@2x.png"));
   }
 }
 %endif
 
-/* Non-photon adjustments. Remove when we stop supporting non-photon. */
-#customization-container:not([photon]) #customization-panelWrapper > .panel-arrowbox {
-  margin-bottom: -1px;
-}
-
-#customization-container:not([photon]) #customization-panelWrapper > .panel-arrowbox > .panel-arrow[side="top"] {
-  margin-inline-end: 0;
-  margin-inline-start: 22.35em;
-}
-
 %ifdef MOZ_PHOTON_THEME
 #customization-panelHolder > #widget-overflow-fixed-list:not(:empty) {
   padding-bottom: 50px; /* Make sure there's always space to drop stuff. */
 }
 
 #customization-panelHolder > #widget-overflow-fixed-list:empty {
   background-image: url("chrome://browser/skin/customizableui/empty-overflow-panel.png");
   background-position: center top 10px;
--- a/browser/themes/shared/customizableui/panelUI.inc.css
+++ b/browser/themes/shared/customizableui/panelUI.inc.css
@@ -277,18 +277,18 @@ panel[photon] > .panel-arrowcontainer > 
   max-height: 2.4em;
 }
 
 .panelUI-grid .toolbarbutton-1:not([auto-hyphens="off"]) > .toolbarbutton-menubutton-button > .toolbarbutton-multiline-text,
 .panelUI-grid .toolbarbutton-1:not([auto-hyphens="off"]) > .toolbarbutton-multiline-text {
   -moz-hyphens: auto;
 }
 
-.panelUI-grid:not([customize-transitioning]) .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-multiline-text,
-.panelUI-grid:not([customize-transitioning]) .toolbarbutton-1 > .toolbarbutton-multiline-text {
+.panelUI-grid .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-multiline-text,
+.panelUI-grid .toolbarbutton-1 > .toolbarbutton-multiline-text {
   position: absolute;
   clip: rect(-0.1em, auto, 2.6em, auto);
 }
 
 .panelUI-grid .toolbarbutton-1 > .toolbarbutton-text,
 .panelUI-grid .toolbarbutton-1 > .toolbarbutton-multiline-text {
   text-align: center;
   /* Need to override toolkit theming which sets margin: 0 !important; */