mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 1655130
. Handle non-smooth scrolling with desktop zooming scrollbars. r=kats
Differential Revision: https://phabricator.services.mozilla.com/D89408
This commit is contained in:
parent
ce1a0b3c82
commit
ad56527f09
@ -114,6 +114,14 @@ CSSPoint FrameMetrics::ApplyRelativeScrollUpdateFrom(
|
||||
return GetVisualScrollOffset() - origin;
|
||||
}
|
||||
|
||||
CSSPoint FrameMetrics::ApplyPureRelativeScrollUpdateFrom(
|
||||
const ScrollPositionUpdate& aUpdate) {
|
||||
MOZ_ASSERT(aUpdate.GetType() == ScrollUpdateType::PureRelative);
|
||||
CSSPoint origin = GetVisualScrollOffset();
|
||||
ClampAndSetVisualScrollOffset(origin + aUpdate.GetDelta());
|
||||
return GetVisualScrollOffset() - origin;
|
||||
}
|
||||
|
||||
ScrollSnapInfo::ScrollSnapInfo()
|
||||
: mScrollSnapStrictnessX(StyleScrollSnapStrictness::None),
|
||||
mScrollSnapStrictnessY(StyleScrollSnapStrictness::None) {}
|
||||
|
@ -264,6 +264,9 @@ struct FrameMetrics {
|
||||
*/
|
||||
CSSPoint ApplyRelativeScrollUpdateFrom(const ScrollPositionUpdate& aUpdate);
|
||||
|
||||
CSSPoint ApplyPureRelativeScrollUpdateFrom(
|
||||
const ScrollPositionUpdate& aUpdate);
|
||||
|
||||
void UpdatePendingScrollInfo(const ScrollPositionUpdate& aInfo) {
|
||||
SetLayoutScrollOffset(aInfo.GetDestination());
|
||||
mScrollGeneration = aInfo.GetGeneration();
|
||||
|
@ -82,7 +82,7 @@ ComputeBezierAnimationSettingsForOrigin(ScrollOrigin aOrigin) {
|
||||
bool isOriginSmoothnessEnabled = false;
|
||||
|
||||
#define READ_DURATIONS(prefbase) \
|
||||
isOriginSmoothnessEnabled = StaticPrefs::general_smoothScroll_ ## prefbase (); \
|
||||
isOriginSmoothnessEnabled = StaticPrefs::general_smoothScroll() && StaticPrefs::general_smoothScroll_ ## prefbase (); \
|
||||
if (isOriginSmoothnessEnabled) { \
|
||||
minMS = StaticPrefs::general_smoothScroll_ ## prefbase ## _durationMinMS(); \
|
||||
maxMS = StaticPrefs::general_smoothScroll_ ## prefbase ## _durationMaxMS(); \
|
||||
|
@ -4697,6 +4697,30 @@ void AsyncPanZoomController::NotifyLayersUpdated(
|
||||
relativeDelta =
|
||||
Some(Metrics().ApplyRelativeScrollUpdateFrom(scrollUpdate));
|
||||
Metrics().RecalculateLayoutViewportOffset();
|
||||
} else if (scrollUpdate.GetType() == ScrollUpdateType::PureRelative) {
|
||||
APZC_LOG("%p pure-relative updating scroll offset from %s by %s\n", this,
|
||||
ToString(Metrics().GetVisualScrollOffset()).c_str(),
|
||||
ToString(scrollUpdate.GetDelta()).c_str());
|
||||
|
||||
// Always need a repaint request with a repaint type for pure relative
|
||||
// scrolls because apz is doing the scroll at the main thread's request.
|
||||
// The main thread has not updated it's scroll offset yet, it is depending
|
||||
// on apz to tell it where to scroll.
|
||||
needContentRepaint = true;
|
||||
contentRepaintType = RepaintUpdateType::eVisualUpdate;
|
||||
|
||||
// We have to cancel a visual scroll offset update otherwise it will
|
||||
// clobber the relative scrolling we are about to do. We perform
|
||||
// visualScrollOffset = visualScrollOffset + delta. Then the
|
||||
// visualScrollOffsetUpdated block below will do visualScrollOffset =
|
||||
// aLayerMetrics.GetVisualDestination(). We need visual scroll offset
|
||||
// updates to be incorporated into this scroll update loop to properly fix
|
||||
// this.
|
||||
visualScrollOffsetUpdated = false;
|
||||
|
||||
relativeDelta =
|
||||
Some(Metrics().ApplyPureRelativeScrollUpdateFrom(scrollUpdate));
|
||||
Metrics().RecalculateLayoutViewportOffset();
|
||||
} else {
|
||||
APZC_LOG("%p updating scroll offset from %s to %s\n", this,
|
||||
ToString(Metrics().GetVisualScrollOffset()).c_str(),
|
||||
|
Loading…
Reference in New Issue
Block a user