Bug 1302093 - Move all the method bodies from InputData.h to InputData.cpp to avoid rebuilding the world for itty-bitty changes. r=mstange
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 12 Sep 2016 09:47:01 -0400
changeset 313503 7351b2e1daccc2b543e3ec417fff5bda65b53f32
parent 313502 f9c16c7e72efaed1129bb949732ca0ec1936f387
child 313504 5a68cb04da5303c5c1e4b855af851ca5f608f9a3
push id30689
push userkwierso@gmail.com
push dateMon, 12 Sep 2016 23:52:16 +0000
treeherdermozilla-central@7b1cb8b0be7c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1302093
milestone51.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 1302093 - Move all the method bodies from InputData.h to InputData.cpp to avoid rebuilding the world for itty-bitty changes. r=mstange MozReview-Commit-ID: 88zPelaPcRR
widget/InputData.cpp
widget/InputData.h
--- a/widget/InputData.cpp
+++ b/widget/InputData.cpp
@@ -11,169 +11,91 @@
 #include "mozilla/MouseEvents.h"
 #include "mozilla/TouchEvents.h"
 #include "UnitTransforms.h"
 
 namespace mozilla {
 
 using namespace dom;
 
+InputData::InputData(InputType aInputType)
+  : mInputType(aInputType)
+  , mTime(0)
+  , modifiers(0)
+{
+}
+
+InputData::InputData(InputType aInputType, uint32_t aTime, TimeStamp aTimeStamp,
+                     Modifiers aModifiers)
+  : mInputType(aInputType)
+  , mTime(aTime)
+  , mTimeStamp(aTimeStamp)
+  , modifiers(aModifiers)
+{
+}
+
+SingleTouchData::SingleTouchData(int32_t aIdentifier, ScreenIntPoint aScreenPoint,
+                                 ScreenSize aRadius, float aRotationAngle,
+                                 float aForce)
+  : mIdentifier(aIdentifier)
+  , mScreenPoint(aScreenPoint)
+  , mRadius(aRadius)
+  , mRotationAngle(aRotationAngle)
+  , mForce(aForce)
+{
+}
+
+SingleTouchData::SingleTouchData(int32_t aIdentifier,
+                                 ParentLayerPoint aLocalScreenPoint,
+                                 ScreenSize aRadius, float aRotationAngle,
+                                 float aForce)
+  : mIdentifier(aIdentifier)
+  , mLocalScreenPoint(aLocalScreenPoint)
+  , mRadius(aRadius)
+  , mRotationAngle(aRotationAngle)
+  , mForce(aForce)
+{
+}
+
+SingleTouchData::SingleTouchData()
+{
+}
+
 already_AddRefed<Touch> SingleTouchData::ToNewDOMTouch() const
 {
   MOZ_ASSERT(NS_IsMainThread(),
              "Can only create dom::Touch instances on main thread");
   RefPtr<Touch> touch = new Touch(mIdentifier,
                                   LayoutDeviceIntPoint::Truncate(mScreenPoint.x, mScreenPoint.y),
                                   LayoutDeviceIntPoint::Truncate(mRadius.width, mRadius.height),
                                   mRotationAngle,
                                   mForce);
   return touch.forget();
 }
 
-MouseInput::MouseInput(const WidgetMouseEventBase& aMouseEvent)
-  : InputData(MOUSE_INPUT, aMouseEvent.mTime, aMouseEvent.mTimeStamp,
-              aMouseEvent.mModifiers)
-  , mType(MOUSE_NONE)
-  , mButtonType(NONE)
-  , mInputSource(aMouseEvent.inputSource)
-  , mButtons(aMouseEvent.buttons)
-  , mHandledByAPZ(aMouseEvent.mFlags.mHandledByAPZ)
+MultiTouchInput::MultiTouchInput(MultiTouchType aType, uint32_t aTime,
+                                 TimeStamp aTimeStamp, Modifiers aModifiers)
+  : InputData(MULTITOUCH_INPUT, aTime, aTimeStamp, aModifiers)
+  , mType(aType)
+  , mHandledByAPZ(false)
 {
-  MOZ_ASSERT(NS_IsMainThread(),
-             "Can only copy from WidgetTouchEvent on main thread");
-
-  mButtonType = NONE;
-
-  switch (aMouseEvent.button) {
-    case WidgetMouseEventBase::eLeftButton:
-      mButtonType = MouseInput::LEFT_BUTTON;
-      break;
-    case WidgetMouseEventBase::eMiddleButton:
-      mButtonType = MouseInput::MIDDLE_BUTTON;
-      break;
-    case WidgetMouseEventBase::eRightButton:
-      mButtonType = MouseInput::RIGHT_BUTTON;
-      break;
-  }
-
-  switch (aMouseEvent.mMessage) {
-    case eMouseMove:
-      mType = MOUSE_MOVE;
-      break;
-    case eMouseUp:
-      mType = MOUSE_UP;
-      break;
-    case eMouseDown:
-      mType = MOUSE_DOWN;
-      break;
-    case eDragStart:
-      mType = MOUSE_DRAG_START;
-      break;
-    case eDragEnd:
-      mType = MOUSE_DRAG_END;
-      break;
-    case eMouseEnterIntoWidget:
-      mType = MOUSE_WIDGET_ENTER;
-      break;
-    case eMouseExitFromWidget:
-      mType = MOUSE_WIDGET_EXIT;
-      break;
-    default:
-      MOZ_ASSERT_UNREACHABLE("Mouse event type not supported");
-      break;
-  }
-
-  mOrigin =
-    ScreenPoint(ViewAs<ScreenPixel>(aMouseEvent.mRefPoint,
-      PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent));
-}
-
-bool
-MouseInput::TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform)
-{
-  Maybe<ParentLayerPoint> point = UntransformBy(aTransform, mOrigin);
-  if (!point) {
-    return false;
-  }
-  mLocalOrigin = *point;
-
-  return true;
 }
 
-WidgetMouseEvent
-MouseInput::ToWidgetMouseEvent(nsIWidget* aWidget) const
+MultiTouchInput::MultiTouchInput()
+  : InputData(MULTITOUCH_INPUT)
+  , mHandledByAPZ(false)
 {
-  MOZ_ASSERT(NS_IsMainThread(),
-             "Can only convert To WidgetTouchEvent on main thread");
+}
 
