Bug 1441324 - Move the input event messages from PAPZCTreeManager to PAPZInputBridge. r?rhunt,froydnj draft
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 16 Mar 2018 16:28:19 -0400
changeset 768779 21d4ac26db0fbd7616d9700e359dad18ec230769
parent 768778 ad9ee3a3150a61cc6eb9de4ba1e5ece5005b55fb
push id102977
push userkgupta@mozilla.com
push dateFri, 16 Mar 2018 20:28:42 +0000
reviewersrhunt, froydnj
bugs1441324
milestone61.0a1
Bug 1441324 - Move the input event messages from PAPZCTreeManager to PAPZInputBridge. r?rhunt,froydnj This remotes the APZInputBridge interface over the PAPZInputBridge protocol in the case of the GPU process, and makes the GPU process' main thread act as the APZ controller thread in that process. If there is no GPU process we continue as before and the APZInputBridge interface implementation is the concrete APZCTreeManager instance in the UI process. The main changes in this patch are moving all the code associated with these messages out of APZCTreeManager{Parent,Child} and into APZInputBridge{Parent,Child}. APZCTreeManagerChild now returns an APZInputBridgeChild instance via InputBridge(), instead of returning itself. The SetControllerThread call in the GPU process is also updated. MozReview-Commit-ID: M4AaIW1Q0h
dom/ipc/PTabContext.ipdlh
gfx/ipc/GPUParent.cpp
gfx/layers/apz/public/APZInputBridge.h
gfx/layers/ipc/APZCTreeManagerChild.cpp
gfx/layers/ipc/APZCTreeManagerChild.h
gfx/layers/ipc/APZCTreeManagerParent.cpp
gfx/layers/ipc/APZCTreeManagerParent.h
gfx/layers/ipc/APZInputBridgeChild.cpp
gfx/layers/ipc/APZInputBridgeChild.h
gfx/layers/ipc/APZInputBridgeParent.cpp
gfx/layers/ipc/APZInputBridgeParent.h
gfx/layers/ipc/PAPZCTreeManager.ipdl
gfx/layers/ipc/PAPZInputBridge.ipdl
ipc/ipdl/sync-messages.ini
widget/InputData.h
--- a/dom/ipc/PTabContext.ipdlh
+++ b/dom/ipc/PTabContext.ipdlh
@@ -1,14 +1,16 @@
 /* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */
 /* vim: set sw=4 ts=8 et tw=80 ft=cpp : */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+include "mozilla/dom/TabMessageUtils.h";
