Bug 1361881 - Remove unused function AdjustScrollForSurfaceShift from APZCTreeManager IPC stack r=kats draft
authorRandall Barker <rbarker@mozilla.com>
Wed, 03 May 2017 10:56:47 -0700
changeset 572848 868db895fe0cce19b305034101e9afdf8fdb4fe1
parent 572847 3e3f2928daccd1f36eca9f81719a24d1e6bf2397
child 572851 0ca8725afff8868b07e34c81791cbced6a4b5dc5
push id57195
push userbmo:rbarker@mozilla.com
push dateThu, 04 May 2017 20:08:56 +0000
reviewerskats
bugs1361881
milestone55.0a1
Bug 1361881 - Remove unused function AdjustScrollForSurfaceShift from APZCTreeManager IPC stack r=kats APZCTreeManager::AdjustScrollForSurfaceShift is only called from the compositor now, so there is no need to expose this API for callers in widget code. MozReview-Commit-ID: BySCQ8N4SuM
gfx/layers/apz/public/IAPZCTreeManager.h
gfx/layers/apz/src/APZCTreeManager.h
gfx/layers/ipc/APZCTreeManagerChild.cpp
gfx/layers/ipc/APZCTreeManagerChild.h
gfx/layers/ipc/APZCTreeManagerParent.cpp
gfx/layers/ipc/APZCTreeManagerParent.h
gfx/layers/ipc/PAPZCTreeManager.ipdl
widget/android/nsWindow.cpp
--- a/gfx/layers/apz/public/IAPZCTreeManager.h
+++ b/gfx/layers/apz/public/IAPZCTreeManager.h
@@ -152,24 +152,16 @@ public:
 
   /**
    * Cancels any currently running animation. Note that all this does is set the
    * state of the AsyncPanZoomController back to NOTHING, but it is the
    * animation's responsibility to check this before advancing.
    */
   virtual void CancelAnimation(const ScrollableLayerGuid &aGuid) = 0;
 
-  /**
-   * Adjusts the root APZC to compensate for a shift in the surface. See the
-   * documentation on AsyncPanZoomController::AdjustScrollForSurfaceShift for
-   * some more details. This is only currently needed due to surface shifts
-   * caused by the dynamic toolbar on Android.
-   */
-  virtual void AdjustScrollForSurfaceShift(const ScreenPoint& aShift) = 0;
-
   virtual void SetDPI(float aDpiValue) = 0;
 
   /**
    * Sets allowed touch behavior values for current touch-session for specific
    * input block (determined by aInputBlock).
    * Should be invoked by the widget. Each value of the aValues arrays
    * corresponds to the different touch point that is currently active.
    * Must be called after receiving the TOUCH_START event that starts the
--- a/gfx/layers/apz/src/APZCTreeManager.h
+++ b/gfx/layers/apz/src/APZCTreeManager.h
@@ -250,17 +250,17 @@ public:
   void CancelAnimation(const ScrollableLayerGuid &aGuid) override;
 
   /**
    * Adjusts the root APZC to compensate for a shift in the surface. See the
    * documentation on AsyncPanZoomController::AdjustScrollForSurfaceShift for
    * some more details. This is only currently needed due to surface shifts
    * caused by the dynamic toolbar on Android.
    */
-  void AdjustScrollForSurfaceShift(const ScreenPoint& aShift) override;
+  void AdjustScrollForSurfaceShift(const ScreenPoint& aShift);
 
   /**
    * Calls Destroy() on all APZC instances attached to the tree, and resets the
    * tree back to empty. This function must be called exactly once during the
    * lifetime of this APZCTreeManager, when this APZCTreeManager is no longer
    * needed. Failing to call this function may prevent objects from being freed
    * properly.
    */
--- a/gfx/layers/ipc/APZCTreeManagerChild.cpp
+++ b/gfx/layers/ipc/APZCTreeManagerChild.cpp
@@ -161,22 +161,16 @@ APZCTreeManagerChild::UpdateZoomConstrai
 
 void
 APZCTreeManagerChild::CancelAnimation(const ScrollableLayerGuid &aGuid)
 {
   SendCancelAnimation(aGuid);
 }
 
 void
