From b7850d11ba8901c29b3303e4b2f7800d310fe8ce Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Thu, 22 May 2014 17:17:39 -0400 Subject: [PATCH] Bug 998025 - Have APZ gtests clear the overscroll handoff chain when appropriate. r=kats --HG-- extra : rebase_source : 8253d35c2e0c610398c6b0d3f812552d0a09c246 --- gfx/layers/apz/src/APZCTreeManager.h | 6 +++++- gfx/tests/gtest/TestAsyncPanZoomController.cpp | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/gfx/layers/apz/src/APZCTreeManager.h b/gfx/layers/apz/src/APZCTreeManager.h index da5e9e7e697..7e2783ed468 100644 --- a/gfx/layers/apz/src/APZCTreeManager.h +++ b/gfx/layers/apz/src/APZCTreeManager.h @@ -303,6 +303,11 @@ protected: * Build the chain of APZCs that will handle overscroll for a pan starting at |aInitialTarget|. */ void BuildOverscrollHandoffChain(const nsRefPtr& aInitialTarget); + + /* + * Clear the handoff chain built in BuildOverscrollHandoffChain(). + */ + void ClearOverscrollHandoffChain(); public: /* Some helper functions to find an APZC given some identifying input. These functions lock the tree of APZCs while they find the right one, and then return an addref'd @@ -332,7 +337,6 @@ private: ScrollableLayerGuid* aOutTargetGuid); void UpdateZoomConstraintsRecursively(AsyncPanZoomController* aApzc, const ZoomConstraints& aConstraints); - void ClearOverscrollHandoffChain(); /** * Recursive helper function to build the APZC tree. The tree of APZC instances has diff --git a/gfx/tests/gtest/TestAsyncPanZoomController.cpp b/gfx/tests/gtest/TestAsyncPanZoomController.cpp index c1ccde5a58a..5c3c69bab05 100644 --- a/gfx/tests/gtest/TestAsyncPanZoomController.cpp +++ b/gfx/tests/gtest/TestAsyncPanZoomController.cpp @@ -143,10 +143,13 @@ public: class TestAPZCTreeManager : public APZCTreeManager { public: - // Expose this so test code can call it directly. + // Expose these so test code can call it directly. void BuildOverscrollHandoffChain(AsyncPanZoomController* aApzc) { APZCTreeManager::BuildOverscrollHandoffChain(aApzc); } + void ClearOverscrollHandoffChain() { + APZCTreeManager::ClearOverscrollHandoffChain(); + } }; static @@ -235,6 +238,10 @@ void ApzcPan(AsyncPanZoomController* apzc, aTime += TIME_BETWEEN_TOUCH_EVENT; mti.mTouches.AppendElement(SingleTouchData(0, ScreenIntPoint(10, aTouchEndY), ScreenSize(0, 0), 0, 0)); status = apzc->ReceiveInputEvent(mti); + + // Since we've explicitly built the overscroll handoff chain before + // touch-start, we need to explicitly clear it after touch-end. + aTreeManager->ClearOverscrollHandoffChain(); } static