Skip to content

Commit 9d5b7dd

Browse files
committed
Bug 1753565 - Default disable smooth scrolls if prefers-reduced-motion. r=botond
If the user has the prefers-reduced-motion system setting enabled, do not enable smooth scrolls by default. Differential Revision: https://phabricator.services.mozilla.com/D172446 UltraBlame original commit: a2f066123f3c6b76e43c5f09b154d838f1ba798b
1 parent 1e28ea1 commit 9d5b7dd

File tree

6 files changed

+141
-24
lines changed

6 files changed

+141
-24
lines changed

gfx/layers/apz/test/gtest/TestBasic.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1833,6 +1833,16 @@ APZCBasicTester
18331833
MultipleSmoothScrollsSmooth
18341834
)
18351835
{
1836+
SCOPED_GFX_PREF_BOOL
1837+
(
1838+
"
1839+
general
1840+
.
1841+
smoothScroll
1842+
"
1843+
true
1844+
)
1845+
;
18361846
ScrollMetadata
18371847
metadata
18381848
;
@@ -2627,6 +2637,16 @@ SCOPED_GFX_PREF_BOOL
26272637
general
26282638
.
26292639
smoothScroll
2640+
"
2641+
true
2642+
)
2643+
;
2644+
SCOPED_GFX_PREF_BOOL
2645+
(
2646+
"
2647+
general
2648+
.
2649+
smoothScroll
26302650
.
26312651
msdPhysics
26322652
.
@@ -2652,6 +2672,16 @@ SCOPED_GFX_PREF_BOOL
26522672
general
26532673
.
26542674
smoothScroll
2675+
"
2676+
true
2677+
)
2678+
;
2679+
SCOPED_GFX_PREF_BOOL
2680+
(
2681+
"
2682+
general
2683+
.
2684+
smoothScroll
26552685
.
26562686
msdPhysics
26572687
.

layout/base/nsLayoutUtils.cpp

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,15 @@ include
726726
"
727727
mozilla
728728
/
729+
StaticPrefs_general
730+
.
731+
h
732+
"
733+
#
734+
include
735+
"
736+
mozilla
737+
/
729738
StaticPrefs_gfx
730739
.
731740
h
@@ -40446,6 +40455,63 @@ void
4044640455
nsLayoutUtils
4044740456
:
4044840457
:
40458+
RecomputeSmoothScrollDefault
40459+
(
40460+
)
40461+
{
40462+
Preferences
40463+
:
40464+
:
40465+
SetBool
40466+
(
40467+
"
40468+
general
40469+
.
40470+
smoothScroll
40471+
"
40472+
!
40473+
LookAndFeel
40474+
:
40475+
:
40476+
GetInt
40477+
(
40478+
LookAndFeel
40479+
:
40480+
:
40481+
IntID
40482+
:
40483+
:
40484+
PrefersReducedMotion
40485+
0
40486+
)
40487+
PrefValueKind
40488+
:
40489+
:
40490+
Default
40491+
)
40492+
;
40493+
}
40494+
bool
40495+
nsLayoutUtils
40496+
:
40497+
:
40498+
IsSmoothScrollingEnabled
40499+
(
40500+
)
40501+
{
40502+
return
40503+
StaticPrefs
40504+
:
40505+
:
40506+
general_smoothScroll
40507+
(
40508+
)
40509+
;
40510+
}
40511+
void
40512+
nsLayoutUtils
40513+
:
40514+
:
4044940515
Initialize
4045040516
(
4045140517
)

layout/base/nsLayoutUtils.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6847,6 +6847,18 @@ nsIFrame
68476847
aFrame
68486848
)
68496849
;
6850+
static
6851+
bool
6852+
IsSmoothScrollingEnabled
6853+
(
6854+
)
6855+
;
6856+
static
6857+
void
6858+
RecomputeSmoothScrollDefault
6859+
(
6860+
)
6861+
;
68506862
private
68516863
:
68526864
static

layout/generic/nsGfxScrollFrame.cpp

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10143,23 +10143,6 @@ aCurrentVelocity
1014310143
)
1014410144
;
1014510145
}
10146-
bool
10147-
nsHTMLScrollFrame
10148-
:
10149-
:
10150-
IsSmoothScrollingEnabled
10151-
(
10152-
)
10153-
{
10154-
return
10155-
StaticPrefs
10156-
:
10157-
:
10158-
general_smoothScroll
10159-
(
10160-
)
10161-
;
10162-
}
1016310146
void
1016410147
nsHTMLScrollFrame
1016510148
:
@@ -11750,6 +11733,9 @@ IsSmooth
1175011733
)
1175111734
&
1175211735
&
11736+
nsLayoutUtils
11737+
:
11738+
:
1175311739
IsSmoothScrollingEnabled
1175411740
(
1175511741
)
@@ -36614,7 +36600,7 @@ Instant
3661436600
|
3661536601
|
3661636602
!
36617-
nsHTMLScrollFrame
36603+
nsLayoutUtils
3661836604
:
3661936605
:
3662036606
IsSmoothScrollingEnabled

layout/generic/nsGfxScrollFrame.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2440,12 +2440,6 @@ FireScrolledAreaEvent
24402440
(
24412441
)
24422442
;
2443-
static
2444-
bool
2445-
IsSmoothScrollingEnabled
2446-
(
2447-
)
2448-
;
24492443
void
24502444
FinishReflowForScrollbar
24512445
(

widget/nsXPLookAndFeel.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ h
8989
#
9090
include
9191
"
92+
nsLayoutUtils
93+
.
94+
h
95+
"
96+
#
97+
include
98+
"
9299
Theme
93100
.
94101
h
@@ -2954,6 +2961,21 @@ RecomputeColorSchemes
29542961
(
29552962
)
29562963
;
2964+
if
2965+
(
2966+
XRE_IsParentProcess
2967+
(
2968+
)
2969+
)
2970+
{
2971+
nsLayoutUtils
2972+
:
2973+
:
2974+
RecomputeSmoothScrollDefault
2975+
(
2976+
)
2977+
;
2978+
}
29572979
Preferences
29582980
:
29592981
:
@@ -6150,6 +6172,13 @@ XRE_IsParentProcess
61506172
)
61516173
)
61526174
{
6175+
nsLayoutUtils
6176+
:
6177+
:
6178+
RecomputeSmoothScrollDefault
6179+
(
6180+
)
6181+
;
61536182
widget
61546183
:
61556184
:

0 commit comments

Comments
 (0)