Bug 1127066 - Implement ChromeProcessController::HandleLongTapUp(). r=kats
authorBotond Ballo <botond@mozilla.com>
Mon, 09 Feb 2015 18:20:15 -0500
changeset 242489 b9150539d7873d419d94c15d8469bb60dc111957
parent 242488 40a4e0b2dd0807049cd47aa816cf8721fc961228
child 242490 07479758ab6870988d3165990e8d4b468628aeba
push id659
push userahalberstadt@mozilla.com
push dateThu, 12 Feb 2015 16:07:42 +0000
reviewerskats
bugs1127066
milestone38.0a1
Bug 1127066 - Implement ChromeProcessController::HandleLongTapUp(). r=kats
dom/ipc/TabChild.cpp
gfx/layers/apz/util/APZEventState.cpp
gfx/layers/apz/util/APZEventState.h
gfx/layers/apz/util/ChromeProcessController.cpp
gfx/layers/apz/util/ChromeProcessController.h
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -2097,17 +2097,19 @@ TabChild::RecvHandleLongTap(const CSSPoi
         aInputBlockId, GetPresShellResolution());
   }
   return true;
 }
 
 bool
 TabChild::RecvHandleLongTapUp(const CSSPoint& aPoint, const ScrollableLayerGuid& aGuid)
 {
-  RecvHandleSingleTap(aPoint, aGuid);
+  if (mGlobal && mTabChildGlobal) {
+    mAPZEventState->ProcessLongTapUp(aPoint, aGuid, GetPresShellResolution());
+  }
   return true;
 }
 
 bool
 TabChild::RecvNotifyAPZStateChange(const ViewID& aViewId,
                                    const APZStateChange& aChange,
                                    const int& aArg)
 {
--- a/gfx/layers/apz/util/APZEventState.cpp
+++ b/gfx/layers/apz/util/APZEventState.cpp
@@ -166,16 +166,26 @@ APZEventState::ProcessLongTap(const nsCO
     eventHandled = (status == nsEventStatus_eConsumeNoDefault);
     APZES_LOG("MOZLONGTAP event handled: %d\n", eventHandled);
   }
 
   mContentReceivedInputBlockCallback->Run(aGuid, aInputBlockId, eventHandled);
 }
 
 void
+APZEventState::ProcessLongTapUp(const CSSPoint& aPoint,
+                                const ScrollableLayerGuid& aGuid,
+                                float aPresShellResolution)
+{
+  APZES_LOG("Handling long tap up at %s\n", Stringify(aPoint).c_str());
+
+  ProcessSingleTap(aPoint, aGuid, aPresShellResolution);
+}
+
+void
 APZEventState::ProcessTouchEvent(const WidgetTouchEvent& aEvent,
                                  const ScrollableLayerGuid& aGuid,
                                  uint64_t aInputBlockId)
 {
   if (aEvent.message == NS_TOUCH_START && aEvent.touches.Length() > 0) {
     mActiveElementManager->SetTargetElement(aEvent.touches[0]->GetTarget());
   }
 
--- a/gfx/layers/apz/util/APZEventState.h
+++ b/gfx/layers/apz/util/APZEventState.h
@@ -52,16 +52,19 @@ public:
   void ProcessSingleTap(const CSSPoint& aPoint,
                         const ScrollableLayerGuid& aGuid,
                         float aPresShellResolution);
   void ProcessLongTap(const nsCOMPtr<nsIDOMWindowUtils>& aUtils,
                       const CSSPoint& aPoint,
                       const ScrollableLayerGuid& aGuid,
                       uint64_t aInputBlockId,
                       float aPresShellResolution);
+  void ProcessLongTapUp(const CSSPoint& aPoint,
+                        const ScrollableLayerGuid& aGuid,
+                        float aPresShellResolution);
   void ProcessTouchEvent(const WidgetTouchEvent& aEvent,
                          const ScrollableLayerGuid& aGuid,
                          uint64_t aInputBlockId);
   void ProcessWheelEvent(const WidgetWheelEvent& aEvent,
                          const ScrollableLayerGuid& aGuid,
                          uint64_t aInputBlockId);
   void ProcessAPZStateChange(const nsCOMPtr<nsIDocument>& aDocument,
                              ViewID aViewId,
--- a/gfx/layers/apz/util/ChromeProcessController.cpp
+++ b/gfx/layers/apz/util/ChromeProcessController.cpp
@@ -156,16 +156,31 @@ ChromeProcessController::HandleLongTap(c
     return;
   }
 
   mAPZEventState->ProcessLongTap(GetDOMWindowUtils(), aPoint, aGuid,
       aInputBlockId, GetPresShellResolution());
 }
 
 void
+ChromeProcessController::HandleLongTapUp(const CSSPoint& aPoint, int32_t aModifiers,
+                                         const ScrollableLayerGuid& aGuid)
+{
+  if (MessageLoop::current() != mUILoop) {
+    mUILoop->PostTask(
+        FROM_HERE,
+        NewRunnableMethod(this, &ChromeProcessController::HandleLongTapUp,
+                          aPoint, aModifiers, aGuid));
+    return;
+  }
+
+  mAPZEventState->ProcessLongTapUp(aPoint, aGuid, GetPresShellResolution());
+}
+
+void
 ChromeProcessController::NotifyAPZStateChange(const ScrollableLayerGuid& aGuid,
                                               APZStateChange aChange,
                                               int aArg)
 {
   if (MessageLoop::current() != mUILoop) {
     mUILoop->PostTask(
         FROM_HERE,
         NewRunnableMethod(this, &ChromeProcessController::NotifyAPZStateChange,
--- a/gfx/layers/apz/util/ChromeProcessController.h
+++ b/gfx/layers/apz/util/ChromeProcessController.h
@@ -43,17 +43,17 @@ public:
   virtual void HandleDoubleTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers,
                                const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
   virtual void HandleSingleTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers,
                                const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE;
   virtual void HandleLongTap(const mozilla::CSSPoint& aPoint, int32_t aModifiers,
                                const ScrollableLayerGuid& aGuid,
                                uint64_t aInputBlockId) MOZ_OVERRIDE;
   virtual void HandleLongTapUp(const CSSPoint& aPoint, int32_t aModifiers,
-                               const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE {}
+                               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,
                                     APZStateChange aChange,
                                     int aArg) MOZ_OVERRIDE;
 private:
   nsCOMPtr<nsIWidget> mWidget;
   nsRefPtr<APZEventState> mAPZEventState;