Bug 1512493 - Make switching tabs by scrolling pref-controlled and off by default. r=stransky
authorDão Gottwald <dao@mozilla.com>
Wed, 09 Jan 2019 14:38:42 +0000
changeset 510160 52bc1477d801eebf61511e0071edc949dcdc1a36
parent 510159 068f7beef2c8bf034eb11e4de744644a615ca463
child 510161 45bb6ff923e9fb36b4a53cbdfa99d360e2d3e1a8
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersstransky
bugs1512493
milestone66.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 1512493 - Make switching tabs by scrolling pref-controlled and off by default. r=stransky Differential Revision: https://phabricator.services.mozilla.com/D16021
modules/libpref/init/all.js
toolkit/content/jar.mn
toolkit/content/widgets/tabbox.xml
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1075,16 +1075,18 @@ pref("toolkit.osfile.log", false);
 pref("toolkit.cosmeticAnimations.enabled", true);
 
 pref("toolkit.scrollbox.smoothScroll", true);
 pref("toolkit.scrollbox.scrollIncrement", 20);
 pref("toolkit.scrollbox.verticalScrollDistance", 3);
 pref("toolkit.scrollbox.horizontalScrollDistance", 5);
 pref("toolkit.scrollbox.clickToScroll.scrollDelay", 150);
 
+pref("toolkit.tabbox.switchByScrolling", false);
+
 // Telemetry settings.
 // Server to submit telemetry pings to.
 pref("toolkit.telemetry.server", "https://incoming.telemetry.mozilla.org");
 // Telemetry server owner. Please change if you set toolkit.telemetry.server to a different server
 pref("toolkit.telemetry.server_owner", "Mozilla");
 // Determines whether full SQL strings are returned when they might contain sensitive info
 // i.e. dynamically constructed SQL strings or SQL executed by addons against addon DBs
 pref("toolkit.telemetry.debugSlowSql", false);
--- a/toolkit/content/jar.mn
+++ b/toolkit/content/jar.mn
@@ -75,17 +75,17 @@ toolkit.jar:
    content/global/bindings/menu.xml            (widgets/menu.xml)
    content/global/bindings/menulist.xml        (widgets/menulist.xml)
    content/global/bindings/notification.xml    (widgets/notification.xml)
    content/global/bindings/popup.xml           (widgets/popup.xml)
    content/global/bindings/radio.xml           (widgets/radio.xml)
    content/global/bindings/richlistbox.xml     (widgets/richlistbox.xml)
    content/global/bindings/scrollbox.xml       (widgets/scrollbox.xml)
    content/global/bindings/spinner.js          (widgets/spinner.js)
-*  content/global/bindings/tabbox.xml          (widgets/tabbox.xml)
+   content/global/bindings/tabbox.xml          (widgets/tabbox.xml)
    content/global/bindings/text.xml            (widgets/text.xml)
 *  content/global/bindings/textbox.xml         (widgets/textbox.xml)
    content/global/bindings/timekeeper.js       (widgets/timekeeper.js)
    content/global/bindings/timepicker.js       (widgets/timepicker.js)
    content/global/bindings/toolbar.xml         (widgets/toolbar.xml)
    content/global/bindings/toolbarbutton.xml   (widgets/toolbarbutton.xml)
    content/global/bindings/tree.xml            (widgets/tree.xml)
    content/global/bindings/videocontrols.xml   (widgets/videocontrols.xml)
--- a/toolkit/content/widgets/tabbox.xml
+++ b/toolkit/content/widgets/tabbox.xml
@@ -133,16 +133,20 @@
         ]]></getter>
       </property>
 
       <!-- _tabbox is deprecated, it exists only for backwards compatibility. -->
       <field name="_tabbox" readonly="true"><![CDATA[
         this.tabbox;
       ]]></field>
 
+      <field name="_prefService" readonly="true"><![CDATA[
+        Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
+      ]]></field>
+
       <property name="selectedIndex">
         <getter>
         <![CDATA[
           const tabs = this.children;
           for (var i = 0; i < tabs.length; i++) {
             if (tabs[i].selected)
               return i;
           }
@@ -349,30 +353,30 @@
           tab.setAttribute("value", value);
           this.appendChild(tab);
           return tab;
         ]]>
         </body>
       </method>
     </implementation>
 
-#ifdef MOZ_WIDGET_GTK
     <handlers>
       <handler event="DOMMouseScroll">
       <![CDATA[
-        if (event.detail > 0)
-          this.advanceSelectedTab(1, false);
-        else
-          this.advanceSelectedTab(-1, false);
-
-        event.stopPropagation();
+        if (this._prefService.getBoolPref("toolkit.tabbox.switchByScrolling")) {
+          if (event.detail > 0) {
+            this.advanceSelectedTab(1, false);
+          } else {
+            this.advanceSelectedTab(-1, false);
+          }
+          event.stopPropagation();
+        }
       ]]>
       </handler>
     </handlers>
-#endif
   </binding>
 
   <binding id="tab"
            extends="chrome://global/content/bindings/general.xml#basetext">
     <content>
       <xul:hbox class="tab-middle box-inherit" xbl:inherits="align,dir,pack,orient,selected,visuallyselected" flex="1">
         <xul:image class="tab-icon"
                    xbl:inherits="validate,src=image"