mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-12 00:50:40 +00:00
Bug 1794056 - Use static pref version of scroll distance prefs. r=hiro,TYLin
These were already static prefs for APZ, let's use them everywhere. Differential Revision: https://phabricator.services.mozilla.com/D158817
This commit is contained in:
parent
c579cdfd2e
commit
abe0dac72c
@ -38,6 +38,7 @@
|
||||
#include "mozilla/StaticPrefs_font.h"
|
||||
#include "mozilla/StaticPrefs_image.h"
|
||||
#include "mozilla/StaticPrefs_layout.h"
|
||||
#include "mozilla/StaticPrefs_toolkit.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/TouchEvents.h"
|
||||
@ -2430,9 +2431,7 @@ PresShell::ScrollLine(bool aForward) {
|
||||
GetScrollableFrameToScroll(VerticalScrollDirection);
|
||||
ScrollMode scrollMode = apz::GetScrollModeForOrigin(ScrollOrigin::Lines);
|
||||
if (scrollFrame) {
|
||||
int32_t lineCount =
|
||||
Preferences::GetInt("toolkit.scrollbox.verticalScrollDistance",
|
||||
NS_DEFAULT_VERTICAL_SCROLL_DISTANCE);
|
||||
int32_t lineCount = StaticPrefs::toolkit_scrollbox_verticalScrollDistance();
|
||||
scrollFrame->ScrollBy(
|
||||
nsIntPoint(0, aForward ? lineCount : -lineCount), ScrollUnit::LINES,
|
||||
scrollMode, nullptr, mozilla::ScrollOrigin::NotSpecified,
|
||||
@ -2447,9 +2446,7 @@ PresShell::ScrollCharacter(bool aRight) {
|
||||
GetScrollableFrameToScroll(HorizontalScrollDirection);
|
||||
ScrollMode scrollMode = apz::GetScrollModeForOrigin(ScrollOrigin::Lines);
|
||||
if (scrollFrame) {
|
||||
int32_t h =
|
||||
Preferences::GetInt("toolkit.scrollbox.horizontalScrollDistance",
|
||||
NS_DEFAULT_HORIZONTAL_SCROLL_DISTANCE);
|
||||
int32_t h = StaticPrefs::toolkit_scrollbox_horizontalScrollDistance();
|
||||
scrollFrame->ScrollBy(
|
||||
nsIntPoint(aRight ? h : -h, 0), ScrollUnit::LINES, scrollMode, nullptr,
|
||||
mozilla::ScrollOrigin::NotSpecified, nsIScrollableFrame::NOT_MOMENTUM,
|
||||
|
@ -51,6 +51,7 @@
|
||||
#include "mozilla/ScrollbarPreferences.h"
|
||||
#include "mozilla/ScrollingMetrics.h"
|
||||
#include "mozilla/StaticPrefs_browser.h"
|
||||
#include "mozilla/StaticPrefs_toolkit.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/SVGOuterSVGFrame.h"
|
||||
#include "mozilla/ViewportUtils.h"
|
||||
@ -1756,8 +1757,7 @@ void ScrollFrameHelper::ScrollByLine(nsScrollbarFrame* aScrollbar,
|
||||
nsIntPoint delta;
|
||||
if (isHorizontal) {
|
||||
const double kScrollMultiplier =
|
||||
Preferences::GetInt("toolkit.scrollbox.horizontalScrollDistance",
|
||||
NS_DEFAULT_HORIZONTAL_SCROLL_DISTANCE);
|
||||
StaticPrefs::toolkit_scrollbox_horizontalScrollDistance();
|
||||
delta.x = aDirection * kScrollMultiplier;
|
||||
if (GetLineScrollAmount().width * delta.x > GetPageScrollAmount().width) {
|
||||
// The scroll frame is so small that the delta would be more
|
||||
@ -1768,8 +1768,7 @@ void ScrollFrameHelper::ScrollByLine(nsScrollbarFrame* aScrollbar,
|
||||
}
|
||||
} else {
|
||||
const double kScrollMultiplier =
|
||||
Preferences::GetInt("toolkit.scrollbox.verticalScrollDistance",
|
||||
NS_DEFAULT_VERTICAL_SCROLL_DISTANCE);
|
||||
StaticPrefs::toolkit_scrollbox_verticalScrollDistance();
|
||||
delta.y = aDirection * kScrollMultiplier;
|
||||
if (GetLineScrollAmount().height * delta.y > GetPageScrollAmount().height) {
|
||||
// The scroll frame is so small that the delta would be more
|
||||
@ -6851,8 +6850,7 @@ bool ScrollFrameHelper::ReflowFinished() {
|
||||
AutoWeakFrame weakFrame(mOuter);
|
||||
if (vScroll) {
|
||||
const double kScrollMultiplier =
|
||||
Preferences::GetInt("toolkit.scrollbox.verticalScrollDistance",
|
||||
NS_DEFAULT_VERTICAL_SCROLL_DISTANCE);
|
||||
StaticPrefs::toolkit_scrollbox_verticalScrollDistance();
|
||||
nscoord increment = lineScrollAmount.height * kScrollMultiplier;
|
||||
// We normally use (visualViewportSize.height - increment) for height of
|
||||
// page scrolling. However, it is too small when increment is very large.
|
||||
@ -6870,8 +6868,7 @@ bool ScrollFrameHelper::ReflowFinished() {
|
||||
}
|
||||
if (hScroll) {
|
||||
const double kScrollMultiplier =
|
||||
Preferences::GetInt("toolkit.scrollbox.horizontalScrollDistance",
|
||||
NS_DEFAULT_HORIZONTAL_SCROLL_DISTANCE);
|
||||
StaticPrefs::toolkit_scrollbox_horizontalScrollDistance();
|
||||
nscoord increment = lineScrollAmount.width * kScrollMultiplier;
|
||||
FinishReflowForScrollbar(
|
||||
hScroll, scrollRange.x, scrollRange.XMost(), scrollPos.x,
|
||||
|
@ -23,9 +23,6 @@
|
||||
#include "Units.h"
|
||||
#include "FrameMetrics.h"
|
||||
|
||||
#define NS_DEFAULT_VERTICAL_SCROLL_DISTANCE 3
|
||||
#define NS_DEFAULT_HORIZONTAL_SCROLL_DISTANCE 5
|
||||
|
||||
class gfxContext;
|
||||
class nsBoxLayoutState;
|
||||
class nsIScrollPositionListener;
|
||||
|
Loading…
Reference in New Issue
Block a user