Bug 725700 - Keyboard arrow keys and scrollbar buttons should have consistent scrolling distances.

This commit is contained in:
Jared Wein 2012-02-20 11:24:36 -05:00
parent 56bf71ec98
commit bcbb16588c
5 changed files with 11 additions and 6 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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