-  EventMessage msg = eVoidEvent;
-  uint32_t clickCount = 0;
-  switch (mType) {
-    case MOUSE_MOVE:
-      msg = eMouseMove;
-      break;
-    case MOUSE_UP:
-      msg = eMouseUp;
-      clickCount = 1;
-      break;
-    case MOUSE_DOWN:
-      msg = eMouseDown;
-      clickCount = 1;
-      break;
-    case MOUSE_DRAG_START:
-      msg = eDragStart;
-      break;
-    case MOUSE_DRAG_END:
-      msg = eDragEnd;
-      break;
-    case MOUSE_WIDGET_ENTER:
-      msg = eMouseEnterIntoWidget;
-      break;
-    case MOUSE_WIDGET_EXIT:
-      msg = eMouseExitFromWidget;
-      break;
-    default:
-      MOZ_ASSERT_UNREACHABLE("Did not assign a type to WidgetMouseEvent in MouseInput");
-      break;
-  }
-
-  WidgetMouseEvent event(true, msg, aWidget, WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
-
-  if (msg == eVoidEvent) {
-    return event;
-  }
-
-  switch (mButtonType) {
-    case MouseInput::LEFT_BUTTON:
-      event.button = WidgetMouseEventBase::eLeftButton;
-      break;
-    case MouseInput::MIDDLE_BUTTON:
-      event.button = WidgetMouseEventBase::eMiddleButton;
-      break;
-    case MouseInput::RIGHT_BUTTON:
-      event.button = WidgetMouseEventBase::eRightButton;
-      break;
-    case MouseInput::NONE:
-    default:
-      break;
-  }
-
-  event.buttons = mButtons;
-  event.mModifiers = modifiers;
-  event.mTime = mTime;
-  event.mTimeStamp = mTimeStamp;
-  event.mFlags.mHandledByAPZ = mHandledByAPZ;
-  event.mRefPoint =
-    RoundedToInt(ViewAs<LayoutDevicePixel>(mOrigin,
-      PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent));
-  event.mClickCount = clickCount;
-  event.inputSource = mInputSource;
-  event.mIgnoreRootScrollFrame = true;
-
-  return event;
+MultiTouchInput::MultiTouchInput(const MultiTouchInput& aOther)
+  : InputData(MULTITOUCH_INPUT, aOther.mTime, aOther.mTimeStamp, aOther.modifiers)
+  , mType(aOther.mType)
+  , mHandledByAPZ(aOther.mHandledByAPZ)
+{
+  mTouches.AppendElements(aOther.mTouches);
 }
 
 MultiTouchInput::MultiTouchInput(const WidgetTouchEvent& aTouchEvent)
   : InputData(MULTITOUCH_INPUT, aTouchEvent.mTime, aTouchEvent.mTimeStamp,
               aTouchEvent.mModifiers)
   , mHandledByAPZ(aTouchEvent.mFlags.mHandledByAPZ)
 {
   MOZ_ASSERT(NS_IsMainThread(),
@@ -213,16 +135,53 @@ MultiTouchInput::MultiTouchInput(const W
                          ScreenSize(radiusX, radiusY),
                          rotationAngle,
                          force);
 
     mTouches.AppendElement(data);
   }
 }
 
+MultiTouchInput::MultiTouchInput(const WidgetMouseEvent& aMouseEvent)
+  : InputData(MULTITOUCH_INPUT, aMouseEvent.mTime, aMouseEvent.mTimeStamp,
+              aMouseEvent.mModifiers)
+  , mHandledByAPZ(aMouseEvent.mFlags.mHandledByAPZ)
+{
+  MOZ_ASSERT(NS_IsMainThread(),
+             "Can only copy from WidgetMouseEvent on main thread");
+  switch (aMouseEvent.mMessage) {
+  case eMouseDown:
+    mType = MULTITOUCH_START;
+    break;
+  case eMouseMove:
+    mType = MULTITOUCH_MOVE;
+    break;
+  case eMouseUp:
+    mType = MULTITOUCH_END;
+    break;
+  // The mouse pointer has been interrupted in an implementation-specific
+  // manner, such as a synchronous event or action cancelling the touch, or a
+  // touch point leaving the document window and going into a non-document
+  // area capable of handling user interactions.
+  case eMouseExitFromWidget:
+    mType = MULTITOUCH_CANCEL;
+    break;
+  default:
+    NS_WARNING("Did not assign a type to a MultiTouchInput");
+    break;
+  }
+
+  mTouches.AppendElement(SingleTouchData(0,
+                                         ViewAs<ScreenPixel>(aMouseEvent.mRefPoint,
+                                                             PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent),
+                                         ScreenSize(1, 1),
+                                         180.0f,
+                                         1.0f));
+}
+
 WidgetTouchEvent
 MultiTouchInput::ToWidgetTouchEvent(nsIWidget* aWidget) const
 {
   MOZ_ASSERT(NS_IsMainThread(),
              "Can only convert To WidgetTouchEvent on main thread");
 
   EventMessage touchEventMessage = eVoidEvent;
   switch (mType) {
@@ -309,72 +268,233 @@ MultiTouchInput::IndexOfTouch(int32_t aT
   for (size_t i = 0; i < mTouches.Length(); i++) {
     if (mTouches[i].mIdentifier == aTouchIdentifier) {
       return (int32_t)i;
     }
   }
   return -1;
 }
 
-// This conversion from WidgetMouseEvent to MultiTouchInput is needed because on
-// the B2G emulator we can only receive mouse events, but we need to be able
-// to pan correctly. To do this, we convert the events into a format that the
-// panning code can handle. This code is very limited and only supports
-// SingleTouchData. It also sends garbage for the identifier, radius, force
-// and rotation angle.
-MultiTouchInput::MultiTouchInput(const WidgetMouseEvent& aMouseEvent)
-  : InputData(MULTITOUCH_INPUT, aMouseEvent.mTime, aMouseEvent.mTimeStamp,
-              aMouseEvent.mModifiers)
-  , mHandledByAPZ(aMouseEvent.mFlags.mHandledByAPZ)
-{
-  MOZ_ASSERT(NS_IsMainThread(),
-             "Can only copy from WidgetMouseEvent on main thread");
-  switch (aMouseEvent.mMessage) {
-  case eMouseDown:
-    mType = MULTITOUCH_START;
-    break;
-  case eMouseMove:
-    mType = MULTITOUCH_MOVE;
-    break;
-  case eMouseUp:
-    mType = MULTITOUCH_END;
-    break;
-  // The mouse pointer has been interrupted in an implementation-specific
-  // manner, such as a synchronous event or action cancelling the touch, or a
-  // touch point leaving the document window and going into a non-document
-  // area capable of handling user interactions.
-  case eMouseExitFromWidget:
-    mType = MULTITOUCH_CANCEL;
-    break;
-  default:
-    NS_WARNING("Did not assign a type to a MultiTouchInput");
-    break;
-  }
-
-  mTouches.AppendElement(SingleTouchData(0,
-                                         ViewAs<ScreenPixel>(aMouseEvent.mRefPoint,
-                                                             PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent),
-                                         ScreenSize(1, 1),
-                                         180.0f,
-                                         1.0f));
-}
-
 bool
 MultiTouchInput::TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform)
 {
   for (size_t i = 0; i < mTouches.Length(); i++) {
     Maybe<ParentLayerIntPoint> point = UntransformBy(aTransform, mTouches[i].mScreenPoint);
     if (!point) { 
       return false;
     }
     mTouches[i].mLocalScreenPoint = *point;
   }
   return true;
 }
 
+MouseInput::MouseInput()
+  : InputData(MOUSE_INPUT)
+  , mType(MOUSE_NONE)
+  , mButtonType(NONE)
+  , mInputSource(0)
+  , mButtons(0)
+  , mHandledByAPZ(false)
+{
+}
+
+MouseInput::MouseInput(MouseType aType, ButtonType aButtonType,
+                       uint16_t aInputSource, int16_t aButtons,
+                       const ScreenPoint& aPoint, uint32_t aTime,
+                       TimeStamp aTimeStamp, Modifiers aModifiers)
+  : InputData(MOUSE_INPUT, aTime, aTimeStamp, aModifiers)
+  , mType(aType)
+  , mButtonType(aButtonType)
+  , mInputSource(aInputSource)
+  , mButtons(aButtons)
+  , mOrigin(aPoint)
+  , mHandledByAPZ(false)
+{
+}
+
+MouseInput::MouseInput(const WidgetMouseEventBase& aMouseEvent)
+  : InputData(MOUSE_INPUT, aMouseEvent.mTime, aMouseEvent.mTimeStamp,
+              aMouseEvent.mModifiers)
+  , mType(MOUSE_NONE)
+  , mButtonType(NONE)
+  , mInputSource(aMouseEvent.inputSource)
+  , mButtons(aMouseEvent.buttons)
+  , mHandledByAPZ(aMouseEvent.mFlags.mHandledByAPZ)
+{
+  MOZ_ASSERT(NS_IsMainThread(),
+             "Can only copy from WidgetTouchEvent on main thread");
+
+  mButtonType = NONE;
+
+  switch (aMouseEvent.button) {
+    case WidgetMouseEventBase::eLeftButton:
+      mButtonType = MouseInput::LEFT_BUTTON;
+      break;
+    case WidgetMouseEventBase::eMiddleButton:
+      mButtonType = MouseInput::MIDDLE_BUTTON;
+      break;
+    case WidgetMouseEventBase::eRightButton:
+      mButtonType = MouseInput::RIGHT_BUTTON;
+      break;
+  }
+
+  switch (aMouseEvent.mMessage) {
+    case eMouseMove:
+      mType = MOUSE_MOVE;
+      break;
+    case eMouseUp:
+      mType = MOUSE_UP;
+      break;
+    case eMouseDown:
+      mType = MOUSE_DOWN;
+      break;
+    case eDragStart:
+      mType = MOUSE_DRAG_START;
+      break;
+    case eDragEnd:
+      mType = MOUSE_DRAG_END;
+      break;
+    case eMouseEnterIntoWidget:
+      mType = MOUSE_WIDGET_ENTER;
+      break;
+    case eMouseExitFromWidget:
+      mType = MOUSE_WIDGET_EXIT;
+      break;
+    default:
+      MOZ_ASSERT_UNREACHABLE("Mouse event type not supported");
+      break;
+  }
+
+  mOrigin =
+    ScreenPoint(ViewAs<ScreenPixel>(aMouseEvent.mRefPoint,
+      PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent));
+}
+
+bool
+MouseInput::IsLeftButton() const
+{
+  return mButtonType == LEFT_BUTTON;
+}
+
+bool
+MouseInput::TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform)
+{
+  Maybe<ParentLayerPoint> point = UntransformBy(aTransform, mOrigin);
+  if (!point) {
+    return false;
+  }
+  mLocalOrigin = *point;
+
+  return true;
+}
+
+WidgetMouseEvent
+MouseInput::ToWidgetMouseEvent(nsIWidget* aWidget) const
+{
+  MOZ_ASSERT(NS_IsMainThread(),
+             "Can only convert To WidgetTouchEvent on main thread");
+
+  EventMessage msg = eVoidEvent;
+  uint32_t clickCount = 0;
+  switch (mType) {
+    case MOUSE_MOVE:
+      msg = eMouseMove;
+      break;
+    case MOUSE_UP:
+      msg = eMouseUp;
+      clickCount = 1;
+      break;
+    case MOUSE_DOWN:
+      msg = eMouseDown;
+      clickCount = 1;
+      break;
+    case MOUSE_DRAG_START:
+      msg = eDragStart;
+      break;
+    case MOUSE_DRAG_END:
+      msg = eDragEnd;
+      break;
+    case MOUSE_WIDGET_ENTER:
+      msg = eMouseEnterIntoWidget;
+      break;
+    case MOUSE_WIDGET_EXIT:
+      msg = eMouseExitFromWidget;
+      break;
+    default:
+      MOZ_ASSERT_UNREACHABLE("Did not assign a type to WidgetMouseEvent in MouseInput");
+      break;
+  }
+
+  WidgetMouseEvent event(true, msg, aWidget, WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
+
+  if (msg == eVoidEvent) {
+    return event;
+  }
+
+  switch (mButtonType) {
+    case MouseInput::LEFT_BUTTON:
+      event.button = WidgetMouseEventBase::eLeftButton;
+      break;
+    case MouseInput::MIDDLE_BUTTON:
+      event.button = WidgetMouseEventBase::eMiddleButton;
+      break;
+    case MouseInput::RIGHT_BUTTON:
+      event.button = WidgetMouseEventBase::eRightButton;
+      break;
+    case MouseInput::NONE:
+    default:
+      break;
+  }
+
+  event.buttons = mButtons;
+  event.mModifiers = modifiers;
+  event.mTime = mTime;
+  event.mTimeStamp = mTimeStamp;
+  event.mFlags.mHandledByAPZ = mHandledByAPZ;
+  event.mRefPoint =
+    RoundedToInt(ViewAs<LayoutDevicePixel>(mOrigin,
+      PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent));
+  event.mClickCount = clickCount;
+  event.inputSource = mInputSource;
+  event.mIgnoreRootScrollFrame = true;
+
+  return event;
+}
+
+PanGestureInput::PanGestureInput()
+  : InputData(PANGESTURE_INPUT)
+  , mLineOrPageDeltaX(0)
+  , mLineOrPageDeltaY(0)
+  , mUserDeltaMultiplierX(1.0)
+  , mUserDeltaMultiplierY(1.0)
+  , mHandledByAPZ(false)
+  , mFollowedByMomentum(false)
+  , mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false)
+{
+}
+
+PanGestureInput::PanGestureInput(PanGestureType aType, uint32_t aTime,
+                                 TimeStamp aTimeStamp,
+                                 const ScreenPoint& aPanStartPoint,
+                                 const ScreenPoint& aPanDisplacement,
+                                 Modifiers aModifiers)
+  : InputData(PANGESTURE_INPUT, aTime, aTimeStamp, aModifiers)
+  , mType(aType)
+  , mPanStartPoint(aPanStartPoint)
+  , mPanDisplacement(aPanDisplacement)
+  , mLineOrPageDeltaX(0)
+  , mLineOrPageDeltaY(0)
+  , mUserDeltaMultiplierX(1.0)
+  , mUserDeltaMultiplierY(1.0)
+  , mHandledByAPZ(false)
+  , mFollowedByMomentum(false)
+  , mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false)
+{
+}
+
 bool
 PanGestureInput::IsMomentum() const
 {
   switch (mType) {
     case PanGestureInput::PANGESTURE_MOMENTUMSTART:
     case PanGestureInput::PANGESTURE_MOMENTUMPAN:
     case PanGestureInput::PANGESTURE_MOMENTUMEND:
       return true;
@@ -431,56 +551,133 @@ PanGestureInput::UserMultipliedPanDispla
 
 ParentLayerPoint
 PanGestureInput::UserMultipliedLocalPanDisplacement() const
 {
   return ParentLayerPoint(mLocalPanDisplacement.x * mUserDeltaMultiplierX,
                           mLocalPanDisplacement.y * mUserDeltaMultiplierY);
 }
 
+PinchGestureInput::PinchGestureInput()
+  : InputData(PINCHGESTURE_INPUT)
+{
+}
+
+PinchGestureInput::PinchGestureInput(PinchGestureType aType, uint32_t aTime,
+                                     TimeStamp aTimeStamp,
+                                     const ScreenPoint& aFocusPoint,
+                                     float aCurrentSpan, float aPreviousSpan,
+                                     Modifiers aModifiers)
+  : InputData(PINCHGESTURE_INPUT, aTime, aTimeStamp, aModifiers)
+  , mType(aType)
+  , mFocusPoint(aFocusPoint)
+  , mCurrentSpan(aCurrentSpan)
+  , mPreviousSpan(aPreviousSpan)
+{
+}
+
+PinchGestureInput::PinchGestureInput(PinchGestureType aType, uint32_t aTime,
+                                     TimeStamp aTimeStamp,
+                                     const ParentLayerPoint& aLocalFocusPoint,
+                                     float aCurrentSpan, float aPreviousSpan,
+                                     Modifiers aModifiers)
+  : InputData(PINCHGESTURE_INPUT, aTime, aTimeStamp, aModifiers)
+  , mType(aType)
+  , mLocalFocusPoint(aLocalFocusPoint)
+  , mCurrentSpan(aCurrentSpan)
+  , mPreviousSpan(aPreviousSpan)
+{
+}
+
 bool
 PinchGestureInput::TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform)
 { 
   Maybe<ParentLayerPoint> point = UntransformBy(aTransform, mFocusPoint);
   if (!point) {
     return false;
   }
   mLocalFocusPoint = *point;
   return true;
 }
 
+TapGestureInput::TapGestureInput()
+  : InputData(TAPGESTURE_INPUT)
+{
+}
+
+TapGestureInput::TapGestureInput(TapGestureType aType, uint32_t aTime,
+                                 TimeStamp aTimeStamp,
+                                 const ScreenIntPoint& aPoint,
+                                 Modifiers aModifiers)
+  : InputData(TAPGESTURE_INPUT, aTime, aTimeStamp, aModifiers)
+  , mType(aType)
+  , mPoint(aPoint)
+{
+}
+
+TapGestureInput::TapGestureInput(TapGestureType aType, uint32_t aTime,
+                                 TimeStamp aTimeStamp,
+                                 const ParentLayerPoint& aLocalPoint,
+                                 Modifiers aModifiers)
+  : InputData(TAPGESTURE_INPUT, aTime, aTimeStamp, aModifiers)
+  , mType(aType)
+  , mLocalPoint(aLocalPoint)
+{
+}
+
 bool
 TapGestureInput::TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform)
 {
   Maybe<ParentLayerIntPoint> point = UntransformBy(aTransform, mPoint);
   if (!point) {
     return false;
   }
   mLocalPoint = *point;
   return true;
 }
 
