Bug 198964 - Enable smooth scrolling by default. r=gavin

This commit is contained in:
Jared Wein 2012-01-13 16:26:34 -08:00
parent 8f44198d78
commit c3725ef355
11 changed files with 42 additions and 23 deletions

View File

@ -237,7 +237,7 @@ pref("keyword.URL", "");
pref("general.useragent.locale", "@AB_CD@"); pref("general.useragent.locale", "@AB_CD@");
pref("general.skins.selectedSkin", "classic/1.0"); pref("general.skins.selectedSkin", "classic/1.0");
pref("general.smoothScroll", false); pref("general.smoothScroll", true);
#ifdef UNIX_BUT_NOT_MAC #ifdef UNIX_BUT_NOT_MAC
pref("general.autoScroll", false); pref("general.autoScroll", false);
#else #else

View File

@ -22,8 +22,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=350471
/** Test for Bug 350471 **/ /** Test for Bug 350471 **/
// This test depends on general.smoothScroll being off.
const minLineHeight = 10, maxLineHeight = 20; const minLineHeight = 10, maxLineHeight = 20;
function between(x, min, max) (min <= max) ? (min <= x && x <= max) : (max <= x && x <= min); function between(x, min, max) (min <= max) ? (min <= x && x <= max) : (max <= x && x <= min);
@ -228,6 +226,7 @@ function initPrefs()
// Disables the app level scroll acceleration // Disables the app level scroll acceleration
prefSvc.setIntPref("mousewheel.acceleration.start", -1); prefSvc.setIntPref("mousewheel.acceleration.start", -1);
prefSvc.setBoolPref("mousewheel.system_scroll_override_on_root_content.enabled", false); prefSvc.setBoolPref("mousewheel.system_scroll_override_on_root_content.enabled", false);
prefSvc.setBoolPref("general.smoothScroll", false);
} }
function clearPrefs() function clearPrefs()
@ -236,10 +235,9 @@ function clearPrefs()
var prefSvc = Components.classes["@mozilla.org/preferences-service;1"]. var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch2); getService(Components.interfaces.nsIPrefBranch2);
if (prefSvc.prefHasUserValue("mousewheel.acceleration.start")) prefSvc.clearUserPref("mousewheel.acceleration.start");
prefSvc.clearUserPref("mousewheel.acceleration.start"); prefSvc.clearUserPref("mousewheel.system_scroll_override_on_root_content.enabled");
if (prefSvc.prefHasUserValue("mousewheel.system_scroll_override_on_root_content.enabled")) prefSvc.clearUserPref("general.smoothScroll");
prefSvc.clearUserPref("mousewheel.system_scroll_override_on_root_content.enabled");
} }
window.onload = function () { window.onload = function () {

View File

@ -20,8 +20,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=574663
/** Test for Bug 574663 **/ /** Test for Bug 574663 **/
// This test depends on general.smoothScroll being off.
function sendTouchpadScrollMotion(scrollbox, direction, ctrl, momentum) { function sendTouchpadScrollMotion(scrollbox, direction, ctrl, momentum) {
var win = scrollbox.ownerDocument.defaultView; var win = scrollbox.ownerDocument.defaultView;
let event = { let event = {
@ -107,6 +105,7 @@ function initPrefs()
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var prefSvc = Components.classes["@mozilla.org/preferences-service;1"]. var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch2); getService(Components.interfaces.nsIPrefBranch2);
prefSvc.setBoolPref("general.smoothScroll", false);
// Disables the app level scroll acceleration // Disables the app level scroll acceleration
prefSvc.setIntPref("mousewheel.acceleration.start", -1); prefSvc.setIntPref("mousewheel.acceleration.start", -1);
prefSvc.setBoolPref("mousewheel.system_scroll_override_on_root_content.enabled", false); prefSvc.setBoolPref("mousewheel.system_scroll_override_on_root_content.enabled", false);
@ -120,12 +119,10 @@ function clearPrefs()
var prefSvc = Components.classes["@mozilla.org/preferences-service;1"]. var prefSvc = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch2); getService(Components.interfaces.nsIPrefBranch2);
if (prefSvc.prefHasUserValue("mousewheel.acceleration.start")) prefSvc.clearUserPref("general.smoothScroll");
prefSvc.clearUserPref("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.system_scroll_override_on_root_content.enabled"); prefSvc.clearUserPref("mousewheel.withcontrolkey.action");
if (prefSvc.prefHasUserValue("mousewheel.withcontrolkey.action"))
prefSvc.clearUserPref("mousewheel.withcontrolkey.action");
} }
window.onload = function () { window.onload = function () {

View File

@ -43,7 +43,9 @@ window.onload = runTest;
var testWindow; var testWindow;
var testNum = 0; var testNum = 0;
var smoothScrollPref = "general.smoothScroll";
function runTest() { function runTest() {
SpecialPowers.setBoolPref(smoothScrollPref, false);
testWindow = window.open(gTallRedBoxURI, "testWindow", "width=300,height=300,location=yes,scrollbars=yes"); testWindow = window.open(gTallRedBoxURI, "testWindow", "width=300,height=300,location=yes,scrollbars=yes");
} }
@ -122,6 +124,7 @@ var step3 =function() {
"Page2Again: Ensure we can still scroll."); "Page2Again: Ensure we can still scroll.");
testWindow.close(); testWindow.close();
SpecialPowers.clearUserPref(smoothScrollPref);
window.SimpleTest.finish(); window.SimpleTest.finish();
}, true); }, true);
sendKey('DOWN', testWindow); sendKey('DOWN', testWindow);

