From bd98be2c5578be810919cc1e46b87f12c4ef96c5 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Fri, 20 Mar 2015 14:26:52 -0400 Subject: [PATCH] Bug 1144831 - Remove the HandleLongTapUp callback and just use HandleSingleTap instead. r=botond --- dom/ipc/PBrowser.ipdl | 1 - dom/ipc/TabChild.cpp | 9 --------- dom/ipc/TabChild.h | 3 --- dom/ipc/TabParent.cpp | 18 ------------------ dom/ipc/TabParent.h | 4 ---- .../apz/public/GeckoContentController.h | 12 ------------ gfx/layers/apz/src/AsyncPanZoomController.cpp | 10 +--------- gfx/layers/apz/util/APZEventState.cpp | 11 ----------- gfx/layers/apz/util/APZEventState.h | 4 ---- .../apz/util/ChromeProcessController.cpp | 15 --------------- gfx/layers/apz/util/ChromeProcessController.h | 2 -- .../gtest/TestAsyncPanZoomController.cpp | 14 +++++++------- layout/ipc/RenderFrameParent.cpp | 19 ------------------- widget/android/APZCCallbackHandler.cpp | 8 -------- widget/android/APZCCallbackHandler.h | 2 -- widget/windows/winrt/APZController.cpp | 7 ------- widget/windows/winrt/APZController.h | 3 --- 17 files changed, 8 insertions(+), 134 deletions(-) diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl index e531309a870d..9f945572c52a 100644 --- a/dom/ipc/PBrowser.ipdl +++ b/dom/ipc/PBrowser.ipdl @@ -528,7 +528,6 @@ child: HandleDoubleTap(CSSPoint aPoint, Modifiers aModifiers, ScrollableLayerGuid aGuid); HandleSingleTap(CSSPoint aPoint, Modifiers aModifiers, ScrollableLayerGuid aGuid); HandleLongTap(CSSPoint point, Modifiers aModifiers, ScrollableLayerGuid aGuid, uint64_t aInputBlockId); - HandleLongTapUp(CSSPoint point, Modifiers aModifiers, ScrollableLayerGuid aGuid); NotifyAPZStateChange(ViewID aViewId, APZStateChange aChange, int aArg); diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index ac43ed5da3eb..af15f787506b 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -2113,15 +2113,6 @@ TabChild::RecvHandleLongTap(const CSSPoint& aPoint, const Modifiers& aModifiers, return true; } -bool -TabChild::RecvHandleLongTapUp(const CSSPoint& aPoint, const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid) -{ - if (mGlobal && mTabChildGlobal) { - mAPZEventState->ProcessLongTapUp(aPoint, aModifiers, aGuid, GetPresShellResolution()); - } - return true; -} - bool TabChild::RecvNotifyAPZStateChange(const ViewID& aViewId, const APZStateChange& aChange, diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index 2b82d34c3d66..79e736e6a084 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -335,9 +335,6 @@ public: const Modifiers& aModifiers, const mozilla::layers::ScrollableLayerGuid& aGuid, const uint64_t& aInputBlockId) MOZ_OVERRIDE; - virtual bool RecvHandleLongTapUp(const CSSPoint& aPoint, - const Modifiers& aModifiers, - const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE; virtual bool RecvNotifyAPZStateChange(const ViewID& aViewId, const APZStateChange& aChange, const int& aArg) MOZ_OVERRIDE; diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index 5fa7505d77a2..c60e84404703 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -964,15 +964,6 @@ void TabParent::HandleLongTap(const CSSPoint& aPoint, } } -void TabParent::HandleLongTapUp(const CSSPoint& aPoint, - Modifiers aModifiers, - const ScrollableLayerGuid &aGuid) -{ - if (!mIsDestroyed) { - unused << SendHandleLongTapUp(aPoint, aModifiers, aGuid); - } -} - void TabParent::NotifyAPZStateChange(ViewID aViewId, APZStateChange aChange, int aArg) @@ -1198,15 +1189,6 @@ bool TabParent::SendHandleLongTap(const CSSPoint& aPoint, const Modifiers& aModi return PBrowserParent::SendHandleLongTap(AdjustTapToChildWidget(aPoint), aModifiers, aGuid, aInputBlockId); } -bool TabParent::SendHandleLongTapUp(const CSSPoint& aPoint, const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid) -{ - if (mIsDestroyed) { - return false; - } - - return PBrowserParent::SendHandleLongTapUp(AdjustTapToChildWidget(aPoint), aModifiers, aGuid); -} - bool TabParent::SendHandleDoubleTap(const CSSPoint& aPoint, const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid) { if (mIsDestroyed) { diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h index 7e53774a3d58..55bbb65cdef5 100644 --- a/dom/ipc/TabParent.h +++ b/dom/ipc/TabParent.h @@ -239,9 +239,6 @@ public: Modifiers aModifiers, const ScrollableLayerGuid& aGuid, uint64_t aInputBlockId); - void HandleLongTapUp(const CSSPoint& aPoint, - Modifiers aModifiers, - const ScrollableLayerGuid& aGuid); void NotifyAPZStateChange(ViewID aViewId, APZStateChange aChange, int aArg); @@ -268,7 +265,6 @@ public: bool SendRealTouchEvent(WidgetTouchEvent& event); bool SendHandleSingleTap(const CSSPoint& aPoint, const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid); bool SendHandleLongTap(const CSSPoint& aPoint, const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid, const uint64_t& aInputBlockId); - bool SendHandleLongTapUp(const CSSPoint& aPoint, const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid); bool SendHandleDoubleTap(const CSSPoint& aPoint, const Modifiers& aModifiers, const ScrollableLayerGuid& aGuid); virtual PDocumentRendererParent* diff --git a/gfx/layers/apz/public/GeckoContentController.h b/gfx/layers/apz/public/GeckoContentController.h index d901647f7bad..1114ea5d2efd 100644 --- a/gfx/layers/apz/public/GeckoContentController.h +++ b/gfx/layers/apz/public/GeckoContentController.h @@ -74,18 +74,6 @@ public: const ScrollableLayerGuid& aGuid, uint64_t aInputBlockId) = 0; - /** - * Requests handling of releasing a long tap. |aPoint| is in CSS pixels, - * relative to the current scroll offset. HandleLongTapUp will always be - * preceeded by HandleLongTap. However not all calls to HandleLongTap will - * be followed by a HandleLongTapUp (for example, if the user drags - * around between the long-tap and lifting their finger, or if content - * notifies the APZ that the long-tap event was prevent-defaulted). - */ - virtual void HandleLongTapUp(const CSSPoint& aPoint, - Modifiers aModifiers, - const ScrollableLayerGuid& aGuid) = 0; - /** * Requests sending a mozbrowserasyncscroll domevent to embedder. * |aContentRect| is in CSS pixels, relative to the current cssPage. diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index e798f71ad320..e825d8aa07d6 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -1637,15 +1637,7 @@ nsEventStatus AsyncPanZoomController::OnLongPress(const TapGestureInput& aEvent) nsEventStatus AsyncPanZoomController::OnLongPressUp(const TapGestureInput& aEvent) { APZC_LOG("%p got a long-tap-up in state %d\n", this, mState); - nsRefPtr controller = GetGeckoContentController(); - if (controller) { - CSSPoint geckoScreenPoint; - if (ConvertToGecko(aEvent.mLocalPoint, &geckoScreenPoint)) { - controller->HandleLongTapUp(geckoScreenPoint, aEvent.modifiers, GetGuid()); - return nsEventStatus_eConsumeNoDefault; - } - } - return nsEventStatus_eIgnore; + return GenerateSingleTap(aEvent.mLocalPoint, aEvent.modifiers); } nsEventStatus AsyncPanZoomController::GenerateSingleTap(const ParentLayerPoint& aPoint, mozilla::Modifiers aModifiers) { diff --git a/gfx/layers/apz/util/APZEventState.cpp b/gfx/layers/apz/util/APZEventState.cpp index 7e8d910fd837..aaaed7c0620f 100644 --- a/gfx/layers/apz/util/APZEventState.cpp +++ b/gfx/layers/apz/util/APZEventState.cpp @@ -233,17 +233,6 @@ APZEventState::ProcessLongTap(const nsCOMPtr& aUtils, mContentReceivedInputBlockCallback->Run(aGuid, aInputBlockId, eventHandled); } -void -APZEventState::ProcessLongTapUp(const CSSPoint& aPoint, - Modifiers aModifiers, - const ScrollableLayerGuid& aGuid, - float aPresShellResolution) -{ - APZES_LOG("Handling long tap up at %s\n", Stringify(aPoint).c_str()); - - ProcessSingleTap(aPoint, aModifiers, aGuid, aPresShellResolution); -} - void APZEventState::ProcessTouchEvent(const WidgetTouchEvent& aEvent, const ScrollableLayerGuid& aGuid, diff --git a/gfx/layers/apz/util/APZEventState.h b/gfx/layers/apz/util/APZEventState.h index 4e83f6c3cd4b..2b1e79295732 100644 --- a/gfx/layers/apz/util/APZEventState.h +++ b/gfx/layers/apz/util/APZEventState.h @@ -59,10 +59,6 @@ public: const ScrollableLayerGuid& aGuid, uint64_t aInputBlockId, float aPresShellResolution); - void ProcessLongTapUp(const CSSPoint& aPoint, - Modifiers aModifiers, - const ScrollableLayerGuid& aGuid, - float aPresShellResolution); void ProcessTouchEvent(const WidgetTouchEvent& aEvent, const ScrollableLayerGuid& aGuid, uint64_t aInputBlockId); diff --git a/gfx/layers/apz/util/ChromeProcessController.cpp b/gfx/layers/apz/util/ChromeProcessController.cpp index 70ee508d9c81..8ab74a3bb410 100644 --- a/gfx/layers/apz/util/ChromeProcessController.cpp +++ b/gfx/layers/apz/util/ChromeProcessController.cpp @@ -183,21 +183,6 @@ ChromeProcessController::HandleLongTap(const mozilla::CSSPoint& aPoint, Modifier aInputBlockId, GetPresShellResolution()); } -void -ChromeProcessController::HandleLongTapUp(const CSSPoint& aPoint, Modifiers aModifiers, - const ScrollableLayerGuid& aGuid) -{ - if (MessageLoop::current() != mUILoop) { - mUILoop->PostTask( - FROM_HERE, - NewRunnableMethod(this, &ChromeProcessController::HandleLongTapUp, - aPoint, aModifiers, aGuid)); - return; - } - - mAPZEventState->ProcessLongTapUp(aPoint, aModifiers, aGuid, GetPresShellResolution()); -} - void ChromeProcessController::NotifyAPZStateChange(const ScrollableLayerGuid& aGuid, APZStateChange aChange, diff --git a/gfx/layers/apz/util/ChromeProcessController.h b/gfx/layers/apz/util/ChromeProcessController.h index 371573a39155..638a9b0ccef1 100644 --- a/gfx/layers/apz/util/ChromeProcessController.h +++ b/gfx/layers/apz/util/ChromeProcessController.h @@ -50,8 +50,6 @@ public: virtual void HandleLongTap(const mozilla::CSSPoint& aPoint, Modifiers aModifiers, const ScrollableLayerGuid& aGuid, uint64_t aInputBlockId) MOZ_OVERRIDE; - virtual void HandleLongTapUp(const CSSPoint& aPoint, Modifiers aModifiers, - const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE; virtual void SendAsyncScrollDOMEvent(bool aIsRoot, const mozilla::CSSRect &aContentRect, const mozilla::CSSSize &aScrollableSize) MOZ_OVERRIDE {} virtual void NotifyAPZStateChange(const ScrollableLayerGuid& aGuid, diff --git a/gfx/tests/gtest/TestAsyncPanZoomController.cpp b/gfx/tests/gtest/TestAsyncPanZoomController.cpp index 3a05759fbd29..3972a3bb4b66 100644 --- a/gfx/tests/gtest/TestAsyncPanZoomController.cpp +++ b/gfx/tests/gtest/TestAsyncPanZoomController.cpp @@ -66,7 +66,6 @@ public: MOCK_METHOD3(HandleDoubleTap, void(const CSSPoint&, Modifiers, const ScrollableLayerGuid&)); MOCK_METHOD3(HandleSingleTap, void(const CSSPoint&, Modifiers, const ScrollableLayerGuid&)); MOCK_METHOD4(HandleLongTap, void(const CSSPoint&, Modifiers, const ScrollableLayerGuid&, uint64_t)); - MOCK_METHOD3(HandleLongTapUp, void(const CSSPoint&, Modifiers, const ScrollableLayerGuid&)); MOCK_METHOD3(SendAsyncScrollDOMEvent, void(bool aIsRoot, const CSSRect &aContentRect, const CSSSize &aScrollableSize)); MOCK_METHOD2(PostDelayedTask, void(Task* aTask, int aDelayMs)); MOCK_METHOD3(NotifyAPZStateChange, void(const ScrollableLayerGuid& aGuid, APZStateChange aChange, int aArg)); @@ -1390,9 +1389,9 @@ protected: EXPECT_CALL(*mcc, HandleLongTap(CSSPoint(10, 10), 0, apzc->GetGuid(), blockId)).Times(1); EXPECT_CALL(check, Call("postHandleLongTap")); - EXPECT_CALL(check, Call("preHandleLongTapUp")); - EXPECT_CALL(*mcc, HandleLongTapUp(CSSPoint(10, 10), 0, apzc->GetGuid())).Times(1); - EXPECT_CALL(check, Call("postHandleLongTapUp")); + EXPECT_CALL(check, Call("preHandleSingleTap")); + EXPECT_CALL(*mcc, HandleSingleTap(CSSPoint(10, 10), 0, apzc->GetGuid())).Times(1); + EXPECT_CALL(check, Call("postHandleSingleTap")); } // There is a longpress event scheduled on a timeout @@ -1419,10 +1418,11 @@ protected: // Finally, simulate lifting the finger. Since the long-press wasn't // prevent-defaulted, we should get a long-tap-up event. - check.Call("preHandleLongTapUp"); + check.Call("preHandleSingleTap"); status = TouchUp(apzc, 10, 10, time); + mcc->RunDelayedTask(); EXPECT_EQ(nsEventStatus_eConsumeDoDefault, status); - check.Call("postHandleLongTapUp"); + check.Call("postHandleSingleTap"); apzc->AssertStateIsReset(); } @@ -1488,7 +1488,7 @@ protected: status = apzc->ReceiveInputEvent(mti, nullptr); EXPECT_EQ(nsEventStatus_eConsumeDoDefault, status); - EXPECT_CALL(*mcc, HandleLongTapUp(CSSPoint(touchX, touchEndY), 0, apzc->GetGuid())).Times(0); + EXPECT_CALL(*mcc, HandleSingleTap(CSSPoint(touchX, touchEndY), 0, apzc->GetGuid())).Times(0); status = TouchUp(apzc, touchX, touchEndY, time); EXPECT_EQ(nsEventStatus_eConsumeDoDefault, status); diff --git a/layout/ipc/RenderFrameParent.cpp b/layout/ipc/RenderFrameParent.cpp index 23b9f7348ace..f6f10cf984d6 100644 --- a/layout/ipc/RenderFrameParent.cpp +++ b/layout/ipc/RenderFrameParent.cpp @@ -196,25 +196,6 @@ public: } } - virtual void HandleLongTapUp(const CSSPoint& aPoint, - Modifiers aModifiers, - const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE - { - if (MessageLoop::current() != mUILoop) { - // We have to send this message from the "UI thread" (main - // thread). - mUILoop->PostTask( - FROM_HERE, - NewRunnableMethod(this, &RemoteContentController::HandleLongTapUp, - aPoint, aModifiers, aGuid)); - return; - } - if (mRenderFrame) { - TabParent* browser = TabParent::GetFrom(mRenderFrame->Manager()); - browser->HandleLongTapUp(aPoint, aModifiers, aGuid); - } - } - void ClearRenderFrame() { mRenderFrame = nullptr; } virtual void SendAsyncScrollDOMEvent(bool aIsRoot, diff --git a/widget/android/APZCCallbackHandler.cpp b/widget/android/APZCCallbackHandler.cpp index cd2f35783ac2..0ef8d1f5e022 100644 --- a/widget/android/APZCCallbackHandler.cpp +++ b/widget/android/APZCCallbackHandler.cpp @@ -152,14 +152,6 @@ APZCCallbackHandler::HandleLongTap(const CSSPoint& aPoint, NS_LITERAL_CSTRING("Gesture:LongPress"), data)); } -void -APZCCallbackHandler::HandleLongTapUp(const CSSPoint& aPoint, - Modifiers aModifiers, - const mozilla::layers::ScrollableLayerGuid& aGuid) -{ - HandleSingleTap(aPoint, aModifiers, aGuid); -} - void APZCCallbackHandler::SendAsyncScrollDOMEvent(bool aIsRoot, const CSSRect& aContentRect, diff --git a/widget/android/APZCCallbackHandler.h b/widget/android/APZCCallbackHandler.h index faccd1487d9d..1a596a96b689 100644 --- a/widget/android/APZCCallbackHandler.h +++ b/widget/android/APZCCallbackHandler.h @@ -55,8 +55,6 @@ public: // GeckoContentController methods void HandleLongTap(const mozilla::CSSPoint& aPoint, Modifiers aModifiers, const mozilla::layers::ScrollableLayerGuid& aGuid, uint64_t aInputBlockId) MOZ_OVERRIDE; - void HandleLongTapUp(const mozilla::CSSPoint& aPoint, Modifiers aModifiers, - const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE; void SendAsyncScrollDOMEvent(bool aIsRoot, const mozilla::CSSRect& aContentRect, const mozilla::CSSSize& aScrollableSize) MOZ_OVERRIDE; void PostDelayedTask(Task* aTask, int aDelayMs) MOZ_OVERRIDE; diff --git a/widget/windows/winrt/APZController.cpp b/widget/windows/winrt/APZController.cpp index ef72721b44ee..97e79bc67e91 100644 --- a/widget/windows/winrt/APZController.cpp +++ b/widget/windows/winrt/APZController.cpp @@ -235,13 +235,6 @@ APZController::HandleLongTap(const CSSPoint& aPoint, ContentReceivedInputBlock(aInputBlockId, false); } -void -APZController::HandleLongTapUp(const CSSPoint& aPoint, - Modifiers aModifiers, - const ScrollableLayerGuid& aGuid) -{ -} - // requests that we send a mozbrowserasyncscroll domevent. not in use. void APZController::SendAsyncScrollDOMEvent(bool aIsRoot, diff --git a/widget/windows/winrt/APZController.h b/widget/windows/winrt/APZController.h index b53168d9697e..8e09052a31da 100644 --- a/widget/windows/winrt/APZController.h +++ b/widget/windows/winrt/APZController.h @@ -50,9 +50,6 @@ public: Modifiers aModifiers, const mozilla::layers::ScrollableLayerGuid& aGuid, uint64_t aInputBlockId); - virtual void HandleLongTapUp(const mozilla::CSSPoint& aPoint, - Modifiers aModifiers, - const mozilla::layers::ScrollableLayerGuid& aGuid); virtual void SendAsyncScrollDOMEvent(bool aIsRoot, const mozilla::CSSRect &aContentRect, const mozilla::CSSSize &aScrollableSize); virtual void PostDelayedTask(Task* aTask, int aDelayMs); virtual bool GetRootZoomConstraints(ZoomConstraints* aOutConstraints);