Bug 1743045 - Respect general.smoothScroll for programmatic scrolls. r=hiro
For programmatic scrolls, we should respect a users general.smoothScroll preference. If smooth scrolls are disabled, programmatic scrolls with behavior: "smooth" should be treated as instant programmatic scrolls. Differential Revision: https://phabricator.services.mozilla.com/D170110
This commit is contained in:
@@ -3517,10 +3517,17 @@ static void ScrollToShowRect(nsIScrollableFrame* aFrameAsScrollable,
|
||||
}
|
||||
|
||||
ScrollMode scrollMode = ScrollMode::Instant;
|
||||
bool autoBehaviorIsSmooth = aFrameAsScrollable->IsSmoothScroll();
|
||||
bool smoothScroll =
|
||||
(aScrollFlags & ScrollFlags::ScrollSmooth) ||
|
||||
((aScrollFlags & ScrollFlags::ScrollSmoothAuto) && autoBehaviorIsSmooth);
|
||||
// Default to an instant scroll, but if the scroll behavior given is "auto"
|
||||
// or "smooth", use that as the specified behavior. If the user has disabled
|
||||
// smooth scrolls, a given mode of "auto" or "smooth" should not result in
|
||||
// a smooth scroll.
|
||||
ScrollBehavior behavior = ScrollBehavior::Instant;
|
||||
if (aScrollFlags & ScrollFlags::ScrollSmooth) {
|
||||
behavior = ScrollBehavior::Smooth;
|
||||
} else if (aScrollFlags & ScrollFlags::ScrollSmoothAuto) {
|
||||
behavior = ScrollBehavior::Auto;
|
||||
}
|
||||
bool smoothScroll = aFrameAsScrollable->IsSmoothScroll(behavior);
|
||||
if (smoothScroll) {
|
||||
scrollMode = ScrollMode::SmoothMsd;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user