diff --git a/gfx/layers/composite/APZCTreeManager.h b/gfx/layers/composite/APZCTreeManager.h index 5d3e2e12f43..79a62763ad6 100644 --- a/gfx/layers/composite/APZCTreeManager.h +++ b/gfx/layers/composite/APZCTreeManager.h @@ -214,7 +214,6 @@ public: * Sets allowed touch behavior values for current touch-session for specific apzc (determined by guid). * 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 touch-session. */ void SetAllowedTouchBehavior(const ScrollableLayerGuid& aGuid, const nsTArray& aValues); diff --git a/gfx/layers/ipc/AsyncPanZoomController.h b/gfx/layers/ipc/AsyncPanZoomController.h index c44a5d0a855..1535b3b3f7b 100644 --- a/gfx/layers/ipc/AsyncPanZoomController.h +++ b/gfx/layers/ipc/AsyncPanZoomController.h @@ -315,8 +315,6 @@ public: * Sets allowed touch behavior for current touch session. * This method is invoked by the APZCTreeManager which in its turn invoked by * the widget after performing touch-action values retrieving. - * Must be called after receiving the TOUCH_START even that started the - * touch session. */ void SetAllowedTouchBehavior(const nsTArray& aBehaviors); diff --git a/gfx/tests/gtest/TestAsyncPanZoomController.cpp b/gfx/tests/gtest/TestAsyncPanZoomController.cpp index 3fffa214284..357f84d730a 100644 --- a/gfx/tests/gtest/TestAsyncPanZoomController.cpp +++ b/gfx/tests/gtest/TestAsyncPanZoomController.cpp @@ -168,14 +168,7 @@ FrameMetrics TestFrameMetrics() { * consumed them and triggered scrolling behavior. */ static -void ApzcPan(AsyncPanZoomController* apzc, - TestAPZCTreeManager* aTreeManager, - int& aTime, - int aTouchStartY, - int aTouchEndY, - bool expectIgnoredPan = false, - bool hasTouchListeners = false, - nsTArray* aAllowedTouchBehaviors = nullptr) { +void ApzcPan(AsyncPanZoomController* apzc, TestAPZCTreeManager* aTreeManager, int& aTime, int aTouchStartY, int aTouchEndY, bool expectIgnoredPan = false, bool hasTouchListeners = false) { const int TIME_BETWEEN_TOUCH_EVENT = 100; const int OVERCOME_TOUCH_TOLERANCE = 100; @@ -205,11 +198,6 @@ void ApzcPan(AsyncPanZoomController* apzc, EXPECT_EQ(status, touchStartStatus); // APZC should be in TOUCHING state - // Allowed touch behaviours must be set after sending touch-start. - if (aAllowedTouchBehaviors) { - apzc->SetAllowedTouchBehavior(*aAllowedTouchBehaviors); - } - nsEventStatus touchMoveStatus; if (expectIgnoredPan) { // APZC should ignore panning, be in TOUCHING state and therefore return eIgnore. @@ -266,11 +254,12 @@ void DoPanTest(bool aShouldTriggerScroll, bool aShouldUseTouchAction, uint32_t a ScreenPoint pointOut; ViewTransform viewTransformOut; - nsTArray allowedTouchBehaviors; - allowedTouchBehaviors.AppendElement(aBehavior); + nsTArray values; + values.AppendElement(aBehavior); // Pan down - ApzcPan(apzc, tm, time, touchStart, touchEnd, !aShouldTriggerScroll, false, &allowedTouchBehaviors); + apzc->SetAllowedTouchBehavior(values); + ApzcPan(apzc, tm, time, touchStart, touchEnd, !aShouldTriggerScroll); apzc->SampleContentTransformForFrame(testStartTime, &viewTransformOut, pointOut); if (aShouldTriggerScroll) { @@ -282,7 +271,8 @@ void DoPanTest(bool aShouldTriggerScroll, bool aShouldUseTouchAction, uint32_t a } // Pan back - ApzcPan(apzc, tm, time, touchEnd, touchStart, !aShouldTriggerScroll, false, &allowedTouchBehaviors); + apzc->SetAllowedTouchBehavior(values); + ApzcPan(apzc, tm, time, touchEnd, touchStart, !aShouldTriggerScroll); apzc->SampleContentTransformForFrame(testStartTime, &viewTransformOut, pointOut); EXPECT_EQ(pointOut, ScreenPoint()); @@ -623,10 +613,11 @@ TEST_F(AsyncPanZoomControllerTester, PanWithPreventDefault) { ViewTransform viewTransformOut; // Pan down - nsTArray allowedTouchBehaviors; - allowedTouchBehaviors.AppendElement(mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN); + nsTArray values; + values.AppendElement(mozilla::layers::AllowedTouchBehavior::VERTICAL_PAN); apzc->SetTouchActionEnabled(true); - ApzcPan(apzc, tm, time, touchStart, touchEnd, true, true, &allowedTouchBehaviors); + apzc->SetAllowedTouchBehavior(values); + ApzcPan(apzc, tm, time, touchStart, touchEnd, true, true); // Send the signal that content has handled and preventDefaulted the touch // events. This flushes the event queue. @@ -755,18 +746,16 @@ DoLongPressTest(bool aShouldUseTouchAction, uint32_t aBehavior) { apzc->NotifyLayersUpdated(TestFrameMetrics(), true); apzc->UpdateZoomConstraints(ZoomConstraints(false, false, CSSToScreenScale(1.0), CSSToScreenScale(1.0))); + nsTArray values; + values.AppendElement(aBehavior); apzc->SetTouchActionEnabled(aShouldUseTouchAction); + apzc->SetAllowedTouchBehavior(values); int time = 0; nsEventStatus status = ApzcDown(apzc, 10, 10, time); EXPECT_EQ(nsEventStatus_eConsumeNoDefault, status); - // SetAllowedTouchBehavior() must be called after sending touch-start. - nsTArray allowedTouchBehaviors; - allowedTouchBehaviors.AppendElement(aBehavior); - apzc->SetAllowedTouchBehavior(allowedTouchBehaviors); - MockFunction check; {