Bug 1584950 - Use StaticPrefs in ScrollFrameHelper::IsSmoothScrollingEnabled. r=njn
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 01 Oct 2019 08:01:22 +0000
changeset 495734 0dfb6920936b6a65f2ef2567d094b0194a6f3d10
parent 495733 1d391bb5799b3490cfc24a7c7c27f6ee7d2d2862
child 495735 56422b3da6ff7d3ae84db40085cfed2943975d03
push id96830
push userealvarez@mozilla.com
push dateTue, 01 Oct 2019 16:26:46 +0000
treeherderautoland@0dfb6920936b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs1584950
milestone71.0a1
first release with
nightly linux32
0dfb6920936b / 71.0a1 / 20191001213452 / files
nightly linux64
0dfb6920936b / 71.0a1 / 20191001213452 / files
nightly mac
0dfb6920936b / 71.0a1 / 20191001213452 / files
nightly win32
0dfb6920936b / 71.0a1 / 20191001213452 / files
nightly win64
0dfb6920936b / 71.0a1 / 20191001213452 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1584950 - Use StaticPrefs in ScrollFrameHelper::IsSmoothScrollingEnabled. r=njn Differential Revision: https://phabricator.services.mozilla.com/D47589
browser/app/profile/firefox.js
layout/generic/nsGfxScrollFrame.cpp
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -196,17 +196,16 @@ pref("browser.uitour.requireSecure", tru
 pref("browser.uitour.themeOrigin", "https://addons.mozilla.org/%LOCALE%/firefox/themes/");
 pref("browser.uitour.url", "https://www.mozilla.org/%LOCALE%/firefox/%VERSION%/tour/");
 // How long to show a Hearbeat survey (two hours, in seconds)
 pref("browser.uitour.surveyDuration", 7200);
 
 pref("keyword.enabled", true);
 pref("browser.fixup.domainwhitelist.localhost", true);
 
-pref("general.smoothScroll", true);
 #ifdef UNIX_BUT_NOT_MAC
   pref("general.autoScroll", false);
 #else
   pref("general.autoScroll", true);
 #endif
 
 pref("browser.stopReloadAnimation.enabled", true);
 
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -1705,18 +1705,16 @@ NS_QUERYFRAME_HEAD(nsXULScrollFrame)
   NS_QUERYFRAME_ENTRY(nsIAnonymousContentCreator)
   NS_QUERYFRAME_ENTRY(nsIScrollableFrame)
   NS_QUERYFRAME_ENTRY(nsIStatefulFrame)
   NS_QUERYFRAME_ENTRY(nsIScrollbarMediator)
 NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame)
 
   //-------------------- Helper ----------------------
 
-#define SMOOTH_SCROLL_PREF_NAME "general.smoothScroll"
-
 // AsyncSmoothMSDScroll has ref counting.
 class ScrollFrameHelper::AsyncSmoothMSDScroll final
     : public nsARefreshObserver {
  public:
   AsyncSmoothMSDScroll(const nsPoint& aInitialPosition,
                        const nsPoint& aInitialDestination,
                        const nsSize& aInitialVelocity, const nsRect& aRange,
                        const mozilla::TimeStamp& aStartTime,
@@ -2024,17 +2022,17 @@ void ScrollFrameHelper::AsyncScroll::Ini
   }
 
   mRange = aRange;
 
   mAnimationPhysics->Update(aTime, aDestination, aCurrentVelocity);
 }
 
 bool ScrollFrameHelper::IsSmoothScrollingEnabled() {
-  return Preferences::GetBool(SMOOTH_SCROLL_PREF_NAME, false);
+  return StaticPrefs::general_smoothScroll();
 }
 
 class ScrollFrameActivityTracker final
     : public nsExpirationTracker<ScrollFrameHelper, 4> {
  public:
   // Wait for 3-4s between scrolls before we remove our layers.
   // That's 4 generations of 1s each.
   enum { TIMEOUT_MS = 1000 };
@@ -2344,17 +2342,17 @@ void ScrollFrameHelper::ScrollToWithOrig
   }
 
   nsPresContext* presContext = mOuter->PresContext();
   TimeStamp now =
       presContext->RefreshDriver()->IsTestControllingRefreshesEnabled()
           ? presContext->RefreshDriver()->MostRecentRefresh()
           : TimeStamp::Now();
   bool isSmoothScroll =
-      (aMode == ScrollMode::Smooth) && IsSmoothScrollingEnabled();
+      aMode == ScrollMode::Smooth && IsSmoothScrollingEnabled();
 
   nsSize currentVelocity(0, 0);
 
   if (StaticPrefs::layout_css_scroll_behavior_enabled()) {
     if (aMode == ScrollMode::SmoothMsd) {
       mIgnoreMomentumScroll = true;
       if (!mAsyncSmoothMSDScroll) {
         nsPoint sv = mVelocityQueue.GetVelocity();