Bug 1005815 - Basic implementation of ChromeProcessController::HandleSingleTap. r=kats
authorBotond Ballo <botond@mozilla.com>
Wed, 21 Jan 2015 19:47:05 -0500
changeset 226947 0038cfaf847a5625e0b0309e1b3374e2a71fda4c
parent 226946 7ee5dfb97ff602d09c5e72fd605a907684fddd5b
child 226948 5903bcfa581cbcf1a94d9051da81f2aa32c334cf
push id28212
push userphilringnalda@gmail.com
push dateSun, 01 Feb 2015 17:17:22 +0000
treeherdermozilla-central@2ed663b8bc05 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1005815
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1005815 - Basic implementation of ChromeProcessController::HandleSingleTap. r=kats
gfx/layers/apz/util/ChromeProcessController.cpp
gfx/layers/apz/util/ChromeProcessController.h
--- a/gfx/layers/apz/util/ChromeProcessController.cpp
+++ b/gfx/layers/apz/util/ChromeProcessController.cpp
@@ -92,8 +92,36 @@ ChromeProcessController::Destroy()
       FROM_HERE,
       NewRunnableMethod(this, &ChromeProcessController::Destroy));
     return;
   }
 
   MOZ_ASSERT(MessageLoop::current() == mUILoop);
   mWidget = nullptr;
 }
+
+float
+ChromeProcessController::GetPresShellResolution() const
+{
+  // The document in the chrome process cannot be zoomed, so its pres shell
+  // resolution is 1.
+  return 1.0f;
+}
+
+void
+ChromeProcessController::HandleSingleTap(const CSSPoint& aPoint,
+                                         int32_t aModifiers,
+                                         const ScrollableLayerGuid& aGuid)
+{
+  if (MessageLoop::current() != mUILoop) {
+    mUILoop->PostTask(
+        FROM_HERE,
+        NewRunnableMethod(this, &ChromeProcessController::HandleSingleTap,
+                          aPoint, aModifiers, aGuid));
+    return;
+  }
+
+  LayoutDevicePoint point =
+      APZCCallbackHelper::ApplyCallbackTransform(aPoint, aGuid, GetPresShellResolution())
+    * mWidget->GetDefaultScale();
+
+  APZCCallbackHelper::FireSingleTapEvent(point, mWidget);
+}
--- a/gfx/layers/apz/util/ChromeProcessController.h
+++ b/gfx/layers/apz/util/ChromeProcessController.h
@@ -33,28 +33,29 @@ public:
   virtual void RequestContentRepaint(const FrameMetrics& aFrameMetrics) MOZ_OVERRIDE;
   virtual void PostDelayedTask(Task* aTask, int aDelayMs) MOZ_OVERRIDE;
   virtual void AcknowledgeScrollUpdate(const FrameMetrics::ViewID& aScrollId,
                                        const uint32_t& aScrollGeneration) MOZ_OVERRIDE;
 
   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 {}
+                               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 {}
   virtual void SendAsyncScrollDOMEvent(bool aIsRoot, const mozilla::CSSRect &aContentRect,
                                        const mozilla::CSSSize &aScrollableSize) MOZ_OVERRIDE {}
 
 private:
   nsCOMPtr<nsIWidget> mWidget;
   MessageLoop* mUILoop;
 
   void InitializeRoot();
+  float GetPresShellResolution() const;
 };
 
 } // namespace layers
 } // namespace mozilla
 
 #endif /* mozilla_layers_ChromeProcessController_h */