-APZCTreeManagerChild::AdjustScrollForSurfaceShift(const ScreenPoint& aShift)
-{
-  SendAdjustScrollForSurfaceShift(aShift);
-}
-
-void
 APZCTreeManagerChild::SetDPI(float aDpiValue)
 {
   SendSetDPI(aDpiValue);
 }
 
 void
 APZCTreeManagerChild::SetAllowedTouchBehavior(
     uint64_t aInputBlockId,
--- a/gfx/layers/ipc/APZCTreeManagerChild.h
+++ b/gfx/layers/ipc/APZCTreeManagerChild.h
@@ -50,19 +50,16 @@ public:
   UpdateZoomConstraints(
           const ScrollableLayerGuid& aGuid,
           const Maybe<ZoomConstraints>& aConstraints) override;
 
   void
   CancelAnimation(const ScrollableLayerGuid &aGuid) override;
 
   void
-  AdjustScrollForSurfaceShift(const ScreenPoint& aShift) override;
-
-  void
   SetDPI(float aDpiValue) override;
 
   void
   SetAllowedTouchBehavior(
           uint64_t aInputBlockId,
           const nsTArray<TouchBehaviorFlags>& aValues) override;
 
   void
--- a/gfx/layers/ipc/APZCTreeManagerParent.cpp
+++ b/gfx/layers/ipc/APZCTreeManagerParent.cpp
@@ -218,23 +218,16 @@ APZCTreeManagerParent::RecvCancelAnimati
     return IPC_FAIL_NO_REASON(this);
   }
 
   mTreeManager->CancelAnimation(aGuid);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
-APZCTreeManagerParent::RecvAdjustScrollForSurfaceShift(const ScreenPoint& aShift)
-{
-  mTreeManager->AdjustScrollForSurfaceShift(aShift);
-  return IPC_OK();
-}
-
-mozilla::ipc::IPCResult
 APZCTreeManagerParent::RecvSetDPI(const float& aDpiValue)
 {
   mTreeManager->SetDPI(aDpiValue);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 APZCTreeManagerParent::RecvSetAllowedTouchBehavior(
--- a/gfx/layers/ipc/APZCTreeManagerParent.h
+++ b/gfx/layers/ipc/APZCTreeManagerParent.h
@@ -98,19 +98,16 @@ public:
   RecvUpdateZoomConstraints(
           const ScrollableLayerGuid& aGuid,
           const MaybeZoomConstraints& aConstraints) override;
 
   mozilla::ipc::IPCResult
   RecvCancelAnimation(const ScrollableLayerGuid& aGuid) override;
 
   mozilla::ipc::IPCResult
-  RecvAdjustScrollForSurfaceShift(const ScreenPoint& aShift) override;
-
-  mozilla::ipc::IPCResult
   RecvSetDPI(const float& aDpiValue) override;
 
   mozilla::ipc::IPCResult
   RecvSetAllowedTouchBehavior(
           const uint64_t& aInputBlockId,
           nsTArray<TouchBehaviorFlags>&& aValues) override;
 
   mozilla::ipc::IPCResult
--- a/gfx/layers/ipc/PAPZCTreeManager.ipdl
+++ b/gfx/layers/ipc/PAPZCTreeManager.ipdl
@@ -63,18 +63,16 @@ parent:
   async ContentReceivedInputBlock(uint64_t aInputBlockId, bool PreventDefault);
 
   async SetTargetAPZC(uint64_t aInputBlockId, ScrollableLayerGuid[] Targets);
 
   async UpdateZoomConstraints(ScrollableLayerGuid aGuid, MaybeZoomConstraints aConstraints);
 
   async CancelAnimation(ScrollableLayerGuid aGuid);
 
-  async AdjustScrollForSurfaceShift(ScreenPoint aShift);
-
   async SetDPI(float aDpiValue);
 
   async SetAllowedTouchBehavior(uint64_t aInputBlockId, TouchBehaviorFlags[] aValues);
 
   async StartScrollbarDrag(ScrollableLayerGuid aGuid, AsyncDragMetrics aDragMetrics);
 
   async SetLongTapEnabled(bool aTapGestureEnabled);
 
--- a/widget/android/nsWindow.cpp
+++ b/widget/android/nsWindow.cpp
@@ -423,32 +423,16 @@ public:
 
         NativePanZoomController::GlobalRef npzc = mNPZC;
         AndroidBridge::Bridge()->PostTaskToUiThread(NewRunnableFunction(
                 static_cast<void(*)(const NPZCRef&)>(callDestroy),
                 mozilla::Move(npzc)), 0);
     }
 
 public:
-    void AdjustScrollForSurfaceShift(float aX, float aY)
-    {
-        MOZ_ASSERT(AndroidBridge::IsJavaUiThread());
-
-        RefPtr<IAPZCTreeManager> controller;
-
-        if (LockedWindowPtr window{mWindow}) {
-            controller = window->mAPZC;
-        }
-
-        if (controller) {
-            controller->AdjustScrollForSurfaceShift(
-                ScreenPoint(aX, aY));
-        }
-    }
-
     void SetIsLongpressEnabled(bool aIsLongpressEnabled)
     {
         MOZ_ASSERT(AndroidBridge::IsJavaUiThread());
 
         RefPtr<IAPZCTreeManager> controller;
 
         if (LockedWindowPtr window{mWindow}) {
             controller = window->mAPZC;