Bug 1546309 - appmenu: remove the `toolbarbutton-appmenu` custom element. r=jorgk
authorPaul Morris <paul@paulwmorris.com>
Tue, 11 Jun 2019 16:43:29 -0400
changeset 35853 b9426afd27bf876545398412679bc0798a567e83
parent 35852 4ad0ea172c057fe9dc0f5489cda7e96eca46e8d9
child 35854 c358a56e279baa373a1b72cea747322f5ac78a88
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewersjorgk
bugs1546309
Bug 1546309 - appmenu: remove the `toolbarbutton-appmenu` custom element. r=jorgk It is not needed with the new appmenu.
calendar/lightning/content/lightning-item-panel.xul
calendar/lightning/content/lightning-toolbar.xul
mail/base/content/customElements.js
mail/base/content/mainMailToolbox.inc.xul
mail/base/content/toolbarbutton-appmenu.js
mail/base/jar.mn
mail/components/im/content/chat-messenger.inc.xul
--- a/calendar/lightning/content/lightning-item-panel.xul
+++ b/calendar/lightning/content/lightning-item-panel.xul
@@ -123,17 +123,17 @@
                  mode="full"
                  defaultmode="full"
                  iconsize="small"
                  defaulticonsize="small"
                  labelalign="end"
                  defaultlabelalign="end">
           <!-- more toolbarpalette items are added with an overlay -->
           <toolbarpalette id="event-toolbarpalette">
-            <toolbarbutton is="toolbarbutton-appmenu" id="calendar-item-appmenu-button"
+            <toolbarbutton id="calendar-item-appmenu-button"
                            type="menu"
                            class="toolbarbutton-1 button-appmenu"
                            label="&lightning.toolbar.appmenuButton.label;"
                            tooltiptext="&lightning.toolbar.appmenuButton1.tooltip;"/>
           </toolbarpalette>
           <!-- toolboxid is set here since we move the toolbar around for tabs -->
           <toolbar id="event-tab-toolbar"
                    toolbarname="&event.menu.view.toolbars.event.label;"
--- a/calendar/lightning/content/lightning-toolbar.xul
+++ b/calendar/lightning/content/lightning-toolbar.xul
@@ -112,17 +112,17 @@
                      label="&lightning.toolbar.print.label;"
                      tooltiptext="&lightning.toolbar.print.tooltip;"
                      observes="cmd_print"/>
       <toolbarbutton id="calendar-unifinder-button"
                      class="toolbarbutton-1 calbar-toolbarbutton-1"
                      label="&showUnifinderCmd.label;"
                      tooltiptext="&showUnifinderCmd.tooltip;"
                      observes="calendar_show_unifinder_command"/>
-      <toolbarbutton is="toolbarbutton-appmenu" id="calendar-appmenu-button"
+      <toolbarbutton id="calendar-appmenu-button"
                      type="menu"
                      class="toolbarbutton-1 button-appmenu"
                      label="&lightning.toolbar.appmenuButton.label;"
                      tooltiptext="&lightning.toolbar.appmenuButton1.tooltip;"/>
     </toolbarpalette>
 
     <toolbar id="calendar-toolbar2" class="inline-toolbar chromeclass-toolbar"
              toolbarname="&lightning.toolbar.calendar.name;"
@@ -169,17 +169,17 @@
                      label="&lightning.toolbar.delete.label;"
                      tooltiptext="&lightning.toolbar.delete.tooltip;"
                      observes="calendar_delete_focused_item_command"/>
       <toolbarbutton id="task-print-button"
                      class="toolbarbutton-1 calbar-toolbarbutton-1"
                      label="&lightning.toolbar.print.label;"
                      tooltiptext="&lightning.toolbar.print.tooltip;"
                      observes="cmd_print"/>
-      <toolbarbutton is="toolbarbutton-appmenu" id="task-appmenu-button"
+      <toolbarbutton id="task-appmenu-button"
                      type="menu"
                      class="toolbarbutton-1 button-appmenu"
                      label="&lightning.toolbar.appmenuButton.label;"
                      tooltiptext="&lightning.toolbar.appmenuButton1.tooltip;"/>
     </toolbarpalette>
 
     <toolbar id="task-toolbar2" class="inline-toolbar chromeclass-toolbar"
              toolbarname="&lightning.toolbar.task.name;"
--- a/mail/base/content/customElements.js
+++ b/mail/base/content/customElements.js
@@ -15,14 +15,13 @@ if (!isDummyDocument) {
     "chrome://chat/content/conversation-browser.js",
     "chrome://messenger/content/mailWidgets.js",
     "chrome://messenger/content/generalBindings.js",
     "chrome://messenger/content/statuspanel.js",
     "chrome://messenger/content/foldersummary.js",
     "chrome://messenger/content/addressbook/menulist-addrbooks.js",
     "chrome://messenger/content/folder-menupopup.js",
     "chrome://messenger/content/toolbarbutton-menu-button.js",
-    "chrome://messenger/content/toolbarbutton-appmenu.js",
   ]) {
     Services.scriptloader.loadSubScript(script, window);
   }
 }
 })();