-static uint32_t
-DeltaModeForDeltaType(ScrollWheelInput::ScrollDeltaType aDeltaType)
+ScrollWheelInput::ScrollWheelInput()
+  : InputData(SCROLLWHEEL_INPUT)
+  , mHandledByAPZ(false)
+  , mLineOrPageDeltaX(0)
+  , mLineOrPageDeltaY(0)
+  , mScrollSeriesNumber(0)
+  , mUserDeltaMultiplierX(1.0)
+  , mUserDeltaMultiplierY(1.0)
+  , mMayHaveMomentum(false)
+  , mIsMomentum(false)
 {
-  switch (aDeltaType) {
-    case ScrollWheelInput::SCROLLDELTA_LINE:
-      return nsIDOMWheelEvent::DOM_DELTA_LINE;
-    case ScrollWheelInput::SCROLLDELTA_PAGE:
-      return nsIDOMWheelEvent::DOM_DELTA_PAGE;
-    case ScrollWheelInput::SCROLLDELTA_PIXEL:
-    default:
-      return nsIDOMWheelEvent::DOM_DELTA_PIXEL;
-  }
+}
+
+ScrollWheelInput::ScrollWheelInput(uint32_t aTime, TimeStamp aTimeStamp,
+                                   Modifiers aModifiers, ScrollMode aScrollMode,
+                                   ScrollDeltaType aDeltaType,
+                                   const ScreenPoint& aOrigin, double aDeltaX,
+                                   double aDeltaY,
+                                   bool aAllowToOverrideSystemScrollSpeed)
+  : InputData(SCROLLWHEEL_INPUT, aTime, aTimeStamp, aModifiers)
+  , mDeltaType(aDeltaType)
+  , mScrollMode(aScrollMode)
+  , mOrigin(aOrigin)
+  , mHandledByAPZ(false)
+  , mDeltaX(aDeltaX)
+  , mDeltaY(aDeltaY)
+  , mLineOrPageDeltaX(0)
+  , mLineOrPageDeltaY(0)
+  , mScrollSeriesNumber(0)
+  , mUserDeltaMultiplierX(1.0)
+  , mUserDeltaMultiplierY(1.0)
+  , mMayHaveMomentum(false)
+  , mIsMomentum(false)
+  , mAllowToOverrideSystemScrollSpeed(aAllowToOverrideSystemScrollSpeed)
+{
 }
 
 ScrollWheelInput::ScrollWheelInput(const WidgetWheelEvent& aWheelEvent)
