Bug 1738811 - Drop ScrollSnapMode argument from nsIScrollableFrame::ScrollToCSSPixels and nsIScrollableFrame::ScrollByCSSPixels. r=tnikkel

Differential Revision: https://phabricator.services.mozilla.com/D130135
This commit is contained in:
Hiroyuki Ikezoe 2021-11-02 05:08:03 +00:00
parent 7588d07725
commit dd419fe544
3 changed files with 21 additions and 50 deletions

View File

@ -2357,15 +2357,12 @@ void ScrollFrameHelper::ScrollTo(nsPoint aScrollPosition, ScrollMode aMode,
ScrollToWithOrigin(aScrollPosition, aMode, aOrigin, aRange, aSnap);
}
void ScrollFrameHelper::ScrollToCSSPixels(
const CSSIntPoint& aScrollPosition, ScrollMode aMode,
nsIScrollbarMediator::ScrollSnapMode aSnap, ScrollOrigin aOrigin) {
void ScrollFrameHelper::ScrollToCSSPixels(const CSSIntPoint& aScrollPosition,
ScrollMode aMode,
ScrollOrigin aOrigin) {
nsPoint current = GetScrollPosition();
CSSIntPoint currentCSSPixels = GetScrollPositionCSSPixels();
nsPoint pt = CSSPoint::ToAppUnits(aScrollPosition);
if (aSnap == nsIScrollableFrame::DEFAULT) {
aSnap = nsIScrollableFrame::ENABLE_SNAP;
}
if (aOrigin == ScrollOrigin::NotSpecified) {
aOrigin = ScrollOrigin::Other;
@ -2387,7 +2384,7 @@ void ScrollFrameHelper::ScrollToCSSPixels(
range.y = pt.y;
range.height = 0;
}
ScrollTo(pt, aMode, aOrigin, &range, aSnap);
ScrollTo(pt, aMode, aOrigin, &range, nsIScrollableFrame::ENABLE_SNAP);
// 'this' might be destroyed here
}
@ -4810,9 +4807,9 @@ void ScrollFrameHelper::ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit,
}
}
void ScrollFrameHelper::ScrollByCSSPixels(
const CSSIntPoint& aDelta, ScrollMode aMode, ScrollOrigin aOrigin,
nsIScrollbarMediator::ScrollSnapMode aSnap) {
void ScrollFrameHelper::ScrollByCSSPixels(const CSSIntPoint& aDelta,
ScrollMode aMode,
ScrollOrigin aOrigin) {
nsPoint current = GetScrollPosition();
// `current` value above might be a value which was aligned to in
// layer-pixels, so starting from such points will make the difference between
@ -4826,10 +4823,6 @@ void ScrollFrameHelper::ScrollByCSSPixels(
CSSIntPoint currentCSSPixels = GetScrollPositionCSSPixels();
nsPoint pt = CSSPoint::ToAppUnits(currentCSSPixels + aDelta);
if (aSnap == nsIScrollableFrame::DEFAULT) {
aSnap = nsIScrollableFrame::ENABLE_SNAP;
}
if (aOrigin == ScrollOrigin::NotSpecified) {
aOrigin = ScrollOrigin::Other;
}
@ -4850,7 +4843,8 @@ void ScrollFrameHelper::ScrollByCSSPixels(
range.y = pt.y;
range.height = 0;
}
ScrollToWithOrigin(pt, aMode, aOrigin, &range, aSnap);
ScrollToWithOrigin(pt, aMode, aOrigin, &range,
nsIScrollableFrame::ENABLE_SNAP);
// 'this' might be destroyed here
}

View File

@ -255,8 +255,6 @@ class ScrollFrameHelper : public nsIReflowCallback {
*/
void ScrollToCSSPixels(const CSSIntPoint& aScrollPosition,
ScrollMode aMode = ScrollMode::Instant,
nsIScrollbarMediator::ScrollSnapMode aSnap =
nsIScrollbarMediator::DEFAULT,
ScrollOrigin aOrigin = ScrollOrigin::NotSpecified);
/**
* @note This method might destroy the frame, pres shell and other objects.
@ -284,9 +282,7 @@ class ScrollFrameHelper : public nsIReflowCallback {
nsIScrollbarMediator::DISABLE_SNAP);
void ScrollByCSSPixels(const CSSIntPoint& aDelta,
ScrollMode aMode = ScrollMode::Instant,
ScrollOrigin aOrigin = ScrollOrigin::NotSpecified,
nsIScrollbarMediator::ScrollSnapMode aSnap =
nsIScrollbarMediator::DEFAULT);
ScrollOrigin aOrigin = ScrollOrigin::NotSpecified);
/**
* @note This method might destroy the frame, pres shell and other objects.
*/
@ -995,10 +991,8 @@ class nsHTMLScrollFrame : public nsContainerFrame,
void ScrollToCSSPixels(
const CSSIntPoint& aScrollPosition,
ScrollMode aMode = ScrollMode::Instant,
nsIScrollbarMediator::ScrollSnapMode aSnap =
nsIScrollbarMediator::DEFAULT,
ScrollOrigin aOrigin = ScrollOrigin::NotSpecified) final {
mHelper.ScrollToCSSPixels(aScrollPosition, aMode, aSnap, aOrigin);
mHelper.ScrollToCSSPixels(aScrollPosition, aMode, aOrigin);
}
void ScrollToCSSPixelsApproximate(
const mozilla::CSSPoint& aScrollPosition,
@ -1024,12 +1018,10 @@ class nsHTMLScrollFrame : public nsContainerFrame,
mHelper.ScrollBy(aDelta, aUnit, aMode, aOverflow, aOrigin, aMomentum,
aSnap);
}
void ScrollByCSSPixels(const CSSIntPoint& aDelta,
ScrollMode aMode = ScrollMode::Instant,
ScrollOrigin aOrigin = ScrollOrigin::NotSpecified,
nsIScrollbarMediator::ScrollSnapMode aSnap =
nsIScrollbarMediator::DEFAULT) final {
mHelper.ScrollByCSSPixels(aDelta, aMode, aOrigin, aSnap);
void ScrollByCSSPixels(
const CSSIntPoint& aDelta, ScrollMode aMode = ScrollMode::Instant,
ScrollOrigin aOrigin = ScrollOrigin::NotSpecified) final {
mHelper.ScrollByCSSPixels(aDelta, aMode, aOrigin);
}
void ScrollSnap() final { mHelper.ScrollSnap(); }
/**
@ -1478,10 +1470,8 @@ class nsXULScrollFrame final : public nsBoxFrame,
void ScrollToCSSPixels(
const CSSIntPoint& aScrollPosition,
ScrollMode aMode = ScrollMode::Instant,
nsIScrollbarMediator::ScrollSnapMode aSnap =
nsIScrollbarMediator::DISABLE_SNAP,
ScrollOrigin aOrigin = ScrollOrigin::NotSpecified) final {
mHelper.ScrollToCSSPixels(aScrollPosition, aMode, aSnap, aOrigin);
mHelper.ScrollToCSSPixels(aScrollPosition, aMode, aOrigin);
}
void ScrollToCSSPixelsApproximate(
const mozilla::CSSPoint& aScrollPosition,
@ -1504,12 +1494,10 @@ class nsXULScrollFrame final : public nsBoxFrame,
mHelper.ScrollBy(aDelta, aUnit, aMode, aOverflow, aOrigin, aMomentum,
aSnap);
}
void ScrollByCSSPixels(const CSSIntPoint& aDelta,
ScrollMode aMode = ScrollMode::Instant,
ScrollOrigin aOrigin = ScrollOrigin::NotSpecified,
nsIScrollbarMediator::ScrollSnapMode aSnap =
nsIScrollbarMediator::DEFAULT) final {
mHelper.ScrollByCSSPixels(aDelta, aMode, aOrigin, aSnap);
void ScrollByCSSPixels(
const CSSIntPoint& aDelta, ScrollMode aMode = ScrollMode::Instant,
ScrollOrigin aOrigin = ScrollOrigin::NotSpecified) final {
mHelper.ScrollByCSSPixels(aDelta, aMode, aOrigin);
}
void ScrollSnap() final { mHelper.ScrollSnap(); }
/**

View File

@ -282,15 +282,10 @@ class nsIScrollableFrame : public nsIScrollbarMediator {
* range and / or moving in any direction; GetScrollPositionCSSPixels will be
* exactly aScrollPosition at the end of the scroll animation unless the
* SMOOTH_MSD animation is interrupted.
*
* FIXME: Drop |aSnap| argument once after we finished the migration to the
* Scroll Snap Module v1. We should alway use ENABLE_SNAP.
*/
virtual void ScrollToCSSPixels(
const CSSIntPoint& aScrollPosition,
ScrollMode aMode = ScrollMode::Instant,
nsIScrollbarMediator::ScrollSnapMode aSnap =
nsIScrollbarMediator::DEFAULT,
ScrollOrigin aOrigin = ScrollOrigin::NotSpecified) = 0;
/**
* @note This method might destroy the frame, pres shell and other objects.
@ -326,15 +321,9 @@ class nsIScrollableFrame : public nsIScrollbarMediator {
nsIScrollbarMediator::ScrollSnapMode aSnap =
nsIScrollbarMediator::DISABLE_SNAP) = 0;
/**
* FIXME: Drop |aSnap| argument once after we finished the migration to the
* Scroll Snap Module v1. We should alway use ENABLE_SNAP.
*/
virtual void ScrollByCSSPixels(
const CSSIntPoint& aDelta, ScrollMode aMode = ScrollMode::Instant,
ScrollOrigin aOrigin = ScrollOrigin::NotSpecified,
nsIScrollbarMediator::ScrollSnapMode aSnap =
nsIScrollbarMediator::DEFAULT) = 0;
ScrollOrigin aOrigin = ScrollOrigin::NotSpecified) = 0;
/**
* Perform scroll snapping, possibly resulting in a smooth scroll to