Bug 198964 - Enable smooth scrolling by default. r=gavin
authorJared Wein <jwein@mozilla.com>
Fri, 13 Jan 2012 16:26:34 -0800
changeset 85776 f7c8c8ee3fad1d0812b05857db00cf22632ff685
parent 85775 b8281fe1b926a7089efa196522257e6bd82e578c
child 85777 7f728aef5ad85bc06bb6502931e2a75d0299edfe
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin
bugs198964
milestone12.0a1
Bug 198964 - Enable smooth scrolling by default. r=gavin
browser/app/profile/firefox.js
content/events/test/test_bug350471.xul
content/events/test/test_bug574663.html
docshell/test/navigation/test_bug430723.html
editor/libeditor/base/tests/test_selection_move_commands.xul
editor/libeditor/html/tests/test_bug549262.html
editor/libeditor/html/tests/test_bug620906.html
layout/generic/test/test_bug633762.html
toolkit/content/tests/chrome/test_mousescroll.xul
widget/tests/window_bug478536.xul
widget/tests/window_wheeltransaction.xul
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -232,17 +232,17 @@ pref("lightweightThemes.update.enabled",
 pref("keyword.enabled", true);
 // Override the default keyword.URL. Empty value means
 // "use the search service's default engine"
 pref("keyword.URL", "");
 
 pref("general.useragent.locale", "@AB_CD@");
 pref("general.skins.selectedSkin", "classic/1.0");
 
-pref("general.smoothScroll", false);
+pref("general.smoothScroll", true);
 #ifdef UNIX_BUT_NOT_MAC
 pref("general.autoScroll", false);
 #else
 pref("general.autoScroll", true);
 #endif
 
 // Whether or not the application should check at startup each time if it 
 // is the default browser.
--- a/content/events/test/test_bug350471.xul
+++ b/content/events/test/test_bug350471.xul
@@ -17,18 +17,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none">
 </div>
 </body>
 
 <script class="testbody" type="application/javascript;version=1.7"><![CDATA[
 
 /** Test for Bug 350471 **/
 
-// This test depends on general.smoothScroll being off.
-
 const minLineHeight = 10, maxLineHeight = 20;
 
 function between(x, min, max) (min <= max) ? (min <= x && x <= max) : (max <= x && x <= min);
 function isbetween(x, min, max, msg) ok(between(x, min, max), msg + " - Expected " + min + " to " + max + ", got " + x);
 
 function testEventDispatching(aWin) {
   function helper(aAxis, aDelta, aKind, aShiftKey, aCtrlKey, aAltKey, aMetaKey) {
     let expectedEvents = [];
@@ -223,28 +221,28 @@ function testDefaultHandling(aWin, andTh
 function initPrefs()
 {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
                   getService(Components.interfaces.nsIPrefBranch2);
   // Disables the app level scroll acceleration
   prefSvc.setIntPref("mousewheel.acceleration.start", -1);
   prefSvc.setBoolPref("mousewheel.system_scroll_override_on_root_content.enabled", false);
+  prefSvc.setBoolPref("general.smoothScroll", false);
 }
 
 function clearPrefs()
 {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
                   getService(Components.interfaces.nsIPrefBranch2);
 
-  if (prefSvc.prefHasUserValue("mousewheel.acceleration.start"))
-    prefSvc.clearUserPref("mousewheel.acceleration.start");
-  if (prefSvc.prefHasUserValue("mousewheel.system_scroll_override_on_root_content.enabled"))
-    prefSvc.clearUserPref("mousewheel.system_scroll_override_on_root_content.enabled");
+  prefSvc.clearUserPref("mousewheel.acceleration.start");
+  prefSvc.clearUserPref("mousewheel.system_scroll_override_on_root_content.enabled");
+  prefSvc.clearUserPref("general.smoothScroll");
 }
 
 window.onload = function () {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 
   let win = window.open('data:application/vnd.mozilla.xul+xml,<?xml version="1.0"?><?xml-stylesheet href="chrome://global/skin" type="text/css"?><window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"><vbox style="height: 150px; background: cyan; overflow: auto;" id="scrollbox"><hbox style="height: 8000px;"><vbox style="width: 8000px;"/></hbox></vbox></window>', '_blank', 'chrome,width=400,height=200');
   win.onload = function() {
     setTimeout(function() {
--- a/content/events/test/test_bug574663.html
+++ b/content/events/test/test_bug574663.html
@@ -15,18 +15,16 @@ https://bugzilla.mozilla.org/show_bug.cg
 <div id="content" style="display: none">
 
 </div>
 <pre id="test">
 <script type="application/javascript;version=1.7">
 
 /** Test for Bug 574663 **/
 
-// This test depends on general.smoothScroll being off.
-
 function sendTouchpadScrollMotion(scrollbox, direction, ctrl, momentum) {
   var win = scrollbox.ownerDocument.defaultView;
   let event = {
     'type': "DOMMouseScroll",
     'axis': "vertical",
     'delta': direction,
     'hasPixels': true,
     'ctrlKey': ctrl,
@@ -102,35 +100,34 @@ function runTest() {
   }, win);
 }
 
 function initPrefs()
 {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
                   getService(Components.interfaces.nsIPrefBranch2);
+  prefSvc.setBoolPref("general.smoothScroll", false);
   // Disables the app level scroll acceleration
   prefSvc.setIntPref("mousewheel.acceleration.start", -1);
   prefSvc.setBoolPref("mousewheel.system_scroll_override_on_root_content.enabled", false);
   // Enable zooming for ctrl-scrolling
   prefSvc.setIntPref("mousewheel.withcontrolkey.action", 3);
 }
 
 function clearPrefs()
 {
   netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
                   getService(Components.interfaces.nsIPrefBranch2);
 
-  if (prefSvc.prefHasUserValue("mousewheel.acceleration.start"))
-    prefSvc.clearUserPref("mousewheel.acceleration.start");
-  if (prefSvc.prefHasUserValue("mousewheel.system_scroll_override_on_root_content.enabled"))
-    prefSvc.clearUserPref("mousewheel.system_scroll_override_on_root_content.enabled");
-  if (prefSvc.prefHasUserValue("mousewheel.withcontrolkey.action"))
-    prefSvc.clearUserPref("mousewheel.withcontrolkey.action");
+  prefSvc.clearUserPref("general.smoothScroll");
+  prefSvc.clearUserPref("mousewheel.acceleration.start");
+  prefSvc.clearUserPref("mousewheel.system_scroll_override_on_root_content.enabled");
+  prefSvc.clearUserPref("mousewheel.withcontrolkey.action");
 }
 
 window.onload = function () {
   initPrefs();
   SimpleTest.executeSoon(runTest);
 }
 
 SimpleTest.waitForExplicitFinish();
--- a/docshell/test/navigation/test_bug430723.html
+++ b/docshell/test/navigation/test_bug430723.html
@@ -38,17 +38,19 @@ var gTallBlueBoxURI = "data:text/html;ch
 // </div></body></html>
 
 
 window.onload = runTest;
 
 var testWindow;
 var testNum = 0;
 
+var smoothScrollPref = "general.smoothScroll";
 function runTest() {
+  SpecialPowers.setBoolPref(smoothScrollPref, false);
   testWindow = window.open(gTallRedBoxURI, "testWindow", "width=300,height=300,location=yes,scrollbars=yes");
 }
 
 var nextTest =function() {
   testNum++;
   switch (testNum) {
     case 1: setTimeout(step1, 0); break;
     case 2: setTimeout(step2, 0); break;
@@ -117,16 +119,17 @@ var step3 =function() {
      "Page1Again: Ensure scroll pane at top before we scroll.");  
   testWindow.addEventListener("scroll", function () {
     testWindow.removeEventListener("scroll", arguments.callee, true);
 
     isnot(testWindow.document.body.scrollTop, 0,
           "Page2Again: Ensure we can still scroll.");  
 
     testWindow.close();
+    SpecialPowers.clearUserPref(smoothScrollPref);
     window.SimpleTest.finish();
   }, true);
   sendKey('DOWN', testWindow);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 //]]>
--- a/editor/libeditor/base/tests/test_selection_move_commands.xul
+++ b/editor/libeditor/base/tests/test_selection_move_commands.xul
@@ -4,16 +4,20 @@
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         title="Test for nsSelectionMoveCommands">
   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 
 <script class="testbody" type="application/javascript">
 <![CDATA[
 
+var prefs = Components.classes["@mozilla.org/preferences-service;1"]
+                      .getService(Components.interfaces.nsIPrefBranch);
+prefs.setBoolPref("general.smoothScroll", false);
+
 function runTest() {
   var tests = execTests();
   function execNext() {
     try {
       tests.next();
       setTimeout(execNext, 0);
     } catch (e) {}
   }
@@ -177,26 +181,24 @@ function execTests() {
 
     doCommand("cmd_moveTop");
     is(testPageSelectCommand("cmd_selectPageDown", 0), lineNum, "cmd_selectPageDown");
     doCommand("cmd_moveBottom");
     doCommand("cmd_beginLine");
     is(testPageSelectCommand("cmd_selectPageUp", 0), 22 - lineNum, "cmd_selectPageUp");
   }
 
-  var prefs = Components.classes["@mozilla.org/preferences-service;1"]
-                          .getService(Components.interfaces.nsIPrefBranch);
-  var origPrefValue = prefs.getBoolPref("layout.word_select.eat_space_to_next_word");
   try {
     prefs.setBoolPref("layout.word_select.eat_space_to_next_word", false);
     runSelectionTests(body, 1);
     prefs.setBoolPref("layout.word_select.eat_space_to_next_word", true);
     runSelectionTests(node(2), 0);
   } finally {
-    prefs.setBoolPref("layout.word_select.eat_space_to_next_word", origPrefValue);
+    prefs.clearUserPref("general.smoothScroll");
+    prefs.clearUserPref("layout.word_select.eat_space_to_next_word");
   }
 
   SimpleTest.finish();
 }
 
 SimpleTest.waitForExplicitFinish();
 addLoadEvent(runTest);
 ]]>
--- a/editor/libeditor/html/tests/test_bug549262.html
+++ b/editor/libeditor/html/tests/test_bug549262.html
@@ -14,16 +14,18 @@ https://bugzilla.mozilla.org/show_bug.cg
 <p id="display"></p>
 <div id="content">
 </div>
 <pre id="test">
 <script type="application/javascript">
 
 /** Test for Bug 549262 **/
 
+var smoothScrollPref = "general.smoothScroll";
+SpecialPowers.setBoolPref(smoothScrollPref, false);
 SimpleTest.waitForExplicitFinish();
 var win = window.open("file_bug549262.html", "_blank", 
                       "width=600,height=600,scrollbars=yes");
 SimpleTest.waitForFocus(function() {
   // Make sure that pressing Space when a contenteditable element is not focused
   // will scroll the page.
   var ed = win.document.getElementById("editor");
   var sc = win.document.querySelector("a");
@@ -85,16 +87,17 @@ SimpleTest.waitForFocus(function() {
                     oldY = win.scrollY;
                     synthesizeKey("VK_DOWN", {}, win);
                     setTimeout(function() {
                       is(win.scrollY, oldY, "Page is not scrolled down");
                       is(win.getSelection().focusNode, ed.firstChild, "Correct element selected");
                       is(win.getSelection().focusOffset, ed.textContent.length, "Selection should be moved to the end");
 
                       win.close();
+                      SpecialPowers.clearUserPref(smoothScrollPref);
                       SimpleTest.finish();
                     }, 0);
                   }, 0);
                 }, 0);
               }, 0);
             }, 0);
           }, 0);
         }, 0);
--- a/editor/libeditor/html/tests/test_bug620906.html
+++ b/editor/libeditor/html/tests/test_bug620906.html
@@ -29,20 +29,22 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 /** Test for Bug 620906 **/
 SimpleTest.waitForExplicitFinish();
 addLoadEvent(function() {
   var iframe = document.querySelector("iframe");
   is(iframe.contentWindow.scrollY, 0, "Sanity check");
   var rect = iframe.getBoundingClientRect();
   setTimeout(function() {
-    synthesizeMouse(iframe, rect.width - 5, rect.height / 2, {});
-    setTimeout(function() {
+    var onscroll = function () {
+      iframe.contentWindow.removeEventListener("scroll", onscroll, false);
       isnot(iframe.contentWindow.scrollY, 0, "The scrollbar should work");
       SimpleTest.finish();
-    }, 0);
+    }
+    iframe.contentWindow.addEventListener("scroll", onscroll, false);
+    synthesizeMouse(iframe, rect.width - 5, rect.height / 2, {});
   }, 0);
 });
 
 </script>
 </pre>
 </body>
 </html>
--- a/layout/generic/test/test_bug633762.html
+++ b/layout/generic/test/test_bug633762.html
@@ -37,18 +37,21 @@ function runTests() {
   sendKey("UP");
 
   setTimeout("finish();", 0);
 }
 
 function finish() {
   // assert that scroll top is now less than before
   ok(scrollTopBefore > doc.body.scrollTop, "pressing up arrow should scroll up");
+  SpecialPowers.clearUserPref(smoothScrollPref);
   SimpleTest.finish();
 }
 
+var smoothScrollPref = "general.smoothScroll";
+SpecialPowers.setBoolPref(smoothScrollPref, false);
 SimpleTest.waitForExplicitFinish();
 SimpleTest.waitForFocus(runTests);
 </script>
 </pre>
 
 </body>
 </html>
--- a/toolkit/content/tests/chrome/test_mousescroll.xul
+++ b/toolkit/content/tests/chrome/test_mousescroll.xul
@@ -68,16 +68,18 @@ https://bugzilla.mozilla.org/show_bug.cg
       <vbox style="width:100px; height:40px; background:black;"/>
   </arrowscrollbox>
 
   <!-- test code goes here -->
   <script type="application/javascript"><![CDATA[
 
 /** Test for Bug 378028 **/
 /*   and for Bug 350471 **/
+var smoothScrollPref = "general.smoothScroll";
+SpecialPowers.setBoolPref(smoothScrollPref, false);
 SimpleTest.waitForExplicitFinish();
 
 /* There are three kinds of scroll events:
     1. line scrolls without hasPixels
     2. line scrolls with hasPixels
     3. pixel scrolls
    Listboxes and arrowscrollboxes (DOM event scrolling) should only react to
    line scrolls and ignore hasPixels.
@@ -225,15 +227,16 @@ function testArrowScrollbox(id)
 }
 
 function runTests()
 {
   testRichListbox("richlistbox", function() {
     testListbox("listbox");
     testArrowScrollbox("hscrollbox");
     testArrowScrollbox("vscrollbox");
+    SpecialPowers.clearUserPref(smoothScrollPref);
     SimpleTest.finish();
   });
 }
 
 window.onload = function() { setTimeout(runTests, 0); };
   ]]></script>
 </window>
--- a/widget/tests/window_bug478536.xul
+++ b/widget/tests/window_bug478536.xul
@@ -73,19 +73,22 @@ var gTests = [
  { scrollToForward: false, shouldScroll: true },
  { scrollToForward: false, shouldScroll: false }
 ];
 var gCurrentTestIndex = -1;
 var gIgnoreScrollEvent = true;
 
 var gPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].
                getService(Components.interfaces.nsIPrefBranch2);
+const kPrefSmoothScroll = "general.smoothScroll";
 const kPrefNameTimeout = "mousewheel.transaction.timeout";
 const kDefaultTimeout = gPrefSvc.getIntPref(kPrefNameTimeout);
 
+gPrefSvc.setBoolPref(kPrefSmoothScroll, false);
+
 var gTimeout = kDefaultTimeout;
 
 gBody.addEventListener("MozMouseScrollFailed", onMouseScrollFailed, false);
 gBody.addEventListener("MozMouseScrollTransactionTimeout",
                        onTransactionTimeout, false);
 
 function setTimeoutPrefs(aTimeout)
 {
@@ -112,16 +115,17 @@ function onload()
   disableNonTestMouseEvents(true);
   setTimeout(runNextTest, 0);
 }
 
 function onunload()
 {
   resetTimeoutPrefs();
   disableNonTestMouseEvents(false);
+  gPrefSvc.clearUserPref(kPrefSmoothScroll);
   window.opener.wrappedJSObject.SimpleTest.finish();
 }
 
 function finish()
 {
   window.close();
 }
 
--- a/widget/tests/window_wheeltransaction.xul
+++ b/widget/tests/window_wheeltransaction.xul
@@ -105,21 +105,24 @@ var gLitesnEvents = kListenEvent_None;
  * only one timer at one time.  For that, we must store the timer id to this
  * variable.  And the functions which may be called via a timer must clear the
  * current timer by |_clearTimer| function.
  */
 var gTimer;
 
 var gPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].
                getService(Components.interfaces.nsIPrefBranch2);
+const kPrefSmoothScroll = "general.smoothScroll";
 const kPrefNameTimeout = "mousewheel.transaction.timeout";
 const kPrefNameIgnoreMoveDelay = "mousewheel.transaction.ignoremovedelay";
 
 const kDefaultTimeout = gPrefSvc.getIntPref(kPrefNameTimeout);
-const kDefaultIgnoreMoveDelay = gPrefSvc.getIntPref(kPrefNameIgnoreMoveDelay)
+const kDefaultIgnoreMoveDelay = gPrefSvc.getIntPref(kPrefNameIgnoreMoveDelay);
+
+gPrefSvc.setBoolPref(kPrefSmoothScroll, false);
 
 var gTimeout, gIgnoreMoveDelay;
 var gEnoughForTimeout, gEnoughForIgnoreMoveDelay;
 
 function setTimeoutPrefs(aTimeout, aIgnoreMoveDelay)
 {
   gPrefSvc.setIntPref(kPrefNameTimeout, aTimeout);
   gPrefSvc.setIntPref(kPrefNameIgnoreMoveDelay, aIgnoreMoveDelay);
@@ -166,16 +169,17 @@ function finish()
 function onload()
 {
   runNextTestList();
 }
 
 function onunload()
 {
   resetTimeoutPrefs();
+  gPrefSvc.clearUserPref(kPrefSmoothScroll);
   disableNonTestMouseEvents(false);
   window.opener.wrappedJSObject.SimpleTest.finish();
 }
 
 const kSubView1Offset = { x: 20, y: 20 };
 const kSubView2Offset = { x: 20, y: 20 + 100 + 20 };
 const kSubView3Offset = { x: 20, y: 20 + (100 + 20) * 2 };