-  : InputData(SCROLLWHEEL_INPUT,
-              aWheelEvent.mTime,
-              aWheelEvent.mTimeStamp,
+  : InputData(SCROLLWHEEL_INPUT, aWheelEvent.mTime, aWheelEvent.mTimeStamp,
               aWheelEvent.mModifiers)
   , mDeltaType(DeltaTypeForDeltaMode(aWheelEvent.mDeltaMode))
   , mScrollMode(SCROLLMODE_INSTANT)
   , mHandledByAPZ(aWheelEvent.mFlags.mHandledByAPZ)
   , mDeltaX(aWheelEvent.mDeltaX)
   , mDeltaY(aWheelEvent.mDeltaY)
   , mLineOrPageDeltaX(aWheelEvent.mLineOrPageDeltaX)
   , mLineOrPageDeltaY(aWheelEvent.mLineOrPageDeltaY)
@@ -492,16 +689,62 @@ ScrollWheelInput::ScrollWheelInput(const
   , mAllowToOverrideSystemScrollSpeed(
       aWheelEvent.mAllowToOverrideSystemScrollSpeed)
 {
   mOrigin =
     ScreenPoint(ViewAs<ScreenPixel>(aWheelEvent.mRefPoint,
       PixelCastJustification::LayoutDeviceIsScreenForUntransformedEvent));
 }
 
+ScrollWheelInput::ScrollDeltaType
+ScrollWheelInput::DeltaTypeForDeltaMode(uint32_t aDeltaMode)
+{
+  switch (aDeltaMode) {
+  case nsIDOMWheelEvent::DOM_DELTA_LINE:
+    return SCROLLDELTA_LINE;
+  case nsIDOMWheelEvent::DOM_DELTA_PAGE:
+    return SCROLLDELTA_PAGE;
+  case nsIDOMWheelEvent::DOM_DELTA_PIXEL:
+    return SCROLLDELTA_PIXEL;
+  default:
+    MOZ_CRASH();
+  }
+  return SCROLLDELTA_LINE;
+}
+
+uint32_t
+ScrollWheelInput::DeltaModeForDeltaType(ScrollDeltaType aDeltaType)
+{
+  switch (aDeltaType) {
+  case ScrollWheelInput::SCROLLDELTA_LINE:
+    return nsIDOMWheelEvent::DOM_DELTA_LINE;
+  case ScrollWheelInput::SCROLLDELTA_PAGE:
+    return nsIDOMWheelEvent::DOM_DELTA_PAGE;
+  case ScrollWheelInput::SCROLLDELTA_PIXEL:
+  default:
+    return nsIDOMWheelEvent::DOM_DELTA_PIXEL;
+  }
+}
+
+nsIScrollableFrame::ScrollUnit
+ScrollWheelInput::ScrollUnitForDeltaType(ScrollDeltaType aDeltaType)
+{
+  switch (aDeltaType) {
+  case SCROLLDELTA_LINE:
+    return nsIScrollableFrame::LINES;
+  case SCROLLDELTA_PAGE:
+    return nsIScrollableFrame::PAGES;
+  case SCROLLDELTA_PIXEL:
+    return nsIScrollableFrame::DEVICE_PIXELS;
+  default:
+    MOZ_CRASH();
+  }
+  return nsIScrollableFrame::LINES;
+}
+
 WidgetWheelEvent
 ScrollWheelInput::ToWidgetWheelEvent(nsIWidget* aWidget) const
 {
   WidgetWheelEvent wheelEvent(true, eWheel, aWidget);
   wheelEvent.mModifiers = this->modifiers;
   wheelEvent.mTime = mTime;
   wheelEvent.mTimeStamp = mTimeStamp;
   wheelEvent.mRefPoint =
--- a/widget/InputData.h
+++ b/widget/InputData.h
@@ -89,34 +89,21 @@ public:
 
   INPUTDATA_AS_CHILD_TYPE(MultiTouchInput, MULTITOUCH_INPUT)
   INPUTDATA_AS_CHILD_TYPE(MouseInput, MOUSE_INPUT)
   INPUTDATA_AS_CHILD_TYPE(PanGestureInput, PANGESTURE_INPUT)
   INPUTDATA_AS_CHILD_TYPE(PinchGestureInput, PINCHGESTURE_INPUT)
   INPUTDATA_AS_CHILD_TYPE(TapGestureInput, TAPGESTURE_INPUT)
   INPUTDATA_AS_CHILD_TYPE(ScrollWheelInput, SCROLLWHEEL_INPUT)
 
-  explicit InputData(InputType aInputType)
-    : mInputType(aInputType),
-      mTime(0),
-      modifiers(0)
-  {
-  }
+  explicit InputData(InputType aInputType);
 
 protected:
   InputData(InputType aInputType, uint32_t aTime, TimeStamp aTimeStamp,
-            Modifiers aModifiers)
-    : mInputType(aInputType),
-      mTime(aTime),
-      mTimeStamp(aTimeStamp),
-      modifiers(aModifiers)
-  {
-
-
-  }
+            Modifiers aModifiers);
 };
 
 /**
  * Data container for a single touch input. Similar to dom::Touch, but used in
  * off-main-thread situations. This is more for just storing touch data, whereas
  * dom::Touch is more useful for dispatching through the DOM (which can only
  * happen on the main thread). dom::Touch also bears the problem of storing
  * pointers to nsIWidget instances which can only be used on the main thread,
@@ -133,45 +120,29 @@ class SingleTouchData
 {
 public:
   // Construct a SingleTouchData from a Screen point.
   // mLocalScreenPoint remains (0,0) unless it's set later.
   SingleTouchData(int32_t aIdentifier,
                   ScreenIntPoint aScreenPoint,
                   ScreenSize aRadius,
                   float aRotationAngle,
-                  float aForce)
-    : mIdentifier(aIdentifier),
-      mScreenPoint(aScreenPoint),
-      mRadius(aRadius),
-      mRotationAngle(aRotationAngle),
-      mForce(aForce)
-  {
-  }
+                  float aForce);
 
   // Construct a SingleTouchData from a ParentLayer point.
   // mScreenPoint remains (0,0) unless it's set later.
   // Note: if APZ starts using the radius for anything, we should add a local
   // version of that too, and have this constructor take it as a ParentLayerSize.
   SingleTouchData(int32_t aIdentifier,
                   ParentLayerPoint aLocalScreenPoint,
                   ScreenSize aRadius,
                   float aRotationAngle,
-                  float aForce)
-    : mIdentifier(aIdentifier),
-      mLocalScreenPoint(aLocalScreenPoint),
-      mRadius(aRadius),
-      mRotationAngle(aRotationAngle),
-      mForce(aForce)
-  {
-  }
+                  float aForce);
 
-  SingleTouchData()
-  {
-  }
+  SingleTouchData();
 
   already_AddRefed<dom::Touch> ToNewDOMTouch() const;
 
   // Warning, this class is serialized and sent over IPC. Any change to its
   // fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
 
   // A unique number assigned to each SingleTouchData within a MultiTouchInput so
   // that they can be easily distinguished when handling a touch start/move/end.
@@ -220,77 +191,51 @@ public:
     MULTITOUCH_END,
     MULTITOUCH_CANCEL,
 
     // Used as an upper bound for ContiguousEnumSerializer
     MULTITOUCH_SENTINEL,
   };
 
   MultiTouchInput(MultiTouchType aType, uint32_t aTime, TimeStamp aTimeStamp,
-                  Modifiers aModifiers)
-    : InputData(MULTITOUCH_INPUT, aTime, aTimeStamp, aModifiers)
-    , mType(aType)
-    , mHandledByAPZ(false)
-  {
-  }
-
-  MultiTouchInput()
-    : InputData(MULTITOUCH_INPUT)
-    , mHandledByAPZ(false)
-  {
-  }
-
-  MultiTouchInput(const MultiTouchInput& aOther)
-    : InputData(MULTITOUCH_INPUT, aOther.mTime,
-                aOther.mTimeStamp, aOther.modifiers)
-    , mType(aOther.mType)
-    , mHandledByAPZ(aOther.mHandledByAPZ)
-  {
-    mTouches.AppendElements(aOther.mTouches);
-  }
-
+                  Modifiers aModifiers);
+  MultiTouchInput();
+  MultiTouchInput(const MultiTouchInput& aOther);
   explicit MultiTouchInput(const WidgetTouchEvent& aTouchEvent);
-  WidgetTouchEvent ToWidgetTouchEvent(nsIWidget* aWidget) const;
-  WidgetMouseEvent ToWidgetMouseEvent(nsIWidget* aWidget) const;
-
-  // Return the index into mTouches of the SingleTouchData with the given
-  // identifier, or -1 if there is no such SingleTouchData.
-  int32_t IndexOfTouch(int32_t aTouchIdentifier);
-
   // This conversion from WidgetMouseEvent to MultiTouchInput is needed because
   // on the B2G emulator we can only receive mouse events, but we need to be
   // able to pan correctly. To do this, we convert the events into a format that
   // the panning code can handle. This code is very limited and only supports
   // SingleTouchData. It also sends garbage for the identifier, radius, force
   // and rotation angle.
   explicit MultiTouchInput(const WidgetMouseEvent& aMouseEvent);
 
+  WidgetTouchEvent ToWidgetTouchEvent(nsIWidget* aWidget) const;
+  WidgetMouseEvent ToWidgetMouseEvent(nsIWidget* aWidget) const;
+
+  // Return the index into mTouches of the SingleTouchData with the given
+  // identifier, or -1 if there is no such SingleTouchData.
+  int32_t IndexOfTouch(int32_t aTouchIdentifier);
+
   bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform);
 
   // Warning, this class is serialized and sent over IPC. Any change to its
   // fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
   MultiTouchType mType;
   nsTArray<SingleTouchData> mTouches;
   bool mHandledByAPZ;
 };
 
 class MouseInput : public InputData
 {
 protected:
   friend mozilla::layers::PAPZCTreeManagerParent;
   friend mozilla::layers::APZCTreeManagerChild;
 
-  MouseInput()
-    : InputData(MOUSE_INPUT)
-    , mType(MOUSE_NONE)
-    , mButtonType(NONE)
-    , mInputSource(0)
-    , mButtons(0)
-    , mHandledByAPZ(false)
-  {}
+  MouseInput();
 
 public:
   enum MouseType
   {
     // Warning, this enum is serialized and sent over IPC. If you reorder, add,
     // or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
     MOUSE_NONE,
     MOUSE_MOVE,
@@ -313,30 +258,22 @@ public:
     MIDDLE_BUTTON,
     RIGHT_BUTTON,
     NONE,
 
     // Used as an upper bound for ContiguousEnumSerializer
     BUTTON_SENTINEL,
   };
 
-  MouseInput(MouseType aType, ButtonType aButtonType, uint16_t aInputSource, int16_t aButtons, const ScreenPoint& aPoint,
-             uint32_t aTime, TimeStamp aTimeStamp, Modifiers aModifiers)
-    : InputData(MOUSE_INPUT, aTime, aTimeStamp, aModifiers)
-    , mType(aType)
-    , mButtonType(aButtonType)
-    , mInputSource(aInputSource)
-    , mButtons(aButtons)
-    , mOrigin(aPoint)
-    , mHandledByAPZ(false)
-  {}
-
+  MouseInput(MouseType aType, ButtonType aButtonType, uint16_t aInputSource,
+             int16_t aButtons, const ScreenPoint& aPoint, uint32_t aTime,
+             TimeStamp aTimeStamp, Modifiers aModifiers);
   explicit MouseInput(const WidgetMouseEventBase& aMouseEvent);
 
-  bool IsLeftButton() const { return mButtonType == LEFT_BUTTON; }
+  bool IsLeftButton() const;
 
   bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform);
   WidgetMouseEvent ToWidgetMouseEvent(nsIWidget* aWidget) const;
 
   // Warning, this class is serialized and sent over IPC. Any change to its
   // fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
   MouseType mType;
   ButtonType mButtonType;
@@ -352,27 +289,17 @@ public:
  * These events are currently only used for scrolling on desktop.
  */
 class PanGestureInput : public InputData
 {
 protected:
   friend mozilla::layers::PAPZCTreeManagerParent;
   friend mozilla::layers::APZCTreeManagerChild;
 
-  PanGestureInput()
-    : InputData(PANGESTURE_INPUT),
-      mLineOrPageDeltaX(0),
-      mLineOrPageDeltaY(0),
-      mUserDeltaMultiplierX(1.0),
-      mUserDeltaMultiplierY(1.0),
-      mHandledByAPZ(false),
-      mFollowedByMomentum(false),
-      mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false)
-  {
-  }
+  PanGestureInput();
 
 public:
   enum PanGestureType
   {
     // Warning, this enum is serialized and sent over IPC. If you reorder, add,
     // or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
 
     // MayStart: Dispatched before any actual panning has occurred but when a
@@ -422,30 +349,17 @@ public:
     PANGESTURE_SENTINEL,
   };
 
   PanGestureInput(PanGestureType aType,
                   uint32_t aTime,
                   TimeStamp aTimeStamp,
                   const ScreenPoint& aPanStartPoint,
                   const ScreenPoint& aPanDisplacement,
-                  Modifiers aModifiers)
-    : InputData(PANGESTURE_INPUT, aTime, aTimeStamp, aModifiers),
-      mType(aType),
-      mPanStartPoint(aPanStartPoint),
-      mPanDisplacement(aPanDisplacement),
-      mLineOrPageDeltaX(0),
-      mLineOrPageDeltaY(0),
-      mUserDeltaMultiplierX(1.0),
-      mUserDeltaMultiplierY(1.0),
-      mHandledByAPZ(false),
-      mFollowedByMomentum(false),
-      mRequiresContentResponseIfCannotScrollHorizontallyInStartDirection(false)
-  {
-  }
+                  Modifiers aModifiers);
 
   bool IsMomentum() const;
 
   WidgetWheelEvent ToWidgetWheelEvent(nsIWidget* aWidget) const;
 
   bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform);
 
   ScreenPoint UserMultipliedPanDisplacement() const;
