Commit a6a8e4e6 authored by Fatih's avatar Fatih Committed by morgan
Browse files

Bug 1834307: Change StaticPrefs::general_smoothScroll() calls with...

Bug 1834307: Change StaticPrefs::general_smoothScroll() calls with nsLayoutUtils::IsSmoothScrollingEnabled. r=tjr

Differential Revision: https://phabricator.services.mozilla.com/D221363
parent 01972d1c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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
@@ -270,7 +271,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 −4
Original line number Diff line number Diff line
@@ -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,7 +104,7 @@ ScrollMode GetScrollModeForOrigin(ScrollOrigin origin) {
                                                       : ScrollMode::Instant;
    default:
      MOZ_ASSERT(false, "Unknown keyboard scroll origin");
      return StaticPrefs::general_smoothScroll() ? ScrollMode::Smooth
      return isSmoothScrollingEnabled ? ScrollMode::Smooth
                                      : ScrollMode::Instant;
  }
}
+2 −1
Original line number Diff line number Diff line
@@ -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 {
+2 −1
Original line number Diff line number Diff line
@@ -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 =
+1 −1
Original line number Diff line number Diff line
@@ -1535,7 +1535,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,
Loading