Bug 1259301 - Remove GeckoContentController::RequestFlingSnap(). r=kats
MozReview-Commit-ID: DRntzo1hohv
--- a/gfx/layers/apz/public/GeckoContentController.h
+++ b/gfx/layers/apz/public/GeckoContentController.h
@@ -32,24 +32,16 @@ public:
/**
* Requests a paint of the given FrameMetrics |aFrameMetrics| from Gecko.
* Implementations per-platform are responsible for actually handling this.
* This method will always be called on the Gecko main thread.
*/
virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics) = 0;
/**
- * Requests handling of a scroll snapping at the end of a fling gesture for
- * the scrollable frame with the given scroll id. aDestination specifies the
- * expected landing position of the fling if no snapping were to be performed.
- */
- virtual void RequestFlingSnap(const FrameMetrics::ViewID& aScrollId,
- const mozilla::CSSPoint& aDestination) = 0;
-
- /**
* Acknowledges the recipt of a scroll offset update for the scrollable
* frame with the given scroll id. This is used to maintain consistency
* between APZ and other sources of scroll changes.
*/
virtual void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
const uint32_t& aScrollGeneration) = 0;
/**
--- a/gfx/layers/apz/util/APZCCallbackHelper.cpp
+++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp
@@ -326,56 +326,16 @@ APZCCallbackHelper::InitializeRootDispla
// nsRootBoxFrame::BuildDisplayList.
nsLayoutUtils::SetDisplayPortMargins(content, aPresShell, ScreenMargin(), 0,
nsLayoutUtils::RepaintMode::DoNotRepaint);
nsLayoutUtils::SetZeroMarginDisplayPortOnAsyncScrollableAncestors(
content->GetPrimaryFrame(), nsLayoutUtils::RepaintMode::DoNotRepaint);
}
}
-class FlingSnapEvent : public nsRunnable
-{
- typedef mozilla::layers::FrameMetrics::ViewID ViewID;
-
-public:
- FlingSnapEvent(const ViewID& aScrollId,
- const mozilla::CSSPoint& aDestination)
- : mScrollId(aScrollId)
- , mDestination(aDestination)
- {
- }
-
- NS_IMETHOD Run() {
- MOZ_ASSERT(NS_IsMainThread());
-
- nsIScrollableFrame* sf = nsLayoutUtils::FindScrollableFrameFor(mScrollId);
- if (sf) {
- sf->FlingSnap(mDestination);
- }
-
- return NS_OK;
- }
-
-protected:
- ViewID mScrollId;
- mozilla::CSSPoint mDestination;
-};
-
-void
-APZCCallbackHelper::RequestFlingSnap(const FrameMetrics::ViewID& aScrollId,
- const mozilla::CSSPoint& aDestination)
-{
- nsCOMPtr<nsIRunnable> r1 = new FlingSnapEvent(aScrollId, aDestination);
- if (!NS_IsMainThread()) {
- NS_DispatchToMainThread(r1);
- } else {
- r1->Run();
- }
-}
-
class AcknowledgeScrollUpdateEvent : public nsRunnable
{
typedef mozilla::layers::FrameMetrics::ViewID ViewID;
public:
AcknowledgeScrollUpdateEvent(const ViewID& aScrollId, const uint32_t& aScrollGeneration)
: mScrollId(aScrollId)
, mScrollGeneration(aScrollGeneration)
--- a/gfx/layers/apz/util/APZCCallbackHelper.h
+++ b/gfx/layers/apz/util/APZCCallbackHelper.h
@@ -61,24 +61,16 @@ public:
static bool GetOrCreateScrollIdentifiers(nsIContent* aContent,
uint32_t* aPresShellIdOut,
FrameMetrics::ViewID* aViewIdOut);
/* Initialize a zero-margin displayport on the root document element of the
given presShell. */
static void InitializeRootDisplayport(nsIPresShell* aPresShell);
- /* Tell layout to perform scroll snapping for the scrollable frame with the
- * given scroll id. aDestination specifies the expected landing position of
- * a current fling or scrolling animation that should be used to select
- * the scroll snap point.
- */
- static void RequestFlingSnap(const FrameMetrics::ViewID& aScrollId,
- const mozilla::CSSPoint& aDestination);
-
/* Tell layout that we received the scroll offset update for the given view ID, so
that it accepts future scroll offset updates from APZ. */
static void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
const uint32_t& aScrollGeneration);
/* Get the pres shell associated with the root content document enclosing |aContent|. */
static nsIPresShell* GetRootContentDocumentPresShellForContent(nsIContent* aContent);
--- a/gfx/layers/apz/util/ChromeProcessController.cpp
+++ b/gfx/layers/apz/util/ChromeProcessController.cpp
@@ -64,23 +64,16 @@ ChromeProcessController::RequestContentR
void
ChromeProcessController::PostDelayedTask(Task* aTask, int aDelayMs)
{
MessageLoop::current()->PostDelayedTask(FROM_HERE, aTask, aDelayMs);
}
void
-ChromeProcessController::RequestFlingSnap(const FrameMetrics::ViewID& aScrollId,
- const mozilla::CSSPoint& aDestination)
-{
- APZCCallbackHelper::RequestFlingSnap(aScrollId, aDestination);
-}
-
-void
ChromeProcessController::AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
const uint32_t& aScrollGeneration)
{
APZCCallbackHelper::AcknowledgeScrollUpdate(aScrollId, aScrollGeneration);
}
void
ChromeProcessController::Destroy()
--- a/gfx/layers/apz/util/ChromeProcessController.h
+++ b/gfx/layers/apz/util/ChromeProcessController.h
@@ -35,18 +35,16 @@ protected:
public:
explicit ChromeProcessController(nsIWidget* aWidget, APZEventState* aAPZEventState, APZCTreeManager* aAPZCTreeManager);
~ChromeProcessController();
virtual void Destroy() override;
// GeckoContentController interface
virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics) override;
virtual void PostDelayedTask(Task* aTask, int aDelayMs) override;
- virtual void RequestFlingSnap(const FrameMetrics::ViewID& aScrollId,
- const mozilla::CSSPoint& aDestination) override;
virtual void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
const uint32_t& aScrollGeneration) override;
virtual void HandleDoubleTap(const mozilla::CSSPoint& aPoint, Modifiers aModifiers,
const ScrollableLayerGuid& aGuid) override;
virtual void HandleSingleTap(const mozilla::CSSPoint& aPoint, Modifiers aModifiers,
const ScrollableLayerGuid& aGuid) override;
virtual void HandleLongTap(const mozilla::CSSPoint& aPoint, Modifiers aModifiers,
--- a/gfx/layers/ipc/APZChild.cpp
+++ b/gfx/layers/ipc/APZChild.cpp
@@ -90,24 +90,16 @@ APZChild::~APZChild()
bool
APZChild::RecvUpdateFrame(const FrameMetrics& aFrameMetrics)
{
return mBrowser->UpdateFrame(aFrameMetrics);
}
bool
-APZChild::RecvRequestFlingSnap(const FrameMetrics::ViewID& aScrollId,
- const mozilla::CSSPoint& aDestination)
-{
- APZCCallbackHelper::RequestFlingSnap(aScrollId, aDestination);
- return true;
-}
-
-bool
APZChild::RecvAcknowledgeScrollUpdate(const ViewID& aScrollId,
const uint32_t& aScrollGeneration)
{
APZCCallbackHelper::AcknowledgeScrollUpdate(aScrollId, aScrollGeneration);
return true;
}
bool
--- a/gfx/layers/ipc/APZChild.h
+++ b/gfx/layers/ipc/APZChild.h
@@ -23,19 +23,16 @@ class APZChild final : public PAPZChild
{
public:
static APZChild* Create(const dom::TabId& aTabId);
~APZChild();
virtual bool RecvUpdateFrame(const FrameMetrics& frame) override;
- virtual bool RecvRequestFlingSnap(const ViewID& aScrollID,
- const CSSPoint& aDestination) override;
-
virtual bool RecvAcknowledgeScrollUpdate(const ViewID& aScrollId,
const uint32_t& aScrollGeneration) override;
virtual bool RecvHandleDoubleTap(const CSSPoint& aPoint,
const Modifiers& aModifiers,
const ScrollableLayerGuid& aGuid) override;
virtual bool RecvHandleSingleTap(const CSSPoint& aPoint,
--- a/gfx/layers/ipc/PAPZ.ipdl
+++ b/gfx/layers/ipc/PAPZ.ipdl
@@ -84,17 +84,16 @@ parent:
MaybeZoomConstraints aConstraints);
child:
async UpdateFrame(FrameMetrics frame);
// The following methods correspond to functions on the GeckoContentController
// interface in gfx/layers/apz/public/GeckoContentController.h. Refer to documentation
// in that file for these functions.
- async RequestFlingSnap(ViewID aScrollID, CSSPoint aDestination);
async AcknowledgeScrollUpdate(ViewID aScrollId, uint32_t aScrollGeneration);
async HandleDoubleTap(CSSPoint aPoint, Modifiers aModifiers, ScrollableLayerGuid aGuid);
async HandleSingleTap(CSSPoint aPoint, Modifiers aModifiers, ScrollableLayerGuid aGuid, bool aCallTakeFocusForClickFromTap);
async HandleLongTap(CSSPoint point, Modifiers aModifiers, ScrollableLayerGuid aGuid, uint64_t aInputBlockId);
async NotifyAPZStateChange(ViewID aViewId, APZStateChange aChange, int aArg);
async NotifyFlushComplete();
async __delete__();
--- a/gfx/layers/ipc/RemoteContentController.cpp
+++ b/gfx/layers/ipc/RemoteContentController.cpp
@@ -47,34 +47,16 @@ RemoteContentController::RequestContentR
{
MOZ_ASSERT(NS_IsMainThread());
if (CanSend()) {
Unused << SendUpdateFrame(aFrameMetrics);
}
}
void
-RemoteContentController::RequestFlingSnap(const FrameMetrics::ViewID& aScrollId,
- const mozilla::CSSPoint& aDestination)
-{
- if (MessageLoop::current() != mUILoop) {
- // We have to send this message from the "UI thread" (main
- // thread).
- mUILoop->PostTask(
- FROM_HERE,
- NewRunnableMethod(this, &RemoteContentController::RequestFlingSnap,
- aScrollId, aDestination));
- return;
- }
- if (CanSend()) {
- Unused << SendRequestFlingSnap(aScrollId, aDestination);
- }
-}
-
-void
RemoteContentController::AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
const uint32_t& aScrollGeneration)
{
if (MessageLoop::current() != mUILoop) {
// We have to send this message from the "UI thread" (main
// thread).
mUILoop->PostTask(
FROM_HERE,
--- a/gfx/layers/ipc/RemoteContentController.h
+++ b/gfx/layers/ipc/RemoteContentController.h
@@ -37,19 +37,16 @@ public:
explicit RemoteContentController(uint64_t aLayersId,
dom::TabParent* aBrowserParent);
virtual ~RemoteContentController();
// Needs to be called on the main thread.
virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics) override;
- virtual void RequestFlingSnap(const FrameMetrics::ViewID& aScrollId,
- const mozilla::CSSPoint& aDestination) override;
-
virtual void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
const uint32_t& aScrollGeneration) override;
virtual void HandleDoubleTap(const CSSPoint& aPoint,
Modifiers aModifiers,
const ScrollableLayerGuid& aGuid) override;
virtual void HandleSingleTap(const CSSPoint& aPoint,
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -3911,22 +3911,16 @@ ScrollFrameHelper::ScrollSnap(nsIScrolla
velocity.y * flingSensitivity);
predictedOffset.Clamp(maxOffset);
nsPoint pos = GetScrollPosition();
nsPoint destinationPos = pos + predictedOffset;
ScrollSnap(destinationPos, aMode);
}
void
-ScrollFrameHelper::FlingSnap(const mozilla::CSSPoint& aDestination)
-{
- ScrollSnap(CSSPoint::ToAppUnits(aDestination));
-}
-
-void
ScrollFrameHelper::ScrollSnap(const nsPoint &aDestination,
nsIScrollableFrame::ScrollMode aMode)
{
nsRect scrollRange = GetScrollRangeForClamping();
nsPoint pos = GetScrollPosition();
nsPoint snapDestination = scrollRange.ClampPoint(aDestination);
if (GetSnapPointForDestination(nsIScrollableFrame::DEVICE_PIXELS,
pos,
--- a/layout/generic/nsGfxScrollFrame.h
+++ b/layout/generic/nsGfxScrollFrame.h
@@ -199,17 +199,16 @@ public:
mScrollPort.XMost() - mScrolledFrame->GetRect().XMost();
pt.y = mScrollPort.y - mScrolledFrame->GetPosition().y;
return pt;
}
nsRect GetScrollRange() const;
// Get the scroll range assuming the scrollport has size (aWidth, aHeight).
nsRect GetScrollRange(nscoord aWidth, nscoord aHeight) const;
nsSize GetScrollPositionClampingScrollPortSize() const;
- void FlingSnap(const mozilla::CSSPoint& aDestination);
void ScrollSnap(nsIScrollableFrame::ScrollMode aMode = nsIScrollableFrame::SMOOTH_MSD);
void ScrollSnap(const nsPoint &aDestination,
nsIScrollableFrame::ScrollMode aMode = nsIScrollableFrame::SMOOTH_MSD);
protected:
nsRect GetScrollRangeForClamping() const;
public:
@@ -836,19 +835,16 @@ public:
virtual void ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit, ScrollMode aMode,
nsIntPoint* aOverflow, nsIAtom* aOrigin = nullptr,
nsIScrollableFrame::ScrollMomentum aMomentum = nsIScrollableFrame::NOT_MOMENTUM,
nsIScrollbarMediator::ScrollSnapMode aSnap
= nsIScrollbarMediator::DISABLE_SNAP)
override {
mHelper.ScrollBy(aDelta, aUnit, aMode, aOverflow, aOrigin, aMomentum, aSnap);
}
- virtual void FlingSnap(const mozilla::CSSPoint& aDestination) override {
- mHelper.FlingSnap(aDestination);
- }
virtual void ScrollSnap() override {
mHelper.ScrollSnap();
}
/**
* @note This method might destroy the frame, pres shell and other objects.
*/
virtual void ScrollToRestoredPosition() override {
mHelper.ScrollToRestoredPosition();
@@ -1251,19 +1247,16 @@ public:
virtual void ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit, ScrollMode aMode,
nsIntPoint* aOverflow, nsIAtom* aOrigin = nullptr,
nsIScrollableFrame::ScrollMomentum aMomentum = nsIScrollableFrame::NOT_MOMENTUM,
nsIScrollbarMediator::ScrollSnapMode aSnap
= nsIScrollbarMediator::DISABLE_SNAP)
override {
mHelper.ScrollBy(aDelta, aUnit, aMode, aOverflow, aOrigin, aMomentum, aSnap);
}
- virtual void FlingSnap(const mozilla::CSSPoint& aDestination) override {
- mHelper.FlingSnap(aDestination);
- }
virtual void ScrollSnap() override {
mHelper.ScrollSnap();
}
/**
* @note This method might destroy the frame, pres shell and other objects.
*/
virtual void ScrollToRestoredPosition() override {
mHelper.ScrollToRestoredPosition();
--- a/layout/generic/nsIScrollableFrame.h
+++ b/layout/generic/nsIScrollableFrame.h
@@ -267,26 +267,16 @@ public:
nsIntPoint* aOverflow = nullptr,
nsIAtom* aOrigin = nullptr,
ScrollMomentum aMomentum = NOT_MOMENTUM,
nsIScrollbarMediator::ScrollSnapMode aSnap
= nsIScrollbarMediator::DISABLE_SNAP) = 0;
/**
* Perform scroll snapping, possibly resulting in a smooth scroll to
- * maintain the scroll snap position constraints. A predicted landing
- * position determined by the APZC is used to select the best matching
- * snap point, allowing touchscreen fling gestures to navigate between
- * snap points.
- * @param aDestination The desired landing position of the fling, which
- * is used to select the best matching snap point.
- */
- virtual void FlingSnap(const mozilla::CSSPoint& aDestination) = 0;
- /**
- * Perform scroll snapping, possibly resulting in a smooth scroll to
* maintain the scroll snap position constraints. Velocity sampled from
* main thread scrolling is used to determine best matching snap point
* when called after a fling gesture on a trackpad or mouse wheel.
*/
virtual void ScrollSnap() = 0;
/**
* @note This method might destroy the frame, pres shell and other objects.