+
 include protocol PBrowser;
 include PBrowserOrId;
 
 using UIStateChangeType from "nsPIDOMWindow.h";
 using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
 
 namespace mozilla {
 namespace dom {
--- a/gfx/ipc/GPUParent.cpp
+++ b/gfx/ipc/GPUParent.cpp
@@ -121,17 +121,17 @@ GPUParent::Init(base::ProcessId aParentP
 
   if (NS_FAILED(NS_InitMinimalXPCOM())) {
     return false;
   }
 
   CompositorThreadHolder::Start();
   // TODO: Bug 1406327, Start VRListenerThreadHolder when loading VR content.
   VRListenerThreadHolder::Start();
-  APZThreadUtils::SetControllerThread(CompositorThreadHolder::Loop());
+  APZThreadUtils::SetControllerThread(MessageLoop::current());
   apz::InitializeGlobalState();
   LayerTreeOwnerTracker::Initialize();
   mozilla::ipc::SetThisProcessName("GPU Process");
 #ifdef XP_WIN
   wmf::MFStartup();
 #endif
   return true;
 }
--- a/gfx/layers/apz/public/APZInputBridge.h
+++ b/gfx/layers/apz/public/APZInputBridge.h
@@ -11,16 +11,17 @@
 #include "Units.h"                      // for LayoutDeviceIntPoint
 
 namespace mozilla {
 
 class InputData;
 
 namespace layers {
 
+class APZInputBridgeParent;
 struct ScrollableLayerGuid;
 
 /**
  * This class lives in the main process, and is accessed via the controller
  * thread (which is the process main thread for desktop, and the Java UI
  * thread for Android). This class exposes a synchronous API to deliver
  * incoming input events to APZ and modify them in-place to unapply the APZ
  * async transform. If there is a GPU process, then this class does sync IPC
@@ -93,16 +94,17 @@ public:
   // APZ. If this returns true, the event must not perform a synchronous
   // scroll.
   //
   // Even if this returns false, all wheel events in APZ-aware widgets must
   // be sent through APZ so they are transformed correctly for TabParent.
   static bool WillHandleWheelEvent(WidgetWheelEvent* aEvent);
 
 protected:
+  friend class APZInputBridgeParent;
 
   // Methods to help process WidgetInputEvents (or manage conversion to/from InputData)
 
   virtual void ProcessUnhandledEvent(
       LayoutDeviceIntPoint* aRefPoint,
       ScrollableLayerGuid* aOutTargetGuid,
       uint64_t* aOutFocusSequenceNumber) = 0;
 
--- a/gfx/layers/ipc/APZCTreeManagerChild.cpp
+++ b/gfx/layers/ipc/APZCTreeManagerChild.cpp
@@ -48,128 +48,16 @@ APZCTreeManagerChild::Destroy()
 {
   MOZ_ASSERT(NS_IsMainThread());
   if (mInputBridge) {
     mInputBridge->Destroy();
     mInputBridge = nullptr;
   }
 }
 
-nsEventStatus
-APZCTreeManagerChild::ReceiveInputEvent(
-    InputData& aEvent,
-    ScrollableLayerGuid* aOutTargetGuid,
-    uint64_t* aOutInputBlockId)
-{
-  switch (aEvent.mInputType) {
-  case MULTITOUCH_INPUT: {
-    MultiTouchInput& event = aEvent.AsMultiTouchInput();
-    MultiTouchInput processedEvent;
-
-    nsEventStatus res;
-    SendReceiveMultiTouchInputEvent(event,
-                                    &res,
-                                    &processedEvent,
-                                    aOutTargetGuid,
-                                    aOutInputBlockId);
-
-    event = processedEvent;
-    return res;
-  }
-  case MOUSE_INPUT: {
-    MouseInput& event = aEvent.AsMouseInput();
-    MouseInput processedEvent;
-
-    nsEventStatus res;
-    SendReceiveMouseInputEvent(event,
-                               &res,
-                               &processedEvent,
-                               aOutTargetGuid,
-                               aOutInputBlockId);
-
-    event = processedEvent;
-    return res;
-  }
-  case PANGESTURE_INPUT: {
-    PanGestureInput& event = aEvent.AsPanGestureInput();
-    PanGestureInput processedEvent;
-
-    nsEventStatus res;
-    SendReceivePanGestureInputEvent(event,
-                                    &res,
-                                    &processedEvent,
-                                    aOutTargetGuid,
-                                    aOutInputBlockId);
-
-    event = processedEvent;
-    return res;
-  }
-  case PINCHGESTURE_INPUT: {
-    PinchGestureInput& event = aEvent.AsPinchGestureInput();
-    PinchGestureInput processedEvent;
-
-    nsEventStatus res;
-    SendReceivePinchGestureInputEvent(event,
-                                      &res,
-                                      &processedEvent,
-                                      aOutTargetGuid,
-                                      aOutInputBlockId);
-
-    event = processedEvent;
-    return res;
-  }
-  case TAPGESTURE_INPUT: {
-    TapGestureInput& event = aEvent.AsTapGestureInput();
-    TapGestureInput processedEvent;
-
-    nsEventStatus res;
-    SendReceiveTapGestureInputEvent(event,
-                                    &res,
-                                    &processedEvent,
-                                    aOutTargetGuid,
-                                    aOutInputBlockId);
-
-    event = processedEvent;
-    return res;
-  }
-  case SCROLLWHEEL_INPUT: {
-    ScrollWheelInput& event = aEvent.AsScrollWheelInput();
-    ScrollWheelInput processedEvent;
-
-    nsEventStatus res;
-    SendReceiveScrollWheelInputEvent(event,
-                                     &res,
-                                     &processedEvent,
-                                     aOutTargetGuid,
-                                     aOutInputBlockId);
-
-    event = processedEvent;
-    return res;
-  }
-  case KEYBOARD_INPUT: {
-    KeyboardInput& event = aEvent.AsKeyboardInput();
-    KeyboardInput processedEvent;
-
-    nsEventStatus res;
-    SendReceiveKeyboardInputEvent(event,
-                                  &res,
-                                  &processedEvent,
-                                  aOutTargetGuid,
-                                  aOutInputBlockId);
-
-    event = processedEvent;
-    return res;
-  }
-  default: {
-    MOZ_ASSERT_UNREACHABLE("Invalid InputData type.");
-    return nsEventStatus_eConsumeNoDefault;
-  }
-  }
-}
-
 void
 APZCTreeManagerChild::SetKeyboardMap(const KeyboardMap& aKeyboardMap)
 {
   SendSetKeyboardMap(aKeyboardMap);
 }
 
 void
 APZCTreeManagerChild::ZoomToRect(
@@ -241,39 +129,23 @@ APZCTreeManagerChild::StopAutoscroll(con
 }
 
 void
 APZCTreeManagerChild::SetLongTapEnabled(bool aTapGestureEnabled)
 {
   SendSetLongTapEnabled(aTapGestureEnabled);
 }
 
-void
-APZCTreeManagerChild::UpdateWheelTransaction(
-    LayoutDeviceIntPoint aRefPoint,
-    EventMessage aEventMessage)
-{
-  SendUpdateWheelTransaction(aRefPoint, aEventMessage);
-}
-
-void APZCTreeManagerChild::ProcessUnhandledEvent(
-    LayoutDeviceIntPoint* aRefPoint,
-    ScrollableLayerGuid*  aOutTargetGuid,
-    uint64_t*             aOutFocusSequenceNumber)
-{
-  SendProcessUnhandledEvent(*aRefPoint,
-                            aRefPoint,
-                            aOutTargetGuid,
-                            aOutFocusSequenceNumber);
-}
-
 APZInputBridge*
 APZCTreeManagerChild::InputBridge()
 {
-  return this;
+  MOZ_ASSERT(XRE_IsParentProcess());
+  MOZ_ASSERT(mInputBridge);
+
+  return mInputBridge.get();
 }
 
 mozilla::ipc::IPCResult
 APZCTreeManagerChild::RecvHandleTap(const TapType& aType,
                                     const LayoutDevicePoint& aPoint,
                                     const Modifiers& aModifiers,
                                     const ScrollableLayerGuid& aGuid,
                                     const uint64_t& aInputBlockId)
--- a/gfx/layers/ipc/APZCTreeManagerChild.h
+++ b/gfx/layers/ipc/APZCTreeManagerChild.h
@@ -14,32 +14,25 @@
 namespace mozilla {
 namespace layers {
 
 class APZInputBridgeChild;
 class RemoteCompositorSession;
 
 class APZCTreeManagerChild
   : public IAPZCTreeManager
-  , public APZInputBridge
   , public PAPZCTreeManagerChild
 {
 public:
   APZCTreeManagerChild();
 
   void SetCompositorSession(RemoteCompositorSession* aSession);
   void SetInputBridge(APZInputBridgeChild* aInputBridge);
   void Destroy();
 
-  nsEventStatus
-  ReceiveInputEvent(
-          InputData& aEvent,
-          ScrollableLayerGuid* aOutTargetGuid,
-          uint64_t* aOutInputBlockId) override;
-
   void
   SetKeyboardMap(const KeyboardMap& aKeyboardMap) override;
 
   void
   ZoomToRect(
           const ScrollableLayerGuid& aGuid,
           const CSSRect& aRect,
           const uint32_t aFlags = DEFAULT_BEHAVIOR) override;
@@ -78,27 +71,16 @@ public:
           const ScreenPoint& aAnchorLocation) override;
 
   void
   StopAutoscroll(const ScrollableLayerGuid& aGuid) override;
 
   void
   SetLongTapEnabled(bool aTapGestureEnabled) override;
 
-  void
-  ProcessUnhandledEvent(
-          LayoutDeviceIntPoint* aRefPoint,
-          ScrollableLayerGuid*  aOutTargetGuid,
-          uint64_t*             aOutFocusSequenceNumber) override;
-
-  void
-  UpdateWheelTransaction(
-          LayoutDeviceIntPoint aRefPoint,
-          EventMessage aEventMessage) override;
-
   APZInputBridge*
   InputBridge() override;
 
 protected:
   mozilla::ipc::IPCResult RecvHandleTap(const TapType& aType,
                                         const LayoutDevicePoint& aPoint,
                                         const Modifiers& aModifiers,
                                         const ScrollableLayerGuid& aGuid,
--- a/gfx/layers/ipc/APZCTreeManagerParent.cpp
+++ b/gfx/layers/ipc/APZCTreeManagerParent.cpp
@@ -26,149 +26,16 @@ APZCTreeManagerParent::~APZCTreeManagerP
 void
 APZCTreeManagerParent::ChildAdopted(RefPtr<APZCTreeManager> aAPZCTreeManager)
 {
   MOZ_ASSERT(aAPZCTreeManager != nullptr);
   mTreeManager = aAPZCTreeManager;
 }
 
 mozilla::ipc::IPCResult
-APZCTreeManagerParent::RecvReceiveMultiTouchInputEvent(
-    const MultiTouchInput& aEvent,
-    nsEventStatus* aOutStatus,
-    MultiTouchInput* aOutEvent,
-    ScrollableLayerGuid* aOutTargetGuid,
-    uint64_t* aOutInputBlockId)
-{
-  MultiTouchInput event = aEvent;
-
-  *aOutStatus = mTreeManager->ReceiveInputEvent(
-    event,
-    aOutTargetGuid,
-    aOutInputBlockId);
-  *aOutEvent = event;
-
-  return IPC_OK();
-}
-
-mozilla::ipc::IPCResult
-APZCTreeManagerParent::RecvReceiveMouseInputEvent(
-    const MouseInput& aEvent,
-    nsEventStatus* aOutStatus,
-    MouseInput* aOutEvent,
-    ScrollableLayerGuid* aOutTargetGuid,
-    uint64_t* aOutInputBlockId)
-{
-  MouseInput event = aEvent;
-
-  *aOutStatus = mTreeManager->ReceiveInputEvent(
-    event,
-    aOutTargetGuid,
-    aOutInputBlockId);
-  *aOutEvent = event;
-
-  return IPC_OK();
-}
-
-mozilla::ipc::IPCResult
-APZCTreeManagerParent::RecvReceivePanGestureInputEvent(
-    const PanGestureInput& aEvent,
-    nsEventStatus* aOutStatus,
-    PanGestureInput* aOutEvent,
-    ScrollableLayerGuid* aOutTargetGuid,
-    uint64_t* aOutInputBlockId)
-{
-  PanGestureInput event = aEvent;
-
-  *aOutStatus = mTreeManager->ReceiveInputEvent(
-    event,
-    aOutTargetGuid,
-    aOutInputBlockId);
-  *aOutEvent = event;
-
-  return IPC_OK();
-}
-
-mozilla::ipc::IPCResult
-APZCTreeManagerParent::RecvReceivePinchGestureInputEvent(
-    const PinchGestureInput& aEvent,
-    nsEventStatus* aOutStatus,
-    PinchGestureInput* aOutEvent,
-    ScrollableLayerGuid* aOutTargetGuid,
-    uint64_t* aOutInputBlockId)
-{
-  PinchGestureInput event = aEvent;
-
-  *aOutStatus = mTreeManager->ReceiveInputEvent(
-    event,
-    aOutTargetGuid,
-    aOutInputBlockId);
-  *aOutEvent = event;
-
-  return IPC_OK();
-}
-
-mozilla::ipc::IPCResult
-APZCTreeManagerParent::RecvReceiveTapGestureInputEvent(
-    const TapGestureInput& aEvent,
-    nsEventStatus* aOutStatus,
-    TapGestureInput* aOutEvent,
-    ScrollableLayerGuid* aOutTargetGuid,
-    uint64_t* aOutInputBlockId)
-{
-  TapGestureInput event = aEvent;
-
-  *aOutStatus = mTreeManager->ReceiveInputEvent(
-    event,
-    aOutTargetGuid,
-    aOutInputBlockId);
-  *aOutEvent = event;
-
-  return IPC_OK();
-}
-
-mozilla::ipc::IPCResult
-APZCTreeManagerParent::RecvReceiveScrollWheelInputEvent(
-    const ScrollWheelInput& aEvent,
-    nsEventStatus* aOutStatus,
-    ScrollWheelInput* aOutEvent,
-    ScrollableLayerGuid* aOutTargetGuid,
-    uint64_t* aOutInputBlockId)
-{
-  ScrollWheelInput event = aEvent;
-
-  *aOutStatus = mTreeManager->ReceiveInputEvent(
-    event,
-    aOutTargetGuid,
-    aOutInputBlockId);
-  *aOutEvent = event;
-
-  return IPC_OK();
-}
-
-mozilla::ipc::IPCResult
-APZCTreeManagerParent::RecvReceiveKeyboardInputEvent(
-        const KeyboardInput& aEvent,
-        nsEventStatus* aOutStatus,
-        KeyboardInput* aOutEvent,
-        ScrollableLayerGuid* aOutTargetGuid,
-        uint64_t* aOutInputBlockId)
-{
-  KeyboardInput event = aEvent;
-
-  *aOutStatus = mTreeManager->ReceiveInputEvent(
-    event,
-    aOutTargetGuid,
-    aOutInputBlockId);
-  *aOutEvent = event;
-
-  return IPC_OK();
-}
-
-mozilla::ipc::IPCResult
 APZCTreeManagerParent::RecvSetKeyboardMap(const KeyboardMap& aKeyboardMap)
 {
   APZThreadUtils::RunOnControllerThread(NewRunnableMethod<KeyboardMap>(
     "layers::IAPZCTreeManager::SetKeyboardMap",
     mTreeManager,
     &IAPZCTreeManager::SetKeyboardMap,
     aKeyboardMap));
 
@@ -339,33 +206,10 @@ APZCTreeManagerParent::RecvStopAutoscrol
 
 mozilla::ipc::IPCResult
 APZCTreeManagerParent::RecvSetLongTapEnabled(const bool& aTapGestureEnabled)
 {
   mTreeManager->SetLongTapEnabled(aTapGestureEnabled);
   return IPC_OK();
 }
 
-mozilla::ipc::IPCResult
-APZCTreeManagerParent::RecvUpdateWheelTransaction(
-        const LayoutDeviceIntPoint& aRefPoint,
-        const EventMessage& aEventMessage)
-{
-  mTreeManager->UpdateWheelTransaction(aRefPoint, aEventMessage);
-  return IPC_OK();
-}
-
-mozilla::ipc::IPCResult
-APZCTreeManagerParent::RecvProcessUnhandledEvent(
-        const LayoutDeviceIntPoint& aRefPoint,
-        LayoutDeviceIntPoint* aOutRefPoint,
-        ScrollableLayerGuid*  aOutTargetGuid,
-        uint64_t*             aOutFocusSequenceNumber)
-{
-  LayoutDeviceIntPoint refPoint = aRefPoint;
-  mTreeManager->ProcessUnhandledEvent(&refPoint, aOutTargetGuid, aOutFocusSequenceNumber);
-  *aOutRefPoint = refPoint;
-
-  return IPC_OK();
-}
-
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/ipc/APZCTreeManagerParent.h
+++ b/gfx/layers/ipc/APZCTreeManagerParent.h
@@ -26,72 +26,16 @@ public:
 
   /**
    * Called when the layer tree that this protocol is connected to
    * is adopted by another compositor, and we need to switch APZCTreeManagers.
    */
   void ChildAdopted(RefPtr<APZCTreeManager> aAPZCTreeManager);
 
   mozilla::ipc::IPCResult
-  RecvReceiveMultiTouchInputEvent(
-          const MultiTouchInput& aEvent,
-          nsEventStatus* aOutStatus,
-          MultiTouchInput* aOutEvent,
-          ScrollableLayerGuid* aOutTargetGuid,
-          uint64_t* aOutInputBlockId) override;
-
-  mozilla::ipc::IPCResult
-  RecvReceiveMouseInputEvent(
-          const MouseInput& aEvent,
-          nsEventStatus* aOutStatus,
-          MouseInput* aOutEvent,
-          ScrollableLayerGuid* aOutTargetGuid,
-          uint64_t* aOutInputBlockId) override;
-
-  mozilla::ipc::IPCResult
-  RecvReceivePanGestureInputEvent(
-          const PanGestureInput& aEvent,
-          nsEventStatus* aOutStatus,
-          PanGestureInput* aOutEvent,
-          ScrollableLayerGuid* aOutTargetGuid,
-          uint64_t* aOutInputBlockId) override;
-
-  mozilla::ipc::IPCResult
-  RecvReceivePinchGestureInputEvent(
-          const PinchGestureInput& aEvent,
-          nsEventStatus* aOutStatus,
-          PinchGestureInput* aOutEvent,
-          ScrollableLayerGuid* aOutTargetGuid,
-          uint64_t* aOutInputBlockId) override;
-
-  mozilla::ipc::IPCResult
-  RecvReceiveTapGestureInputEvent(
-          const TapGestureInput& aEvent,
-          nsEventStatus* aOutStatus,
-          TapGestureInput* aOutEvent,
-          ScrollableLayerGuid* aOutTargetGuid,
-          uint64_t* aOutInputBlockId) override;
-
-  mozilla::ipc::IPCResult
-  RecvReceiveScrollWheelInputEvent(
-          const ScrollWheelInput& aEvent,
-          nsEventStatus* aOutStatus,
-          ScrollWheelInput* aOutEvent,
-          ScrollableLayerGuid* aOutTargetGuid,
-          uint64_t* aOutInputBlockId) override;
-
-  mozilla::ipc::IPCResult
-  RecvReceiveKeyboardInputEvent(
-          const KeyboardInput& aEvent,
-          nsEventStatus* aOutStatus,
-          KeyboardInput* aOutEvent,
-          ScrollableLayerGuid* aOutTargetGuid,
-          uint64_t* aOutInputBlockId) override;
-
-  mozilla::ipc::IPCResult
   RecvSetKeyboardMap(const KeyboardMap& aKeyboardMap) override;
 
   mozilla::ipc::IPCResult
   RecvZoomToRect(
           const ScrollableLayerGuid& aGuid,
           const CSSRect& aRect,
           const uint32_t& aFlags) override;
 
@@ -129,28 +73,16 @@ public:
           const ScreenPoint& aAnchorLocation) override;
 
   mozilla::ipc::IPCResult
   RecvStopAutoscroll(const ScrollableLayerGuid& aGuid) override;
 
   mozilla::ipc::IPCResult
   RecvSetLongTapEnabled(const bool& aTapGestureEnabled) override;
 
-  mozilla::ipc::IPCResult
-  RecvUpdateWheelTransaction(
-          const LayoutDeviceIntPoint& aRefPoint,
-          const EventMessage& aEventMessage) override;
-
-  mozilla::ipc::IPCResult
-  RecvProcessUnhandledEvent(
-          const LayoutDeviceIntPoint& aRefPoint,
-          LayoutDeviceIntPoint* aOutRefPoint,
-          ScrollableLayerGuid*  aOutTargetGuid,
-          uint64_t*             aOutFocusSequenceNumber) override;
-
   void
   ActorDestroy(ActorDestroyReason aWhy) override { }
 
 private:
   uint64_t mLayersId;
   RefPtr<APZCTreeManager> mTreeManager;
 };
 
--- a/gfx/layers/ipc/APZInputBridgeChild.cpp
+++ b/gfx/layers/ipc/APZInputBridgeChild.cpp
@@ -35,10 +35,141 @@ APZInputBridgeChild::Destroy()
 }
 
 void
 APZInputBridgeChild::ActorDestroy(ActorDestroyReason aWhy)
 {
   mDestroyed = true;
 }
 
+nsEventStatus
+APZInputBridgeChild::ReceiveInputEvent(
+    InputData& aEvent,
+    ScrollableLayerGuid* aOutTargetGuid,
+    uint64_t* aOutInputBlockId)
+{
+  switch (aEvent.mInputType) {
+  case MULTITOUCH_INPUT: {
+    MultiTouchInput& event = aEvent.AsMultiTouchInput();
+    MultiTouchInput processedEvent;
+
+    nsEventStatus res;
+    SendReceiveMultiTouchInputEvent(event,
+                                    &res,
+                                    &processedEvent,
+                                    aOutTargetGuid,
+                                    aOutInputBlockId);
+
+    event = processedEvent;
+    return res;
+  }
+  case MOUSE_INPUT: {
+    MouseInput& event = aEvent.AsMouseInput();
+    MouseInput processedEvent;
+
+    nsEventStatus res;
+    SendReceiveMouseInputEvent(event,
+                               &res,
+                               &processedEvent,
+                               aOutTargetGuid,
+                               aOutInputBlockId);
+
+    event = processedEvent;
+    return res;
+  }
+  case PANGESTURE_INPUT: {
+    PanGestureInput& event = aEvent.AsPanGestureInput();
+    PanGestureInput processedEvent;
+
+    nsEventStatus res;
+    SendReceivePanGestureInputEvent(event,
+                                    &res,
+                                    &processedEvent,
+                                    aOutTargetGuid,
+                                    aOutInputBlockId);
+
+    event = processedEvent;
+    return res;
+  }
+  case PINCHGESTURE_INPUT: {
+    PinchGestureInput& event = aEvent.AsPinchGestureInput();
+    PinchGestureInput processedEvent;
+
+    nsEventStatus res;
+    SendReceivePinchGestureInputEvent(event,
+                                      &res,
+                                      &processedEvent,
+                                      aOutTargetGuid,
+                                      aOutInputBlockId);
+
+    event = processedEvent;
+    return res;
+  }
+  case TAPGESTURE_INPUT: {
+    TapGestureInput& event = aEvent.AsTapGestureInput();
+    TapGestureInput processedEvent;
+
+    nsEventStatus res;
+    SendReceiveTapGestureInputEvent(event,
+                                    &res,
+                                    &processedEvent,
+                                    aOutTargetGuid,
+                                    aOutInputBlockId);
+
+    event = processedEvent;
+    return res;
+  }
+  case SCROLLWHEEL_INPUT: {
+    ScrollWheelInput& event = aEvent.AsScrollWheelInput();
+    ScrollWheelInput processedEvent;
+
+    nsEventStatus res;
+    SendReceiveScrollWheelInputEvent(event,
+                                     &res,
+                                     &processedEvent,
+                                     aOutTargetGuid,
+                                     aOutInputBlockId);
+
+    event = processedEvent;
+    return res;
+  }
+  case KEYBOARD_INPUT: {
+    KeyboardInput& event = aEvent.AsKeyboardInput();
+    KeyboardInput processedEvent;
+
+    nsEventStatus res;
+    SendReceiveKeyboardInputEvent(event,
+                                  &res,
+                                  &processedEvent,
+                                  aOutTargetGuid,
+                                  aOutInputBlockId);
+
+    event = processedEvent;
+    return res;
+  }
+  default: {
+    MOZ_ASSERT_UNREACHABLE("Invalid InputData type.");
+    return nsEventStatus_eConsumeNoDefault;
+  }
+  }
+}
+
+void APZInputBridgeChild::ProcessUnhandledEvent(
+    LayoutDeviceIntPoint* aRefPoint,
+    ScrollableLayerGuid*  aOutTargetGuid,
+    uint64_t*             aOutFocusSequenceNumber)
+{
+  SendProcessUnhandledEvent(*aRefPoint,
+                            aRefPoint,
+                            aOutTargetGuid,
+                            aOutFocusSequenceNumber);
+}
+
+void
+APZInputBridgeChild::UpdateWheelTransaction(
+    LayoutDeviceIntPoint aRefPoint,
+    EventMessage aEventMessage)
+{
+  SendUpdateWheelTransaction(aRefPoint, aEventMessage);
+}
+
 } // namespace layers
 } // namespace mozilla
