зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
ce1a0b3c82
Коммит
ad56527f09
|
@ -114,6 +114,14 @@ CSSPoint FrameMetrics::ApplyRelativeScrollUpdateFrom(
|
||||||
return GetVisualScrollOffset() - origin;
|
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()
|
ScrollSnapInfo::ScrollSnapInfo()
|
||||||
: mScrollSnapStrictnessX(StyleScrollSnapStrictness::None),
|
: mScrollSnapStrictnessX(StyleScrollSnapStrictness::None),
|
||||||
mScrollSnapStrictnessY(StyleScrollSnapStrictness::None) {}
|
mScrollSnapStrictnessY(StyleScrollSnapStrictness::None) {}
|
||||||
|
|
|
@ -264,6 +264,9 @@ struct FrameMetrics {
|
||||||
*/
|
*/
|
||||||
CSSPoint ApplyRelativeScrollUpdateFrom(const ScrollPositionUpdate& aUpdate);
|
CSSPoint ApplyRelativeScrollUpdateFrom(const ScrollPositionUpdate& aUpdate);
|
||||||
|
|
||||||
|
CSSPoint ApplyPureRelativeScrollUpdateFrom(
|
||||||
|
const ScrollPositionUpdate& aUpdate);
|
||||||
|
|
||||||
void UpdatePendingScrollInfo(const ScrollPositionUpdate& aInfo) {
|
void UpdatePendingScrollInfo(const ScrollPositionUpdate& aInfo) {
|
||||||
SetLayoutScrollOffset(aInfo.GetDestination());
|
SetLayoutScrollOffset(aInfo.GetDestination());
|
||||||
mScrollGeneration = aInfo.GetGeneration();
|
mScrollGeneration = aInfo.GetGeneration();
|
||||||
|
|
|
@ -82,7 +82,7 @@ ComputeBezierAnimationSettingsForOrigin(ScrollOrigin aOrigin) {
|
||||||
bool isOriginSmoothnessEnabled = false;
|
bool isOriginSmoothnessEnabled = false;
|
||||||
|
|
||||||
#define READ_DURATIONS(prefbase) \
|
#define READ_DURATIONS(prefbase) \
|
||||||
isOriginSmoothnessEnabled = StaticPrefs::general_smoothScroll_ ## prefbase (); \
|
isOriginSmoothnessEnabled = StaticPrefs::general_smoothScroll() && StaticPrefs::general_smoothScroll_ ## prefbase (); \
|
||||||
if (isOriginSmoothnessEnabled) { \
|
if (isOriginSmoothnessEnabled) { \
|
||||||
minMS = StaticPrefs::general_smoothScroll_ ## prefbase ## _durationMinMS(); \
|
minMS = StaticPrefs::general_smoothScroll_ ## prefbase ## _durationMinMS(); \
|
||||||
maxMS = StaticPrefs::general_smoothScroll_ ## prefbase ## _durationMaxMS(); \
|
maxMS = StaticPrefs::general_smoothScroll_ ## prefbase ## _durationMaxMS(); \
|
||||||
|
|
|
@ -4697,6 +4697,30 @@ void AsyncPanZoomController::NotifyLayersUpdated(
|
||||||
relativeDelta =
|
relativeDelta =
|
||||||
Some(Metrics().ApplyRelativeScrollUpdateFrom(scrollUpdate));
|
Some(Metrics().ApplyRelativeScrollUpdateFrom(scrollUpdate));
|
||||||
Metrics().RecalculateLayoutViewportOffset();
|
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 {
|
} else {
|
||||||
APZC_LOG("%p updating scroll offset from %s to %s\n", this,
|
APZC_LOG("%p updating scroll offset from %s to %s\n", this,
|
||||||
ToString(Metrics().GetVisualScrollOffset()).c_str(),
|
ToString(Metrics().GetVisualScrollOffset()).c_str(),
|
||||||
|
|
Загрузка…
Ссылка в новой задаче