diff --git a/docshell/test/navigation/test_bug430723.html b/docshell/test/navigation/test_bug430723.html index 91339926fa54..ee9da6d160fe 100644 --- a/docshell/test/navigation/test_bug430723.html +++ b/docshell/test/navigation/test_bug430723.html @@ -63,7 +63,7 @@ var step1 =function() { // Navigate down and up. is(testWindow.document.body.scrollTop, 0, - "Page1: Ensure we scrollpane is at the top before we start scrolling."); + "Page1: Ensure the scrollpane is at the top before we start scrolling."); testWindow.addEventListener("scroll", function () { testWindow.removeEventListener("scroll", arguments.callee, true); isnot(testWindow.document.body.scrollTop, 0, @@ -91,11 +91,11 @@ var step2 =function() { // Scroll around a bit. is(testWindow.document.body.scrollTop, 0, - "Page2: Ensure we scrollpane is at the top before we start scrolling."); + "Page2: Ensure the scrollpane is at the top before we start scrolling."); var count = 0; testWindow.addEventListener("scroll", function () { - if (++count < 4) { + if (++count < 2) { SimpleTest.executeSoon(function () { sendKey('DOWN', testWindow); }); } else { testWindow.removeEventListener("scroll", arguments.callee, true); diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 24d3ccdc1964..82a11bcec879 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -2471,8 +2471,8 @@ PresShell::ScrollLine(bool aForward) nsIScrollableFrame* scrollFrame = GetFrameToScrollAsScrollable(nsIPresShell::eVertical); if (scrollFrame) { - // Scroll 2 lines at a time to improve scrolling speed. - PRInt32 lineCount = 2; + PRInt32 lineCount = Preferences::GetInt("toolkit.scrollbox.verticalScrollDistance", + NS_DEFAULT_VERTICAL_SCROLL_DISTANCE); scrollFrame->ScrollBy(nsIntPoint(0, aForward ? lineCount : -lineCount), nsIScrollableFrame::LINES, nsIScrollableFrame::SMOOTH); diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 50edad41cc2f..ff2c0f87f099 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -3237,7 +3237,8 @@ nsGfxScrollFrameInner::ReflowFinished() nsPoint scrollPos = GetScrollPosition(); // XXX shouldn't we use GetPageScrollAmount/GetLineScrollAmount here? if (vScroll) { - const double kScrollMultiplier = 3; + const double kScrollMultiplier = Preferences::GetInt("toolkit.scrollbox.verticalScrollDistance", + NS_DEFAULT_VERTICAL_SCROLL_DISTANCE); nscoord fontHeight = GetLineScrollAmount().height * kScrollMultiplier; // We normally use (scrollArea.height - fontHeight) for height // of page scrolling. However, it is too small when diff --git a/layout/generic/nsIScrollableFrame.h b/layout/generic/nsIScrollableFrame.h index c87a86266c93..8e33ff48f507 100644 --- a/layout/generic/nsIScrollableFrame.h +++ b/layout/generic/nsIScrollableFrame.h @@ -47,6 +47,8 @@ #include "nsPresContext.h" #include "nsIFrame.h" // to get nsIBox, which is a typedef +#define NS_DEFAULT_VERTICAL_SCROLL_DISTANCE 3 + class nsBoxLayoutState; class nsIScrollPositionListener; diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index 7e11e1480f1e..a05808e7008a 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -297,6 +297,8 @@ pref("toolkit.autocomplete.richBoundaryCutoff", 200); pref("toolkit.scrollbox.smoothScroll", true); pref("toolkit.scrollbox.scrollIncrement", 20); +// Make sure to update NS_DEFAULT_VERTICAL_SCROLL_DISTANCE if changing this default. +pref("toolkit.scrollbox.verticalScrollDistance", 3); pref("toolkit.scrollbox.clickToScroll.scrollDelay", 150); // Telemetry