@@ -493,67 +407,43 @@ public:
  * 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;
 
-  PinchGestureInput()
-    : InputData(PINCHGESTURE_INPUT)
-  {
-  }
+  PinchGestureInput();
 
 public:
   enum PinchGestureType
   {
     // Warning, this enum is serialized and sent over IPC. If you reorder, add,
     // or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
     PINCHGESTURE_START,
     PINCHGESTURE_SCALE,
     PINCHGESTURE_END,
 
     // Used as an upper bound for ContiguousEnumSerializer
     PINCHGESTURE_SENTINEL,
   };
 
   // Construct a tap gesture from a Screen point.
   // mLocalFocusPoint remains (0,0) unless it's set later.
-  PinchGestureInput(PinchGestureType aType,
-                    uint32_t aTime,
-                    TimeStamp aTimeStamp,
-                    const ScreenPoint& aFocusPoint,
-                    float aCurrentSpan,
-                    float aPreviousSpan,
-                    Modifiers aModifiers)
-    : InputData(PINCHGESTURE_INPUT, aTime, aTimeStamp, aModifiers),
-      mType(aType),
-      mFocusPoint(aFocusPoint),
-      mCurrentSpan(aCurrentSpan),
-      mPreviousSpan(aPreviousSpan)
-  {
-  }
+  PinchGestureInput(PinchGestureType aType, uint32_t aTime,
+                    TimeStamp aTimeStamp, const ScreenPoint& aFocusPoint,
+                    float aCurrentSpan, float aPreviousSpan,
+                    Modifiers aModifiers);
 
   // Construct a tap gesture from a ParentLayer point.
   // mFocusPoint remains (0,0) unless it's set later.
