Bug 1571544 - Convert the two layout.framevisibility.amountscrollbeforeupdate* prefs to static prefs. r=njn

Converts layout.framevisibility.amountscrollbeforeupdatevertical and layout.framevisibility.amountscrollbeforeupdatehorizontal to static prefs.

Differential Revision: https://phabricator.services.mozilla.com/D40718

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kristen Wright 2019-08-05 23:30:33 +00:00
parent 24117f02d3
commit 5855268c8e
3 changed files with 28 additions and 22 deletions

View File

@ -2807,12 +2807,20 @@ void ScrollFrameHelper::ScrollToImpl(nsPoint aPt, const nsRect& aRange,
nsPoint dist(std::abs(pt.x - mLastUpdateFramesPos.x),
std::abs(pt.y - mLastUpdateFramesPos.y));
nsSize visualViewportSize = GetVisualViewportSize();
nscoord horzAllowance =
std::max(visualViewportSize.width / std::max(sHorzScrollFraction, 1),
AppUnitsPerCSSPixel());
nscoord vertAllowance =
std::max(visualViewportSize.height / std::max(sVertScrollFraction, 1),
AppUnitsPerCSSPixel());
nscoord horzAllowance = std::max(
visualViewportSize.width /
std::max(
StaticPrefs::
layout_framevisibility_amountscrollbeforeupdatehorizontal(),
1),
AppUnitsPerCSSPixel());
nscoord vertAllowance = std::max(
visualViewportSize.height /
std::max(
StaticPrefs::
layout_framevisibility_amountscrollbeforeupdatevertical(),
1),
AppUnitsPerCSSPixel());
if (dist.x >= horzAllowance || dist.y >= vertAllowance) {
needFrameVisibilityUpdate = true;
}
@ -3245,10 +3253,6 @@ bool ScrollFrameHelper::sFrameVisPrefsCached = false;
uint32_t ScrollFrameHelper::sHorzExpandScrollPort = 0;
/* static */
uint32_t ScrollFrameHelper::sVertExpandScrollPort = 1;
/* static */
int32_t ScrollFrameHelper::sHorzScrollFraction = 2;
/* static */
int32_t ScrollFrameHelper::sVertScrollFraction = 2;
/* static */
void ScrollFrameHelper::EnsureFrameVisPrefsCached() {
@ -3259,14 +3263,6 @@ void ScrollFrameHelper::EnsureFrameVisPrefsCached() {
Preferences::AddUintVarCache(&sVertExpandScrollPort,
"layout.framevisibility.numscrollportheights",
1);
Preferences::AddIntVarCache(
&sHorzScrollFraction,
"layout.framevisibility.amountscrollbeforeupdatehorizontal", 2);
Preferences::AddIntVarCache(
&sVertScrollFraction,
"layout.framevisibility.amountscrollbeforeupdatevertical", 2);
sFrameVisPrefsCached = true;
}
}

View File

@ -753,10 +753,6 @@ class ScrollFrameHelper : public nsIReflowCallback {
// visibility.
static uint32_t sHorzExpandScrollPort;
static uint32_t sVertExpandScrollPort;
// The fraction of the scrollport we allow to scroll by before we schedule
// an update of frame visibility.
static int32_t sHorzScrollFraction;
static int32_t sVertScrollFraction;
};
} // namespace mozilla

View File

@ -4584,6 +4584,20 @@
value: @IS_EARLY_BETA_OR_EARLIER@
mirror: always
# The fraction of the scrollport we allow to horizontally scroll by before we
# schedule an update of frame visibility.
- name: layout.framevisibility.amountscrollbeforeupdatehorizontal
type: int32_t
value: 2
mirror: always
# The fraction of the scrollport we allow to vertically scroll by before we
# schedule an update of frame visibility.
- name: layout.framevisibility.amountscrollbeforeupdatevertical
type: int32_t
value: 2
mirror: always
#---------------------------------------------------------------------------
# Prefs starting with "media."
#---------------------------------------------------------------------------