View File

@ -9,6 +9,10 @@
<script class="testbody" type="application/javascript"> <script class="testbody" type="application/javascript">
<![CDATA[ <![CDATA[
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("general.smoothScroll", false);
function runTest() { function runTest() {
var tests = execTests(); var tests = execTests();
function execNext() { function execNext() {
@ -182,16 +186,14 @@ function execTests() {
is(testPageSelectCommand("cmd_selectPageUp", 0), 22 - lineNum, "cmd_selectPageUp"); 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 { try {
prefs.setBoolPref("layout.word_select.eat_space_to_next_word", false); prefs.setBoolPref("layout.word_select.eat_space_to_next_word", false);
runSelectionTests(body, 1); runSelectionTests(body, 1);
prefs.setBoolPref("layout.word_select.eat_space_to_next_word", true); prefs.setBoolPref("layout.word_select.eat_space_to_next_word", true);
runSelectionTests(node(2), 0); runSelectionTests(node(2), 0);
} finally { } 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.finish();

View File

@ -19,6 +19,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=549262
/** Test for Bug 549262 **/ /** Test for Bug 549262 **/
var smoothScrollPref = "general.smoothScroll";
SpecialPowers.setBoolPref(smoothScrollPref, false);
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
var win = window.open("file_bug549262.html", "_blank", var win = window.open("file_bug549262.html", "_blank",
"width=600,height=600,scrollbars=yes"); "width=600,height=600,scrollbars=yes");
@ -90,6 +92,7 @@ SimpleTest.waitForFocus(function() {
is(win.getSelection().focusOffset, ed.textContent.length, "Selection should be moved to the end"); is(win.getSelection().focusOffset, ed.textContent.length, "Selection should be moved to the end");
win.close(); win.close();
SpecialPowers.clearUserPref(smoothScrollPref);
SimpleTest.finish(); SimpleTest.finish();
}, 0); }, 0);
}, 0); }, 0);

View File

@ -34,11 +34,13 @@ addLoadEvent(function() {
is(iframe.contentWindow.scrollY, 0, "Sanity check"); is(iframe.contentWindow.scrollY, 0, "Sanity check");
var rect = iframe.getBoundingClientRect(); var rect = iframe.getBoundingClientRect();
setTimeout(function() { setTimeout(function() {
synthesizeMouse(iframe, rect.width - 5, rect.height / 2, {}); var onscroll = function () {
setTimeout(function() { iframe.contentWindow.removeEventListener("scroll", onscroll, false);
isnot(iframe.contentWindow.scrollY, 0, "The scrollbar should work"); isnot(iframe.contentWindow.scrollY, 0, "The scrollbar should work");
SimpleTest.finish(); SimpleTest.finish();
}, 0); }
iframe.contentWindow.addEventListener("scroll", onscroll, false);
synthesizeMouse(iframe, rect.width - 5, rect.height / 2, {});
}, 0); }, 0);
}); });

View File

@ -42,9 +42,12 @@ function runTests() {
function finish() { function finish() {
// assert that scroll top is now less than before // assert that scroll top is now less than before
ok(scrollTopBefore > doc.body.scrollTop, "pressing up arrow should scroll up"); ok(scrollTopBefore > doc.body.scrollTop, "pressing up arrow should scroll up");
SpecialPowers.clearUserPref(smoothScrollPref);
SimpleTest.finish(); SimpleTest.finish();
} }
var smoothScrollPref = "general.smoothScroll";
SpecialPowers.setBoolPref(smoothScrollPref, false);
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(runTests); SimpleTest.waitForFocus(runTests);
</script> </script>

View File

@ -73,6 +73,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=378028
/** Test for Bug 378028 **/ /** Test for Bug 378028 **/
/* and for Bug 350471 **/ /* and for Bug 350471 **/
var smoothScrollPref = "general.smoothScroll";
SpecialPowers.setBoolPref(smoothScrollPref, false);
SimpleTest.waitForExplicitFinish(); SimpleTest.waitForExplicitFinish();
/* There are three kinds of scroll events: /* There are three kinds of scroll events:
@ -230,6 +232,7 @@ function runTests()
testListbox("listbox"); testListbox("listbox");
testArrowScrollbox("hscrollbox"); testArrowScrollbox("hscrollbox");
testArrowScrollbox("vscrollbox"); testArrowScrollbox("vscrollbox");
SpecialPowers.clearUserPref(smoothScrollPref);
SimpleTest.finish(); SimpleTest.finish();
}); });
} }

View File

@ -78,9 +78,12 @@ var gIgnoreScrollEvent = true;
var gPrefSvc = Components.classes["@mozilla.org/preferences-service;1"]. var gPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch2); getService(Components.interfaces.nsIPrefBranch2);
const kPrefSmoothScroll = "general.smoothScroll";
const kPrefNameTimeout = "mousewheel.transaction.timeout"; const kPrefNameTimeout = "mousewheel.transaction.timeout";
const kDefaultTimeout = gPrefSvc.getIntPref(kPrefNameTimeout); const kDefaultTimeout = gPrefSvc.getIntPref(kPrefNameTimeout);
gPrefSvc.setBoolPref(kPrefSmoothScroll, false);
var gTimeout = kDefaultTimeout; var gTimeout = kDefaultTimeout;
gBody.addEventListener("MozMouseScrollFailed", onMouseScrollFailed, false); gBody.addEventListener("MozMouseScrollFailed", onMouseScrollFailed, false);
@ -117,6 +120,7 @@ function onunload()
{ {
resetTimeoutPrefs(); resetTimeoutPrefs();
disableNonTestMouseEvents(false); disableNonTestMouseEvents(false);
gPrefSvc.clearUserPref(kPrefSmoothScroll);
window.opener.wrappedJSObject.SimpleTest.finish(); window.opener.wrappedJSObject.SimpleTest.finish();
} }

View File

@ -110,11 +110,14 @@ var gTimer;
var gPrefSvc = Components.classes["@mozilla.org/preferences-service;1"]. var gPrefSvc = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch2); getService(Components.interfaces.nsIPrefBranch2);
const kPrefSmoothScroll = "general.smoothScroll";
const kPrefNameTimeout = "mousewheel.transaction.timeout"; const kPrefNameTimeout = "mousewheel.transaction.timeout";
const kPrefNameIgnoreMoveDelay = "mousewheel.transaction.ignoremovedelay"; const kPrefNameIgnoreMoveDelay = "mousewheel.transaction.ignoremovedelay";
const kDefaultTimeout = gPrefSvc.getIntPref(kPrefNameTimeout); const kDefaultTimeout = gPrefSvc.getIntPref(kPrefNameTimeout);
const kDefaultIgnoreMoveDelay = gPrefSvc.getIntPref(kPrefNameIgnoreMoveDelay) const kDefaultIgnoreMoveDelay = gPrefSvc.getIntPref(kPrefNameIgnoreMoveDelay);
gPrefSvc.setBoolPref(kPrefSmoothScroll, false);
var gTimeout, gIgnoreMoveDelay; var gTimeout, gIgnoreMoveDelay;
var gEnoughForTimeout, gEnoughForIgnoreMoveDelay; var gEnoughForTimeout, gEnoughForIgnoreMoveDelay;
@ -171,6 +174,7 @@ function onload()
function onunload() function onunload()
{ {
resetTimeoutPrefs(); resetTimeoutPrefs();
gPrefSvc.clearUserPref(kPrefSmoothScroll);
disableNonTestMouseEvents(false); disableNonTestMouseEvents(false);
window.opener.wrappedJSObject.SimpleTest.finish(); window.opener.wrappedJSObject.SimpleTest.finish();
} }