-  PinchGestureInput(PinchGestureType aType,
-                    uint32_t aTime,
-                    TimeStamp aTimeStamp,
-                    const ParentLayerPoint& aLocalFocusPoint,
-                    float aCurrentSpan,
-                    float aPreviousSpan,
-                    Modifiers aModifiers)
-    : InputData(PINCHGESTURE_INPUT, aTime, aTimeStamp, aModifiers),
-      mType(aType),
-      mLocalFocusPoint(aLocalFocusPoint),
-      mCurrentSpan(aCurrentSpan),
-      mPreviousSpan(aPreviousSpan)
-  {
-  }
+  PinchGestureInput(PinchGestureType aType, uint32_t aTime, TimeStamp aTimeStamp,
+                    const ParentLayerPoint& aLocalFocusPoint, float aCurrentSpan,
+                    float aPreviousSpan, Modifiers aModifiers);
 
   bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform);
 
   // Warning, this class is serialized and sent over IPC. Any change to its
   // fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
   PinchGestureType mType;
 
   // Center point of the pinch gesture. That is, if there are two fingers on the
@@ -587,20 +477,17 @@ public:
  * 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;
 
-  TapGestureInput()
-    : InputData(TAPGESTURE_INPUT)
-  {
-  }
+  TapGestureInput();
 
 public:
   enum TapGestureType
   {
     // Warning, this enum is serialized and sent over IPC. If you reorder, add,
     // or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
     TAPGESTURE_LONG,
     TAPGESTURE_LONG_UP,
@@ -610,39 +497,23 @@ public:
     TAPGESTURE_CANCEL,
 
     // Used as an upper bound for ContiguousEnumSerializer
     TAPGESTURE_SENTINEL,
   };
 
   // Construct a tap gesture from a Screen point.
   // mLocalPoint remains (0,0) unless it's set later.