--- a/gfx/layers/ipc/APZInputBridgeChild.h
+++ b/gfx/layers/ipc/APZInputBridgeChild.h
@@ -2,30 +2,46 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_layers_APZInputBridgeChild_h
 #define mozilla_layers_APZInputBridgeChild_h
 
+#include "mozilla/layers/APZInputBridge.h"
 #include "mozilla/layers/PAPZInputBridgeChild.h"
 
 namespace mozilla {
 namespace layers {
 
 class APZInputBridgeChild : public PAPZInputBridgeChild
+                          , public APZInputBridge
 {
   NS_INLINE_DECL_REFCOUNTING(APZInputBridgeChild)
 
 public:
   APZInputBridgeChild();
   void Destroy();
 
+  nsEventStatus ReceiveInputEvent(
+      InputData& aEvent,
+      ScrollableLayerGuid* aOutTargetGuid,
+      uint64_t* aOutInputBlockId) override;
+
 protected:
+  void ProcessUnhandledEvent(
+      LayoutDeviceIntPoint* aRefPoint,
+      ScrollableLayerGuid* aOutTargetGuid,
+      uint64_t* aOutFocusSequenceNumber) override;
+
+  void UpdateWheelTransaction(
+      LayoutDeviceIntPoint aRefPoint,
+      EventMessage aEventMessage) override;
+
   void ActorDestroy(ActorDestroyReason aWhy) override;
   virtual ~APZInputBridgeChild();
 
 private:
   bool mDestroyed;
 };
 
 } // namespace layers
--- a/gfx/layers/ipc/APZInputBridgeParent.cpp
+++ b/gfx/layers/ipc/APZInputBridgeParent.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/layers/APZInputBridgeParent.h"
 
+#include "mozilla/layers/APZInputBridge.h"
 #include "mozilla/layers/CompositorBridgeParent.h"
 #include "mozilla/layers/IAPZCTreeManager.h"
 
 namespace mozilla {
 namespace layers {
 
 APZInputBridgeParent::APZInputBridgeParent(const uint64_t& aLayersId)
 {
@@ -20,16 +21,174 @@ APZInputBridgeParent::APZInputBridgePare
   mTreeManager = CompositorBridgeParent::GetAPZCTreeManager(aLayersId);
   MOZ_ASSERT(mTreeManager);
 }
 
 APZInputBridgeParent::~APZInputBridgeParent()
 {
 }
 
+mozilla::ipc::IPCResult
+APZInputBridgeParent::RecvReceiveMultiTouchInputEvent(
+    const MultiTouchInput& aEvent,
+    nsEventStatus* aOutStatus,
+    MultiTouchInput* aOutEvent,
+    ScrollableLayerGuid* aOutTargetGuid,
+    uint64_t* aOutInputBlockId)
+{
+  MultiTouchInput event = aEvent;
+
+  *aOutStatus = mTreeManager->InputBridge()->ReceiveInputEvent(
+    event,
+    aOutTargetGuid,
+    aOutInputBlockId);
+  *aOutEvent = event;
+
+  return IPC_OK();
+}
+
+mozilla::ipc::IPCResult
+APZInputBridgeParent::RecvReceiveMouseInputEvent(
+    const MouseInput& aEvent,
+    nsEventStatus* aOutStatus,
+    MouseInput* aOutEvent,
+    ScrollableLayerGuid* aOutTargetGuid,
+    uint64_t* aOutInputBlockId)
+{
+  MouseInput event = aEvent;
+
+  *aOutStatus = mTreeManager->InputBridge()->ReceiveInputEvent(
+    event,
+    aOutTargetGuid,
+    aOutInputBlockId);
+  *aOutEvent = event;
+
+  return IPC_OK();
+}
+
+mozilla::ipc::IPCResult
+APZInputBridgeParent::RecvReceivePanGestureInputEvent(
+    const PanGestureInput& aEvent,
+    nsEventStatus* aOutStatus,
+    PanGestureInput* aOutEvent,
+    ScrollableLayerGuid* aOutTargetGuid,
+    uint64_t* aOutInputBlockId)
+{
+  PanGestureInput event = aEvent;
+
+  *aOutStatus = mTreeManager->InputBridge()->ReceiveInputEvent(
+    event,
+    aOutTargetGuid,
+    aOutInputBlockId);
+  *aOutEvent = event;
+
+  return IPC_OK();
+}
+
+mozilla::ipc::IPCResult
+APZInputBridgeParent::RecvReceivePinchGestureInputEvent(
+    const PinchGestureInput& aEvent,
+    nsEventStatus* aOutStatus,
+    PinchGestureInput* aOutEvent,
+    ScrollableLayerGuid* aOutTargetGuid,
+    uint64_t* aOutInputBlockId)
+{
+  PinchGestureInput event = aEvent;
+
+  *aOutStatus = mTreeManager->InputBridge()->ReceiveInputEvent(
+    event,
+    aOutTargetGuid,
+    aOutInputBlockId);
+  *aOutEvent = event;
+
+  return IPC_OK();
+}
+
+mozilla::ipc::IPCResult
+APZInputBridgeParent::RecvReceiveTapGestureInputEvent(
+    const TapGestureInput& aEvent,
+    nsEventStatus* aOutStatus,
+    TapGestureInput* aOutEvent,
+    ScrollableLayerGuid* aOutTargetGuid,
+    uint64_t* aOutInputBlockId)
+{
+  TapGestureInput event = aEvent;
+
+  *aOutStatus = mTreeManager->InputBridge()->ReceiveInputEvent(
+    event,
+    aOutTargetGuid,
+    aOutInputBlockId);
+  *aOutEvent = event;
+
+  return IPC_OK();
+}
+
+mozilla::ipc::IPCResult
+APZInputBridgeParent::RecvReceiveScrollWheelInputEvent(
+    const ScrollWheelInput& aEvent,
+    nsEventStatus* aOutStatus,
+    ScrollWheelInput* aOutEvent,
+    ScrollableLayerGuid* aOutTargetGuid,
+    uint64_t* aOutInputBlockId)
+{
+  ScrollWheelInput event = aEvent;
+
+  *aOutStatus = mTreeManager->InputBridge()->ReceiveInputEvent(
+    event,
+    aOutTargetGuid,
+    aOutInputBlockId);
+  *aOutEvent = event;
+
+  return IPC_OK();
+}
+
+mozilla::ipc::IPCResult
+APZInputBridgeParent::RecvReceiveKeyboardInputEvent(
+        const KeyboardInput& aEvent,
+        nsEventStatus* aOutStatus,
+        KeyboardInput* aOutEvent,
+        ScrollableLayerGuid* aOutTargetGuid,
+        uint64_t* aOutInputBlockId)
+{
+  KeyboardInput event = aEvent;
+
+  *aOutStatus = mTreeManager->InputBridge()->ReceiveInputEvent(
+    event,
+    aOutTargetGuid,
+    aOutInputBlockId);
+  *aOutEvent = event;
+
+  return IPC_OK();
+}
+
+mozilla::ipc::IPCResult
+APZInputBridgeParent::RecvUpdateWheelTransaction(
+        const LayoutDeviceIntPoint& aRefPoint,
+        const EventMessage& aEventMessage)
+{
+  mTreeManager->InputBridge()->UpdateWheelTransaction(
+        aRefPoint, aEventMessage);
+  return IPC_OK();
+}
+
+mozilla::ipc::IPCResult
+APZInputBridgeParent::RecvProcessUnhandledEvent(
+        const LayoutDeviceIntPoint& aRefPoint,
+        LayoutDeviceIntPoint* aOutRefPoint,
+        ScrollableLayerGuid*  aOutTargetGuid,
+        uint64_t*             aOutFocusSequenceNumber)
+{
+  LayoutDeviceIntPoint refPoint = aRefPoint;
+  mTreeManager->InputBridge()->ProcessUnhandledEvent(
+        &refPoint, aOutTargetGuid, aOutFocusSequenceNumber);
+  *aOutRefPoint = refPoint;
+
+  return IPC_OK();
+}
+
 void
 APZInputBridgeParent::ActorDestroy(ActorDestroyReason aWhy)
 {
   // We shouldn't need it after this
   mTreeManager = nullptr;
 }
 
 } // namespace layers
--- a/gfx/layers/ipc/APZInputBridgeParent.h
+++ b/gfx/layers/ipc/APZInputBridgeParent.h
@@ -16,16 +16,84 @@ class IAPZCTreeManager;
 
 class APZInputBridgeParent : public PAPZInputBridgeParent
 {
   NS_INLINE_DECL_REFCOUNTING(APZInputBridgeParent)
 
 public:
   explicit APZInputBridgeParent(const uint64_t& aLayersId);
 
+  mozilla::ipc::IPCResult
+  RecvReceiveMultiTouchInputEvent(
+          const MultiTouchInput& aEvent,
+          nsEventStatus* aOutStatus,
+          MultiTouchInput* aOutEvent,
+          ScrollableLayerGuid* aOutTargetGuid,
+          uint64_t* aOutInputBlockId) override;
+
+  mozilla::ipc::IPCResult
+  RecvReceiveMouseInputEvent(
+          const MouseInput& aEvent,
+          nsEventStatus* aOutStatus,
+          MouseInput* aOutEvent,
+          ScrollableLayerGuid* aOutTargetGuid,
+          uint64_t* aOutInputBlockId) override;
+
+  mozilla::ipc::IPCResult
+  RecvReceivePanGestureInputEvent(
+          const PanGestureInput& aEvent,
+          nsEventStatus* aOutStatus,
+          PanGestureInput* aOutEvent,
+          ScrollableLayerGuid* aOutTargetGuid,
+          uint64_t* aOutInputBlockId) override;
+
+  mozilla::ipc::IPCResult
+  RecvReceivePinchGestureInputEvent(
+          const PinchGestureInput& aEvent,
+          nsEventStatus* aOutStatus,
+          PinchGestureInput* aOutEvent,
+          ScrollableLayerGuid* aOutTargetGuid,
+          uint64_t* aOutInputBlockId) override;
+
+  mozilla::ipc::IPCResult
+  RecvReceiveTapGestureInputEvent(
+          const TapGestureInput& aEvent,
+          nsEventStatus* aOutStatus,
+          TapGestureInput* aOutEvent,
+          ScrollableLayerGuid* aOutTargetGuid,
+          uint64_t* aOutInputBlockId) override;
+
+  mozilla::ipc::IPCResult
+  RecvReceiveScrollWheelInputEvent(
+          const ScrollWheelInput& aEvent,
+          nsEventStatus* aOutStatus,
+          ScrollWheelInput* aOutEvent,
+          ScrollableLayerGuid* aOutTargetGuid,
+          uint64_t* aOutInputBlockId) override;
+
+  mozilla::ipc::IPCResult
+  RecvReceiveKeyboardInputEvent(
+          const KeyboardInput& aEvent,
+          nsEventStatus* aOutStatus,
+          KeyboardInput* aOutEvent,
+          ScrollableLayerGuid* aOutTargetGuid,
+          uint64_t* aOutInputBlockId) override;
+
+  mozilla::ipc::IPCResult
+  RecvUpdateWheelTransaction(
+          const LayoutDeviceIntPoint& aRefPoint,
+          const EventMessage& aEventMessage) override;
+
+  mozilla::ipc::IPCResult
+  RecvProcessUnhandledEvent(
+          const LayoutDeviceIntPoint& aRefPoint,
+          LayoutDeviceIntPoint* aOutRefPoint,
+          ScrollableLayerGuid*  aOutTargetGuid,
+          uint64_t*             aOutFocusSequenceNumber) override;
+
   void
   ActorDestroy(ActorDestroyReason aWhy) override;
 
 protected:
   virtual ~APZInputBridgeParent();
 
 private:
   RefPtr<IAPZCTreeManager> mTreeManager;
--- a/gfx/layers/ipc/PAPZCTreeManager.ipdl
+++ b/gfx/layers/ipc/PAPZCTreeManager.ipdl
@@ -1,65 +1,47 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 include "mozilla/GfxMessageUtils.h";
 include "mozilla/layers/LayersMessageUtils.h";
 include "ipc/nsGUIEventIPC.h";
-include "mozilla/dom/TabMessageUtils.h"; // Needed for IPC::ParamTraits<nsEventStatus>.
 
 include protocol PCompositorBridge;
 
-using CSSPoint from "Units.h";
 using CSSRect from "Units.h";
 using LayoutDeviceCoord from "Units.h";
-using LayoutDeviceIntPoint from "Units.h";
 using mozilla::LayoutDevicePoint from "Units.h";
 using ScreenPoint from "Units.h";
 using struct mozilla::layers::ScrollableLayerGuid from "FrameMetrics.h";
 using mozilla::layers::MaybeZoomConstraints from "FrameMetrics.h";
 using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
 using mozilla::layers::TouchBehaviorFlags from "mozilla/layers/LayersTypes.h";
 using mozilla::layers::AsyncDragMetrics from "mozilla/layers/AsyncDragMetrics.h";
 using mozilla::layers::GeckoContentController::TapType from "mozilla/layers/GeckoContentController.h";
 using class mozilla::layers::KeyboardMap from "mozilla/layers/KeyboardMap.h";
 
-using nsEventStatus from "mozilla/EventForwards.h";
-using EventMessage from "mozilla/EventForwards.h";
 using mozilla::Modifiers from "mozilla/EventForwards.h";
-using class mozilla::WidgetInputEvent from "mozilla/BasicEvents.h";
-using class mozilla::WidgetMouseEventBase from "mozilla/MouseEvents.h";
-using mozilla::WidgetMouseEvent::Reason from "mozilla/MouseEvents.h";
-using class mozilla::WidgetTouchEvent from "mozilla/TouchEvents.h";
-using class mozilla::WidgetWheelEvent from "mozilla/MouseEvents.h";
-using class mozilla::InputData from "InputData.h";
-using class mozilla::MultiTouchInput from "InputData.h";
-using class mozilla::MouseInput from "InputData.h";
-using class mozilla::PanGestureInput from "InputData.h";
-using class mozilla::PinchGestureInput from "InputData.h";
 using mozilla::PinchGestureInput::PinchGestureType from "InputData.h";
-using class mozilla::TapGestureInput from "InputData.h";
-using class mozilla::ScrollWheelInput from "InputData.h";
-using class mozilla::KeyboardInput from "InputData.h";
 
 namespace mozilla {
 namespace layers {
 
 /**
  * PAPZCTreeManager is a protocol for remoting an IAPZCTreeManager. PAPZCTreeManager
  * lives on the PCompositorBridge protocol which either connects to the compositor
  * thread in the main process, or to the compositor thread in the gpu processs.
  *
  * PAPZCTreeManagerParent lives in the compositor thread, while PAPZCTreeManagerChild
  * lives in the main thread of the main or the content process. APZCTreeManagerParent
  * and APZCTreeManagerChild implement this protocol.
  */
-sync protocol PAPZCTreeManager
+protocol PAPZCTreeManager
 {
 manager PCompositorBridge;
 
 parent:
 
   // These messages correspond to the methods
   // on the IAPZCTreeManager interface
 
@@ -80,68 +62,16 @@ parent:
   async StartScrollbarDrag(ScrollableLayerGuid aGuid, AsyncDragMetrics aDragMetrics);
 
   async StartAutoscroll(ScrollableLayerGuid aGuid, ScreenPoint aAnchorLocation);
 
   async StopAutoscroll(ScrollableLayerGuid aGuid);
 
   async SetLongTapEnabled(bool aTapGestureEnabled);
 
-  // The following messages are used to
-  // implement the ReceiveInputEvent methods
-
-  sync ReceiveMultiTouchInputEvent(MultiTouchInput aEvent)
-    returns (nsEventStatus       aOutStatus,
-             MultiTouchInput     aOutEvent,
-             ScrollableLayerGuid aOutTargetGuid,
-             uint64_t            aOutInputBlockId);
-
-  sync ReceiveMouseInputEvent(MouseInput aEvent)
-    returns (nsEventStatus       aOutStatus,
-             MouseInput          aOutEvent,
-             ScrollableLayerGuid aOutTargetGuid,
-             uint64_t            aOutInputBlockId);
-
-  sync ReceivePanGestureInputEvent(PanGestureInput aEvent)
-    returns (nsEventStatus       aOutStatus,
-             PanGestureInput     aOutEvent,
-             ScrollableLayerGuid aOutTargetGuid,
-             uint64_t            aOutInputBlockId);
-
-  sync ReceivePinchGestureInputEvent(PinchGestureInput aEvent)
-    returns (nsEventStatus       aOutStatus,
-             PinchGestureInput   aOutEvent,
-             ScrollableLayerGuid aOutTargetGuid,
-             uint64_t            aOutInputBlockId);
-
-  sync ReceiveTapGestureInputEvent(TapGestureInput aEvent)
-    returns (nsEventStatus       aOutStatus,
-             TapGestureInput     aOutEvent,
-             ScrollableLayerGuid aOutTargetGuid,
-             uint64_t            aOutInputBlockId);
-
-  sync ReceiveScrollWheelInputEvent(ScrollWheelInput aEvent)
-    returns (nsEventStatus       aOutStatus,
-             ScrollWheelInput    aOutEvent,
-             ScrollableLayerGuid aOutTargetGuid,
-             uint64_t            aOutInputBlockId);
-
-  sync ReceiveKeyboardInputEvent(KeyboardInput aEvent)
-    returns (nsEventStatus       aOutStatus,
-             KeyboardInput       aOutEvent,
-             ScrollableLayerGuid aOutTargetGuid,
-             uint64_t            aOutInputBlockId);
-
-  async UpdateWheelTransaction(LayoutDeviceIntPoint aRefPoint, EventMessage aEventMessage);
-
-  sync ProcessUnhandledEvent(LayoutDeviceIntPoint aRefPoint)
-    returns (LayoutDeviceIntPoint   aOutRefPoint,
-             ScrollableLayerGuid    aOutTargetGuid,
-             uint64_t               aOutFocusSequenceNumber);
-
   async __delete__();
 
 child:
 
   async HandleTap(TapType aType, LayoutDevicePoint point, Modifiers aModifiers,
                   ScrollableLayerGuid aGuid, uint64_t aInputBlockId);
 
   async NotifyPinchGesture(PinchGestureType aType, ScrollableLayerGuid aGuid,
--- a/gfx/layers/ipc/PAPZInputBridge.ipdl
+++ b/gfx/layers/ipc/PAPZInputBridge.ipdl
@@ -1,13 +1,26 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+using LayoutDeviceIntPoint from "Units.h";
+using struct mozilla::layers::ScrollableLayerGuid from "FrameMetrics.h";
+
+using nsEventStatus from "mozilla/EventForwards.h";
+using EventMessage from "mozilla/EventForwards.h";
+using class mozilla::MultiTouchInput from "InputData.h";
+using class mozilla::MouseInput from "InputData.h";
+using class mozilla::PanGestureInput from "InputData.h";
+using class mozilla::PinchGestureInput from "InputData.h";
+using class mozilla::TapGestureInput from "InputData.h";
+using class mozilla::ScrollWheelInput from "InputData.h";
+using class mozilla::KeyboardInput from "InputData.h";
+
 include protocol PGPU;
 
 namespace mozilla {
 namespace layers {
 
 /**
  * This protocol is used to send input events from the UI process to the
  * GPU process for handling by APZ. There is one instance per top-level
@@ -16,13 +29,65 @@ namespace layers {
  * and the parent side lives on the main thread in the GPU process. If there
  * is no GPU process, then this protocol is not instantiated.
  */
 sync protocol PAPZInputBridge
 {
 manager PGPU;
 
 parent:
+  // The following messages are used to
+  // implement the ReceiveInputEvent methods
+
+  sync ReceiveMultiTouchInputEvent(MultiTouchInput aEvent)
+    returns (nsEventStatus       aOutStatus,
+             MultiTouchInput     aOutEvent,
+             ScrollableLayerGuid aOutTargetGuid,
+             uint64_t            aOutInputBlockId);
+
+  sync ReceiveMouseInputEvent(MouseInput aEvent)
+    returns (nsEventStatus       aOutStatus,
+             MouseInput          aOutEvent,
+             ScrollableLayerGuid aOutTargetGuid,
+             uint64_t            aOutInputBlockId);
+
+  sync ReceivePanGestureInputEvent(PanGestureInput aEvent)
+    returns (nsEventStatus       aOutStatus,
+             PanGestureInput     aOutEvent,
+             ScrollableLayerGuid aOutTargetGuid,
+             uint64_t            aOutInputBlockId);
+
+  sync ReceivePinchGestureInputEvent(PinchGestureInput aEvent)
+    returns (nsEventStatus       aOutStatus,
+             PinchGestureInput   aOutEvent,
+             ScrollableLayerGuid aOutTargetGuid,
+             uint64_t            aOutInputBlockId);
+
+  sync ReceiveTapGestureInputEvent(TapGestureInput aEvent)
+    returns (nsEventStatus       aOutStatus,
+             TapGestureInput     aOutEvent,
+             ScrollableLayerGuid aOutTargetGuid,
+             uint64_t            aOutInputBlockId);
+
+  sync ReceiveScrollWheelInputEvent(ScrollWheelInput aEvent)
+    returns (nsEventStatus       aOutStatus,
+             ScrollWheelInput    aOutEvent,
+             ScrollableLayerGuid aOutTargetGuid,
+             uint64_t            aOutInputBlockId);
+
+  sync ReceiveKeyboardInputEvent(KeyboardInput aEvent)
+    returns (nsEventStatus       aOutStatus,
+             KeyboardInput       aOutEvent,
+             ScrollableLayerGuid aOutTargetGuid,
+             uint64_t            aOutInputBlockId);
+
+  async UpdateWheelTransaction(LayoutDeviceIntPoint aRefPoint, EventMessage aEventMessage);
+
+  sync ProcessUnhandledEvent(LayoutDeviceIntPoint aRefPoint)
+    returns (LayoutDeviceIntPoint   aOutRefPoint,
+             ScrollableLayerGuid    aOutTargetGuid,
+             uint64_t               aOutFocusSequenceNumber);
+
   async __delete__();
 };
 
 } // namespace gfx
 } // namespace mozilla
--- a/ipc/ipdl/sync-messages.ini
+++ b/ipc/ipdl/sync-messages.ini
@@ -923,31 +923,31 @@ description =
 [PRemoteSpellcheckEngine::SetDictionary]
 description =
 [PGPU::AddLayerTreeIdMapping]
 description =
 [PGPU::GetDeviceStatus]
 description =
 [PGPU::SimulateDeviceReset]
 description =
-[PAPZCTreeManager::ReceiveMultiTouchInputEvent]
+[PAPZInputBridge::ReceiveMultiTouchInputEvent]
 description =
-[PAPZCTreeManager::ReceiveMouseInputEvent]
+[PAPZInputBridge::ReceiveMouseInputEvent]
 description =
-[PAPZCTreeManager::ReceivePanGestureInputEvent]
+[PAPZInputBridge::ReceivePanGestureInputEvent]
 description =
-[PAPZCTreeManager::ReceivePinchGestureInputEvent]
+[PAPZInputBridge::ReceivePinchGestureInputEvent]
 description =
-[PAPZCTreeManager::ReceiveTapGestureInputEvent]
+[PAPZInputBridge::ReceiveTapGestureInputEvent]
 description =
-[PAPZCTreeManager::ReceiveScrollWheelInputEvent]
+[PAPZInputBridge::ReceiveScrollWheelInputEvent]
 description =
-[PAPZCTreeManager::ProcessUnhandledEvent]
+[PAPZInputBridge::ProcessUnhandledEvent]
 description =
-[PAPZCTreeManager::ReceiveKeyboardInputEvent]
+[PAPZInputBridge::ReceiveKeyboardInputEvent]
 description =
 [PCompositorBridge::Initialize]
 description =
 [PCompositorBridge::GetFrameUniformity]
 description =
 [PCompositorBridge::WillClose]
 description =
 [PCompositorBridge::Pause]
--- a/widget/InputData.h
+++ b/widget/InputData.h
@@ -19,18 +19,18 @@
 #include "mozilla/layers/KeyboardScrollAction.h"
 
 template<class E> struct already_AddRefed;
 class nsIWidget;
 
 namespace mozilla {
 
 namespace layers {
-class PAPZCTreeManagerParent;
-class APZCTreeManagerChild;
+class APZInputBridgeChild;
+class PAPZInputBridgeParent;
 }
 
 namespace dom {
 class Touch;
 } // namespace dom
 
 MOZ_DEFINE_ENUM(
   InputType, (
@@ -223,18 +223,18 @@ public:
   MultiTouchType mType;
   nsTArray<SingleTouchData> mTouches;
   bool mHandledByAPZ;
 };
 
 class MouseInput : public InputData
 {
 protected:
-  friend mozilla::layers::PAPZCTreeManagerParent;
-  friend mozilla::layers::APZCTreeManagerChild;
+  friend mozilla::layers::APZInputBridgeChild;
+  friend mozilla::layers::PAPZInputBridgeParent;
 
   MouseInput();
 
 public:
 
   MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
     MouseType, (
       MOUSE_NONE,
@@ -279,18 +279,18 @@ public:
 
 /**
  * Encapsulation class for pan events, can be used off-main-thread.
  * These events are currently only used for scrolling on desktop.
  */
 class PanGestureInput : public InputData
 {
 protected:
-  friend mozilla::layers::PAPZCTreeManagerParent;
-  friend mozilla::layers::APZCTreeManagerChild;
+  friend mozilla::layers::APZInputBridgeChild;
+  friend mozilla::layers::PAPZInputBridgeParent;
 
   PanGestureInput();
 
 public:
   MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
     PanGestureType, (
       // MayStart: Dispatched before any actual panning has occurred but when a
       // pan gesture is probably about to start, for example when the user
@@ -399,18 +399,18 @@ public:
 /**
  * Encapsulation class for pinch events. In general, these will be generated by
  * a gesture listener by looking at SingleTouchData/MultiTouchInput instances and
  * determining whether or not the user was trying to do a gesture.
  */
 class PinchGestureInput : public InputData
 {
 protected:
-  friend mozilla::layers::PAPZCTreeManagerParent;
-  friend mozilla::layers::APZCTreeManagerChild;
+  friend mozilla::layers::APZInputBridgeChild;
+  friend mozilla::layers::PAPZInputBridgeParent;
 
   PinchGestureInput();
 
 public:
   MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
     PinchGestureType, (
       PINCHGESTURE_START,
       PINCHGESTURE_SCALE,
@@ -456,18 +456,18 @@ public:
 /**
  * Encapsulation class for tap events. In general, these will be generated by
  * a gesture listener by looking at SingleTouchData/MultiTouchInput instances and
  * determining whether or not the user was trying to do a gesture.
  */
 class TapGestureInput : public InputData
 {
 protected:
-  friend mozilla::layers::PAPZCTreeManagerParent;
-  friend mozilla::layers::APZCTreeManagerChild;
+  friend mozilla::layers::APZInputBridgeChild;
+  friend mozilla::layers::PAPZInputBridgeParent;
 
   TapGestureInput();
 
 public:
   MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
     TapGestureType, (
       TAPGESTURE_LONG,
       TAPGESTURE_LONG_UP,
@@ -503,18 +503,18 @@ public:
 };
 
 // Encapsulation class for scroll-wheel events. These are generated by mice
 // with physical scroll wheels, and on Windows by most touchpads when using
 // scroll gestures.
 class ScrollWheelInput : public InputData
 {
 protected:
-  friend mozilla::layers::PAPZCTreeManagerParent;
-  friend mozilla::layers::APZCTreeManagerChild;
+  friend mozilla::layers::APZInputBridgeChild;
+  friend mozilla::layers::PAPZInputBridgeParent;
 
   ScrollWheelInput();
 
 public:
   MOZ_DEFINE_ENUM_AT_CLASS_SCOPE(
     ScrollDeltaType, (
       // There are three kinds of scroll delta modes in Gecko: "page", "line" and
       // "pixel".
@@ -614,17 +614,17 @@ public:
 
   bool mHandledByAPZ;
 
   // The scroll action to perform on a layer for this keyboard input. This is
   // only used in APZ and is NOT serialized over IPC.
   KeyboardScrollAction mAction;
 
 protected:
-  friend mozilla::layers::PAPZCTreeManagerParent;
-  friend mozilla::layers::APZCTreeManagerChild;
+  friend mozilla::layers::APZInputBridgeChild;
+  friend mozilla::layers::PAPZInputBridgeParent;
 
   KeyboardInput();
 };
 
 } // namespace mozilla
 
 #endif // InputData_h__