Bug 1650404, rely on panelUI to add "PanelUI-subView" attribute r=Gijs
authorEmma Malysz <emalysz@mozilla.com>
Thu, 09 Jul 2020 14:30:27 +0000
changeset 539613 e7bb5cb77c6caea59d8c6dc958edf7fe8d14aea3
parent 539612 6468f2d9b8aec7e0dc039da130e5501f3034bb3f
child 539614 9d79558bb724e5855130bd6c33ad7bb8718345d5
push id121227
push userrmaries@mozilla.com
push dateThu, 09 Jul 2020 14:35:04 +0000
treeherderautoland@e7bb5cb77c6c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1650404
milestone80.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1650404, rely on panelUI to add "PanelUI-subView" attribute r=Gijs Differential Revision: https://phabricator.services.mozilla.com/D82808
browser/components/customizableui/CustomizableUI.jsm
browser/components/customizableui/content/panelUI.js
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -1752,34 +1752,19 @@ var CustomizableUIInternal = {
       // If the widget has a view, and has view showing / hiding listeners,
       // hook those up to this widget.
       if (aWidget.type == "view") {
         log.debug(
           "Widget " +
             aWidget.id +
             " has a view. Auto-registering event handlers."
         );
-        let viewNode = PanelMultiView.getViewNode(aDocument, aWidget.viewId);
-
-        if (viewNode) {
-          // PanelUI relies on the .PanelUI-subView class to be able to show only
-          // one sub-view at a time.
-          viewNode.classList.add("PanelUI-subView");
-          if (aWidget.source == CustomizableUI.SOURCE_BUILTIN) {
-            nodeClasses.push("subviewbutton-nav");
-          }
-          this.ensureSubviewListeners(viewNode);
-        } else {
-          log.error(
-            "Could not find the view node with id: " +
-              aWidget.viewId +
-              ", for widget: " +
-              aWidget.id +
-              "."
-          );
+
+        if (aWidget.source == CustomizableUI.SOURCE_BUILTIN) {
+          nodeClasses.push("subviewbutton-nav");
         }
 
         let keyPressHandler = this.handleWidgetKeyPress.bind(
           this,
           aWidget,
           node
         );
         node.addEventListener("keypress", keyPressHandler);
--- a/browser/components/customizableui/content/panelUI.js
+++ b/browser/components/customizableui/content/panelUI.js
@@ -485,17 +485,17 @@ const PanelUI = {
       );
 
       let multiView = document.createXULElement("panelmultiview");
       multiView.setAttribute("id", "customizationui-widget-multiview");
       multiView.setAttribute("viewCacheId", "appMenu-viewCache");
       multiView.setAttribute("mainViewId", viewNode.id);
       multiView.appendChild(viewNode);
       tempPanel.appendChild(multiView);
-      viewNode.classList.add("cui-widget-panelview");
+      viewNode.classList.add("cui-widget-panelview", "PanelUI-subView");
 
       let viewShown = false;
       let panelRemover = () => {
         viewNode.classList.remove("cui-widget-panelview");
         if (viewShown) {
           CustomizableUI.removePanelCloseListeners(tempPanel);
           tempPanel.removeEventListener("popuphidden", panelRemover);
         }