-  TapGestureInput(TapGestureType aType,
-                  uint32_t aTime,
-                  TimeStamp aTimeStamp,
-                  const ScreenIntPoint& aPoint,
-                  Modifiers aModifiers)
-    : InputData(TAPGESTURE_INPUT, aTime, aTimeStamp, aModifiers),
-      mType(aType),
-      mPoint(aPoint)
-  {
-  }
+  TapGestureInput(TapGestureType aType, uint32_t aTime, TimeStamp aTimeStamp,
+                  const ScreenIntPoint& aPoint, Modifiers aModifiers);
 
   // Construct a tap gesture from a ParentLayer point.
   // mPoint remains (0,0) unless it's set later.
-  TapGestureInput(TapGestureType aType,
-                  uint32_t aTime,
-                  TimeStamp aTimeStamp,
-                  const ParentLayerPoint& aLocalPoint,
-                  Modifiers aModifiers)
-    : InputData(TAPGESTURE_INPUT, aTime, aTimeStamp, aModifiers),
-      mType(aType),
-      mLocalPoint(aLocalPoint)
-  {
-  }
+  TapGestureInput(TapGestureType aType, uint32_t aTime, TimeStamp aTimeStamp,
+                  const ParentLayerPoint& aLocalPoint, Modifiers aModifiers);
 
   bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform);
 
   // Warning, this class is serialized and sent over IPC. Any change to its
   // fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h
   TapGestureType mType;
 
   // The location of the tap in screen pixels.
