зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1834307: Change StaticPrefs::general_smoothScroll() calls with nsLayoutUtils::IsSmoothScrollingEnabled. r=tjr
Differential Revision: https://phabricator.services.mozilla.com/D221363
This commit is contained in:
Родитель
d9402246b9
Коммит
6ab4e9bf01
|
@ -10,6 +10,7 @@
|
|||
#include "InputData.h" // for MouseInput, etc
|
||||
#include "InputBlockState.h" // for InputBlockState
|
||||
#include "OverscrollHandoffState.h" // for OverscrollHandoffState
|
||||
#include "nsLayoutUtils.h" // for IsSmoothScrollingEnabled
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/dom/WheelEventBinding.h" // for WheelEvent constants
|
||||
#include "mozilla/EventStateManager.h" // for EventStateManager
|
||||
|
@ -331,7 +332,7 @@ APZEventResult APZInputBridge::ReceiveInputEvent(
|
|||
if (Maybe<APZWheelAction> action = ActionForWheelEvent(&wheelEvent)) {
|
||||
ScrollWheelInput::ScrollMode scrollMode =
|
||||
ScrollWheelInput::SCROLLMODE_INSTANT;
|
||||
if (StaticPrefs::general_smoothScroll() &&
|
||||
if (nsLayoutUtils::IsSmoothScrollingEnabled() &&
|
||||
((wheelEvent.mDeltaMode ==
|
||||
dom::WheelEvent_Binding::DOM_DELTA_LINE &&
|
||||
StaticPrefs::general_smoothScroll_mouseWheel()) ||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "mozilla/layers/APZPublicUtils.h"
|
||||
|
||||
#include "AsyncPanZoomController.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "mozilla/HelperMacros.h"
|
||||
#include "mozilla/StaticPrefs_general.h"
|
||||
|
||||
|
@ -36,9 +37,10 @@ ScrollAnimationBezierPhysicsSettings ComputeBezierAnimationSettingsForOrigin(
|
|||
int32_t minMS = 0;
|
||||
int32_t maxMS = 0;
|
||||
bool isOriginSmoothnessEnabled = false;
|
||||
bool isGeneralSmoothnessEnabled = nsLayoutUtils::IsSmoothScrollingEnabled();
|
||||
|
||||
#define READ_DURATIONS(prefbase) \
|
||||
isOriginSmoothnessEnabled = StaticPrefs::general_smoothScroll() && \
|
||||
isOriginSmoothnessEnabled = isGeneralSmoothnessEnabled && \
|
||||
StaticPrefs::general_smoothScroll_##prefbase(); \
|
||||
if (isOriginSmoothnessEnabled) { \
|
||||
minMS = StaticPrefs::general_smoothScroll_##prefbase##_durationMinMS(); \
|
||||
|
@ -88,7 +90,8 @@ ScrollAnimationBezierPhysicsSettings ComputeBezierAnimationSettingsForOrigin(
|
|||
}
|
||||
|
||||
ScrollMode GetScrollModeForOrigin(ScrollOrigin origin) {
|
||||
if (!StaticPrefs::general_smoothScroll()) return ScrollMode::Instant;
|
||||
bool isSmoothScrollingEnabled = nsLayoutUtils::IsSmoothScrollingEnabled();
|
||||
if (!isSmoothScrollingEnabled) return ScrollMode::Instant;
|
||||
switch (origin) {
|
||||
case ScrollOrigin::Lines:
|
||||
return StaticPrefs::general_smoothScroll_lines() ? ScrollMode::Smooth
|
||||
|
@ -101,8 +104,8 @@ ScrollMode GetScrollModeForOrigin(ScrollOrigin origin) {
|
|||
: ScrollMode::Instant;
|
||||
default:
|
||||
MOZ_ASSERT(false, "Unknown keyboard scroll origin");
|
||||
return StaticPrefs::general_smoothScroll() ? ScrollMode::Smooth
|
||||
: ScrollMode::Instant;
|
||||
return isSmoothScrollingEnabled ? ScrollMode::Smooth
|
||||
: ScrollMode::Instant;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "AsyncPanZoomController.h"
|
||||
#include "FrameMetrics.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "mozilla/layers/APZPublicUtils.h"
|
||||
#include "nsPoint.h"
|
||||
#include "ScrollAnimationPhysics.h"
|
||||
|
@ -28,7 +29,7 @@ GenericScrollAnimation::GenericScrollAnimation(AsyncPanZoomController& aApzc,
|
|||
// ScrollAnimationBezierPhysics (despite its name) handles the case of
|
||||
// general.smoothScroll being disabled whereas ScrollAnimationMSDPhysics does
|
||||
// not (ie it scrolls smoothly).
|
||||
if (StaticPrefs::general_smoothScroll() &&
|
||||
if (nsLayoutUtils::IsSmoothScrollingEnabled() &&
|
||||
StaticPrefs::general_smoothScroll_msdPhysics_enabled()) {
|
||||
mAnimationPhysics = MakeUnique<ScrollAnimationMSDPhysics>(aInitialPosition);
|
||||
} else {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <tuple>
|
||||
#include "AsyncPanZoomController.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "mozilla/StaticPrefs_general.h"
|
||||
#include "mozilla/layers/APZPublicUtils.h"
|
||||
#include "nsPoint.h"
|
||||
|
@ -35,7 +36,7 @@ WheelScrollAnimation::WheelScrollAnimation(
|
|||
ScrollWheelInput::ScrollDeltaType aDeltaType)
|
||||
: GenericScrollAnimation(aApzc, aInitialPosition,
|
||||
OriginForDeltaType(aDeltaType)) {
|
||||
MOZ_ASSERT(StaticPrefs::general_smoothScroll(),
|
||||
MOZ_ASSERT(nsLayoutUtils::IsSmoothScrollingEnabled(),
|
||||
"We shouldn't be creating a WheelScrollAnimation if smooth "
|
||||
"scrolling is disabled");
|
||||
mDirectionForcedToOverscroll =
|
||||
|
|
|
@ -1540,7 +1540,7 @@ void nsSliderFrame::PageScroll(bool aClickAndHold) {
|
|||
|
||||
mCurrentClickHoldDestination = Some(pos);
|
||||
sf->ScrollTo(pos,
|
||||
StaticPrefs::general_smoothScroll() &&
|
||||
nsLayoutUtils::IsSmoothScrollingEnabled() &&
|
||||
StaticPrefs::general_smoothScroll_pages()
|
||||
? ScrollMode::Smooth
|
||||
: ScrollMode::Instant,
|
||||
|
|
|
@ -3295,7 +3295,7 @@ static gfx::IntPoint GetIntegerDeltaForEvent(NSEvent* aEvent) {
|
|||
} else {
|
||||
ScrollWheelInput::ScrollMode scrollMode =
|
||||
ScrollWheelInput::SCROLLMODE_INSTANT;
|
||||
if (StaticPrefs::general_smoothScroll() &&
|
||||
if (nsLayoutUtils::IsSmoothScrollingEnabled() &&
|
||||
StaticPrefs::general_smoothScroll_mouseWheel()) {
|
||||
scrollMode = ScrollWheelInput::SCROLLMODE_SMOOTH;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче