Bug 673878 Use SHIFT+DOMMouseScroll to advance the selected tab r=Neil.
authorPhilip Chee <philip.chee@gmail.com>
Fri, 16 Sep 2011 16:23:24 +0800
changeset 8500 5298d97973c4
parent 8499 3a0e7fdf8b1c
child 8501 d31c11953f75
push id6526
push userphilip.chee@gmail.com
push dateFri, 16 Sep 2011 08:26:26 +0000
treeherdercomm-central@d31c11953f75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil
bugs673878
Bug 673878 Use SHIFT+DOMMouseScroll to advance the selected tab r=Neil. This will allow plain DOMMouseScroll to scroll the tabbar without changing the selected tab.
suite/browser/browser-prefs.js
suite/browser/tabbrowser.xml
--- a/suite/browser/browser-prefs.js
+++ b/suite/browser/browser-prefs.js
@@ -279,16 +279,21 @@ pref("browser.tabs.tabClipWidth", 140);
 
 // Where to show tab close buttons:
 // 0  on active tab only
 // 1  on all tabs until tabClipWidth is reached, then active tab only
 // 2  no close buttons at all
 // 3  at the end of the tabstrip
 pref("browser.tabs.closeButtons", 3);
 
+// Mouse wheel action when over the tab bar:
+// false  The mouse wheel scrolls the whole tab bar like Firefox (default).
+// true   The mouse wheel advances the selected tab.
+pref("browser.tabs.mouseScrollAdvancesTab", false);
+
 // lets new tab/window load something different than first window
 // -1 - use navigator startup preference
 //  0 - loads blank page
 //  1 - loads home page
 //  2 - loads last page visited
 pref("browser.tabs.loadOnNewTab", 0);
 pref("browser.windows.loadOnNewWindow", 1);
 
@@ -723,16 +728,22 @@ pref("ui.use_activity_cursor", true);
 // Use a sheet instead of a popup window for the customize toolbar UI
 pref("toolbar.customization.usesheet", true);
 #endif
 
 #ifndef XP_MACOSX
 #ifdef XP_UNIX
 // For the download dialog
 pref("browser.download.progressDnldDialog.enable_launch_reveal_buttons", false);
+
+// Mouse wheel action when over the tab bar:
+// false  The mouse wheel scrolls the whole tab bar like Firefox.
+// true   The mouse wheel advances the selected tab.
+pref("browser.tabs.mouseScrollAdvancesTab", true);
+
 pref("browser.urlbar.clickSelectsAll", false);
 
 // 0 goes back
 // 1 act like pgup
 // 2 and other values, nothing
 pref("browser.backspace_action", 2);
 
 pref("general.autoScroll", false);
--- a/suite/browser/tabbrowser.xml
+++ b/suite/browser/tabbrowser.xml
@@ -3121,32 +3121,44 @@
              * if a tab was inserted to the overflow area or removed from it
              * without any scrolling and when the tabbar has already
              * overflowed.
              */
             this.mTabstrip._updateScrollButtonsDisabledState();
           ]]>
         </body>
       </method>
+
+      <method name="_handleMouseScroll">
+        <parameter name="aEvent"/>
+        <body>
+          <![CDATA[
+            // Javascript does not have a logical XOR operator.
+            if (aEvent.shiftKey != this.mPrefs.getBoolPref("browser.tabs.mouseScrollAdvancesTab")) {
+              this.advanceSelectedTab(aEvent.detail < 0 ? -1 : 1);
+              aEvent.stopPropagation();
+            }
+          ]]>
+        </body>
+      </method>
     </implementation>
 
     <handlers>
       <handler event="TabSelect" action="this._handleTabSelect();"/>
 
       <handler event="transitionend">
         <![CDATA[
           if (event.propertyName == "max-width")
             this._handleNewTab(event.target);
         ]]>
       </handler>
 
       <handler event="DOMMouseScroll" phase="capturing">
         <![CDATA[
-          this.advanceSelectedTab(event.detail < 0 ? -1 : 1);
-          event.stopPropagation();
+          this._handleMouseScroll(event);
         ]]>
       </handler>
     </handlers>
   </binding>
 
   <binding id="tabbrowser-alltabs-popup"
            extends="chrome://global/content/bindings/popup.xml#popup">
     <implementation implements="nsIDOMEventListener">