Bug 1509488 - Use keydown handler instead of <key> for Shift+Ctrl+Tab. r=jaws a=jcristau
authorDão Gottwald <dao@mozilla.com>
Mon, 26 Nov 2018 16:07:07 +0000
changeset 501409 307b6790d4109a19d88a529fead1337e48f4656f
parent 501408 390cd25cecd6b5c73d33b842522a0a789affbe00
child 501410 768deaa64acac6b713d21296122feb96725d9993
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, jcristau
bugs1509488
milestone64.0
Bug 1509488 - Use keydown handler instead of <key> for Shift+Ctrl+Tab. r=jaws a=jcristau Differential Revision: https://phabricator.services.mozilla.com/D12744
browser/base/content/browser-ctrlTab.js
browser/base/content/browser-sets.inc
--- a/browser/base/content/browser-ctrlTab.js
+++ b/browser/base/content/browser-ctrlTab.js
@@ -425,35 +425,40 @@ var ctrlTab = {
     for (let preview of this.previews) {
       this.updatePreview(preview, null);
     }
   },
 
   onKeyDown(event) {
     if (event.keyCode != event.DOM_VK_TAB ||
         !event.ctrlKey ||
-        !this.isOpen && event.shiftKey ||
         event.altKey ||
         event.metaKey) {
       return;
     }
 
     event.preventDefault();
     event.stopPropagation();
 
     if (this.isOpen) {
       this.advanceFocus(!event.shiftKey);
-    } else {
-      let tabs = gBrowser.visibleTabs;
-      if (tabs.length > 2) {
-        this.open();
-      } else if (tabs.length == 2) {
-        let index = tabs[0].selected ? 1 : 0;
-        gBrowser.selectedTab = tabs[index];
-      }
+      return;
+    }
+
+    if (event.shiftKey) {
+      this.showAllTabs();
+      return;
+    }
+
+    let tabs = gBrowser.visibleTabs;
+    if (tabs.length > 2) {
+      this.open();
+    } else if (tabs.length == 2) {
+      let index = tabs[0].selected ? 1 : 0;
+      gBrowser.selectedTab = tabs[index];
     }
   },
 
   onKeyPress(event) {
     if (!this.isOpen ||
         !event.ctrlKey) {
       return;
     }
@@ -588,18 +593,10 @@ var ctrlTab = {
       PageThumbs.addExpirationFilter(this);
     else
       PageThumbs.removeExpirationFilter(this);
 
     // If we're not running, hide the "Show All Tabs" menu item,
     // as Shift+Ctrl+Tab will be handled by the tab bar.
     document.getElementById("menu_showAllTabs").hidden = !enable;
     document.getElementById("menu_viewPopup")[toggleEventListener]("popupshowing", this);
-
-    // Also disable the <key> to ensure Shift+Ctrl+Tab never triggers
-    // Show All Tabs.
-    var key_showAllTabs = document.getElementById("key_showAllTabs");
-    if (enable)
-      key_showAllTabs.removeAttribute("disabled");
-    else
-      key_showAllTabs.setAttribute("disabled", "true");
   },
 };
--- a/browser/base/content/browser-sets.inc
+++ b/browser/base/content/browser-sets.inc
@@ -263,17 +263,17 @@
     <key id="key_fullZoomReduce"  key="&fullZoomReduceCmd.commandkey;"   command="cmd_fullZoomReduce"  modifiers="accel"/>
     <key                          key="&fullZoomReduceCmd.commandkey2;"  command="cmd_fullZoomReduce"  modifiers="accel"/>
     <key id="key_fullZoomEnlarge" key="&fullZoomEnlargeCmd.commandkey;"  command="cmd_fullZoomEnlarge" modifiers="accel"/>
     <key                          key="&fullZoomEnlargeCmd.commandkey2;" command="cmd_fullZoomEnlarge" modifiers="accel"/>
     <key                          key="&fullZoomEnlargeCmd.commandkey3;" command="cmd_fullZoomEnlarge" modifiers="accel"/>
     <key id="key_fullZoomReset"   key="&fullZoomResetCmd.commandkey;"    command="cmd_fullZoomReset"   modifiers="accel"/>
     <key                          key="&fullZoomResetCmd.commandkey2;"   command="cmd_fullZoomReset"   modifiers="accel"/>
 
-    <key id="key_showAllTabs" command="Browser:ShowAllTabs" keycode="VK_TAB" modifiers="control,shift" disabled="true"/>
+    <key id="key_showAllTabs" keycode="VK_TAB" modifiers="control,shift"/>
 
     <key id="key_switchTextDirection" key="&bidiSwitchTextDirectionItem.commandkey;" command="cmd_switchTextDirection" modifiers="accel,shift" />
 
     <key id="key_privatebrowsing" command="Tools:PrivateBrowsing" key="&privateBrowsingCmd.commandkey;"
          modifiers="accel,shift" reserved="true"/>
     <key id="key_sanitize" command="Tools:Sanitize" keycode="VK_DELETE" modifiers="accel,shift"/>
 #ifdef XP_MACOSX
     <key id="key_sanitize_mac" command="Tools:Sanitize" keycode="VK_BACK" modifiers="accel,shift"/>