@@ -657,27 +528,17 @@ public:
 // 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;
 
-  ScrollWheelInput()
-    : InputData(SCROLLWHEEL_INPUT)
-    , mHandledByAPZ(false)
-    , mLineOrPageDeltaX(0)
-    , mLineOrPageDeltaY(0)
-    , mScrollSeriesNumber(0)
-    , mUserDeltaMultiplierX(1.0)
-    , mUserDeltaMultiplierY(1.0)
-    , mMayHaveMomentum(false)
-    , mIsMomentum(false)
-  {}
+  ScrollWheelInput();
 
 public:
   enum ScrollDeltaType
   {
     // Warning, this enum is serialized and sent over IPC. If you reorder, add,
     // or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
 
     // There are three kinds of scroll delta modes in Gecko: "page", "line" and
@@ -685,87 +546,37 @@ public:
     SCROLLDELTA_LINE,
     SCROLLDELTA_PAGE,
     SCROLLDELTA_PIXEL,
 
     // Used as an upper bound for ContiguousEnumSerializer
     SCROLLDELTA_SENTINEL,
   };
 
-  static ScrollDeltaType
-  DeltaTypeForDeltaMode(uint32_t aDeltaMode)
-  {
-    switch (aDeltaMode) {
-      case nsIDOMWheelEvent::DOM_DELTA_LINE:
-        return SCROLLDELTA_LINE;
-      case nsIDOMWheelEvent::DOM_DELTA_PAGE:
-        return SCROLLDELTA_PAGE;
-      case nsIDOMWheelEvent::DOM_DELTA_PIXEL:
-        return SCROLLDELTA_PIXEL;
-      default:
-        MOZ_CRASH();
-    }
-    return SCROLLDELTA_LINE;
-  }
-
-  static nsIScrollableFrame::ScrollUnit
-  ScrollUnitForDeltaType(ScrollDeltaType aDeltaType)
-  {
-    switch (aDeltaType) {
-    case SCROLLDELTA_LINE:
-      return nsIScrollableFrame::LINES;
-    case SCROLLDELTA_PAGE:
-      return nsIScrollableFrame::PAGES;
-    case SCROLLDELTA_PIXEL:
-      return nsIScrollableFrame::DEVICE_PIXELS;
-    default:
-      MOZ_CRASH();
-    }
-    return nsIScrollableFrame::LINES;
-  }
-
   enum ScrollMode
   {
     // Warning, this enum is serialized and sent over IPC. If you reorder, add,
     // or remove a value, you need to update its ParamTraits<> in nsGUIEventIPC.h
 
     SCROLLMODE_INSTANT,
     SCROLLMODE_SMOOTH,
 
     // Used as an upper bound for ContiguousEnumSerializer
     SCROLLMODE_SENTINEL,
   };
 
-  ScrollWheelInput(uint32_t aTime,
-                   TimeStamp aTimeStamp,
-                   Modifiers aModifiers,
-                   ScrollMode aScrollMode,
-                   ScrollDeltaType aDeltaType,
-                   const ScreenPoint& aOrigin,
-                   double aDeltaX,
-                   double aDeltaY,
-                   bool aAllowToOverrideSystemScrollSpeed)
-    : InputData(SCROLLWHEEL_INPUT, aTime, aTimeStamp, aModifiers)
-    , mDeltaType(aDeltaType)
-    , mScrollMode(aScrollMode)
-    , mOrigin(aOrigin)
-    , mHandledByAPZ(false)
-    , mDeltaX(aDeltaX)
-    , mDeltaY(aDeltaY)
-    , mLineOrPageDeltaX(0)
-    , mLineOrPageDeltaY(0)
-    , mScrollSeriesNumber(0)
-    , mUserDeltaMultiplierX(1.0)
-    , mUserDeltaMultiplierY(1.0)
-    , mMayHaveMomentum(false)
-    , mIsMomentum(false)
-    , mAllowToOverrideSystemScrollSpeed(aAllowToOverrideSystemScrollSpeed)
-  {}
+  ScrollWheelInput(uint32_t aTime, TimeStamp aTimeStamp, Modifiers aModifiers,
+                   ScrollMode aScrollMode, ScrollDeltaType aDeltaType,
+                   const ScreenPoint& aOrigin, double aDeltaX, double aDeltaY,
+                   bool aAllowToOverrideSystemScrollSpeed);
+  explicit ScrollWheelInput(const WidgetWheelEvent& aEvent);
 
-  explicit ScrollWheelInput(const WidgetWheelEvent& aEvent);
+  static ScrollDeltaType DeltaTypeForDeltaMode(uint32_t aDeltaMode);
+  static uint32_t DeltaModeForDeltaType(ScrollDeltaType aDeltaType);
+  static nsIScrollableFrame::ScrollUnit ScrollUnitForDeltaType(ScrollDeltaType aDeltaType);
 
   WidgetWheelEvent ToWidgetWheelEvent(nsIWidget* aWidget) const;
   bool TransformToLocal(const ScreenToParentLayerMatrix4x4& aTransform);
 
   bool IsCustomizedByUserPrefs() const;
 
   // Warning, this class is serialized and sent over IPC. Any change to its
   // fields must be reflected in its ParamTraits<>, in nsGUIEventIPC.h