--- a/mail/base/content/mainMailToolbox.inc.xul
+++ b/mail/base/content/mainMailToolbox.inc.xul
@@ -307,17 +307,17 @@
                  mousethrough="always">
        <image/>
     </toolbaritem>
     <toolbarbutton id="button-stop"
                    class="toolbarbutton-1"
                    label="&stopButton.label;"
                    tooltiptext="&stopButton.tooltip;"
                    command="cmd_stop"/>
-    <toolbarbutton is="toolbarbutton-appmenu" id="button-appmenu"
+    <toolbarbutton id="button-appmenu"
                    type="menu"
                    class="toolbarbutton-1 button-appmenu"
                    label="&appmenuButton.label;"
                    tooltiptext="&appmenuButton1.tooltip;"/>
 #ifdef MAIN_WINDOW
     <!-- gloda search widget; provides global (message) searching.  -->
     <toolbaritem id="gloda-search" insertafter="button-stop"
                  title="&glodaSearch.title;"
deleted file mode 100644
--- a/mail/base/content/toolbarbutton-appmenu.js
+++ /dev/null
@@ -1,53 +0,0 @@
-/* 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/. */
-
-"use strict";
-
-/* global MozXULElement */
-
-// Wrap in a block to prevent leaking to window scope.
-{
-  /**
-   * The MozToolbarButtonAppmenu is a toolbarbutton to display an appmenu
-   * (a.k.a. hamburger menu) button.
-   *
-   * @extends MozToolbarbutton
-   */
-  class MozToolbarButtonAppmenu extends customElements.get("toolbarbutton") {
-    constructor() {
-      super();
-      // While it would seem we could do this by handling oncommand, we can't
-      // because any external oncommand handlers might get called before ours,
-      // and then they would see the incorrect value of checked. Additionally
-      // a command attribute would redirect the command events anyway.
-      // Also, the appmenu-popup needs to be appended to the target 'Hamburger
-      // button' dynamically at every button click (as opposed to appended
-      // once in the binding's constructor) otherwise only one of the four
-      // Hamburger buttons (on the Mail, Calendar, Tasks and Chat tabs) will
-      // get the popup menu (namely, Mail). See Bug 890332.
-      this.addEventListener("mousedown", (event) => {
-        if (event.button != 0) {
-          return;
-        }
-        this._setupAppmenu(event);
-      });
-
-      this.addEventListener("keypress", (event) => {
-        this._setupAppmenu(event);
-      });
-    }
-
-    _setupAppmenu(event) {
-      if (event.target == this) {
-        let appmenuPopup = document.getElementById("appmenu-popup");
-        if (this.lastChild != appmenuPopup) {
-          this.appendChild(appmenuPopup);
-        }
-      }
-    }
-  }
-  customElements.define("toolbarbutton-appmenu",
-    MozToolbarButtonAppmenu, { extends: "toolbarbutton" }
-  );
-}
--- a/mail/base/jar.mn
+++ b/mail/base/jar.mn
@@ -24,17 +24,16 @@ messenger.jar:
 *   content/messenger/messenger.xul                 (content/messenger.xul)
 *   content/messenger/hiddenWindow.xul              (content/hiddenWindow.xul)
     content/messenger/hiddenWindow.js               (content/hiddenWindow.js)
     content/messenger/msgHdrView.js                 (content/msgHdrView.js)
     content/messenger/msgViewNavigation.js          (content/msgViewNavigation.js)
     content/messenger/mailWidgets.js                (content/mailWidgets.js)
     content/messenger/button-menu-button.js         (content/button-menu-button.js)
     content/messenger/toolbarbutton-menu-button.js  (content/toolbarbutton-menu-button.js)
-    content/messenger/toolbarbutton-appmenu.js      (content/toolbarbutton-appmenu.js)
     content/messenger/customElements.js             (content/customElements.js)
     content/messenger/customizeToolbar.css          (../../common/src/customizeToolbar.css)
     content/messenger/customizeToolbar.js           (../../common/src/customizeToolbar.js)
 *   content/messenger/customizeToolbar.xul          (../../common/src/customizeToolbar.xul)
     content/messenger/viewSource.js                 (../../common/src/viewSource.js)
 *   content/messenger/viewSource.xul                (../../common/src/viewSource.xul)
     content/messenger/viewZoomOverlay.js            (../../common/src/viewZoomOverlay.js)
     content/messenger/generalBindings.js            (../../common/bindings/generalBindings.js)
--- a/mail/components/im/content/chat-messenger.inc.xul
+++ b/mail/components/im/content/chat-messenger.inc.xul
@@ -68,17 +68,17 @@
                          autocompletesearchparam="global"
                          timeout="200"
                          maxlength="192"
                          placeholder=""
                          emptytextbase="&search.label.base1;"
                          keyLabelNonMac="&search.keyLabel.nonmac;"
                          keyLabelMac="&search.keyLabel.mac;"/>
               </toolbaritem>
-              <toolbarbutton is="toolbarbutton-appmenu" id="button-chat-appmenu"
+              <toolbarbutton id="button-chat-appmenu"
                              type="menu"
                              class="toolbarbutton-1 button-appmenu"
                              label="&appmenuButton.label;"
                              tooltiptext="&appmenuButton1.tooltip;"/>
             </toolbarpalette>
             <toolbarset id="customChatToolbars" context="chat-toolbar-context-menu"/>
           </toolbox>