Bug 879011 - Convert nsIntPoint instances in InputData.h to types with units. r=kentuckyfriedtakahe
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 11 Jun 2013 18:13:11 -0400
changeset 146285 992ca64ed476dd8b4f5d01cefff1e37327a471ee
parent 146284 78ce97fe40bc4a52405fe7e32541e8647a3e3e30
child 146286 1f1742107151ddf9a5333a7e92952e3b801e1d8d
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskentuckyfriedtakahe
bugs879011
milestone24.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 879011 - Convert nsIntPoint instances in InputData.h to types with units. r=kentuckyfriedtakahe
gfx/2d/Point.h
gfx/layers/ipc/AsyncPanZoomController.cpp
gfx/layers/ipc/AsyncPanZoomController.h
gfx/layers/ipc/GestureEventListener.cpp
gfx/layers/ipc/GestureEventListener.h
layout/base/Units.h
widget/InputData.h
widget/android/AndroidJavaWrappers.cpp
widget/xpwidgets/InputData.cpp
--- a/gfx/2d/Point.h
+++ b/gfx/2d/Point.h
@@ -19,62 +19,95 @@ struct UnknownUnits {};
 template<class units>
 struct IntPointTyped :
   public BasePoint< int32_t, IntPointTyped<units> >,
   public units {
   typedef BasePoint< int32_t, IntPointTyped<units> > Super;
 
   IntPointTyped() : Super() {}
   IntPointTyped(int32_t aX, int32_t aY) : Super(aX, aY) {}
+
+  // XXX When all of the code is ported, the following functions to convert to and from
+  // unknown types should be removed.
+
+  static IntPointTyped<units> FromUnknownPoint(const IntPointTyped<UnknownUnits>& aPoint) {
+    return IntPointTyped<units>(aPoint.x, aPoint.y);
+  }
+
+  IntPointTyped<UnknownUnits> ToUnknownPoint() const {
+    return IntPointTyped<UnknownUnits>(this->x, this->y);
+  }
 };
 typedef IntPointTyped<UnknownUnits> IntPoint;
 
 template<class units>
 struct PointTyped :
   public BasePoint< Float, PointTyped<units> >,
   public units {
   typedef BasePoint< Float, PointTyped<units> > Super;
 
   PointTyped() : Super() {}
   PointTyped(Float aX, Float aY) : Super(aX, aY) {}
   PointTyped(const IntPointTyped<units>& point) : Super(float(point.x), float(point.y)) {}
 
   // XXX When all of the code is ported, the following functions to convert to and from
   // unknown types should be removed.
 
-  static PointTyped<units> FromUnknownPoint(const PointTyped<UnknownUnits>& pt) {
-    return PointTyped<units>(pt.x, pt.y);
+  static PointTyped<units> FromUnknownPoint(const PointTyped<UnknownUnits>& aPoint) {
+    return PointTyped<units>(aPoint.x, aPoint.y);
   }
 
   PointTyped<UnknownUnits> ToUnknownPoint() const {
     return PointTyped<UnknownUnits>(this->x, this->y);
   }
 };
 typedef PointTyped<UnknownUnits> Point;
 
 template<class units>
 struct IntSizeTyped :
   public BaseSize< int32_t, IntSizeTyped<units> >,
   public units {
   typedef BaseSize< int32_t, IntSizeTyped<units> > Super;
 
   IntSizeTyped() : Super() {}
   IntSizeTyped(int32_t aWidth, int32_t aHeight) : Super(aWidth, aHeight) {}
+
+  // XXX When all of the code is ported, the following functions to convert to and from
+  // unknown types should be removed.
+
+  static IntSizeTyped<units> FromUnknownSize(const IntSizeTyped<UnknownUnits>& aSize) {
+    return IntSizeTyped<units>(aSize.width, aSize.height);
+  }
+
+  IntSizeTyped<UnknownUnits> ToUnknownSize() const {
+    return IntSizeTyped<UnknownUnits>(this->width, this->height);
+  }
 };
 typedef IntSizeTyped<UnknownUnits> IntSize;
 
 template<class units>
 struct SizeTyped :
   public BaseSize< Float, SizeTyped<units> >,
   public units {
   typedef BaseSize< Float, SizeTyped<units> > Super;
 
   SizeTyped() : Super() {}
   SizeTyped(Float aWidth, Float aHeight) : Super(aWidth, aHeight) {}
   explicit SizeTyped(const IntSizeTyped<units>& size) :
     Super(float(size.width), float(size.height)) {}
+
+  // XXX When all of the code is ported, the following functions to convert to and from
+  // unknown types should be removed.
+
+  static SizeTyped<units> FromUnknownSize(const SizeTyped<UnknownUnits>& aSize) {
+    return SizeTyped<units>(aSize.width, aSize.height);
+  }
+
+  SizeTyped<UnknownUnits> ToUnknownSize() const {
+    return SizeTyped<UnknownUnits>(this->width, this->height);
+  }
 };
 typedef SizeTyped<UnknownUnits> Size;
 
 }
 }
 
 #endif /* MOZILLA_GFX_POINT_H_ */
--- a/gfx/layers/ipc/AsyncPanZoomController.cpp
+++ b/gfx/layers/ipc/AsyncPanZoomController.cpp
@@ -383,18 +383,17 @@ nsEventStatus AsyncPanZoomController::Ha
 
   mLastEventTime = aEvent.mTime;
   return rv;
 }
 
 nsEventStatus AsyncPanZoomController::OnTouchStart(const MultiTouchInput& aEvent) {
   SingleTouchData& touch = GetFirstSingleTouch(aEvent);
 
-  nsIntPoint point = touch.mScreenPoint;
-  int32_t xPos = point.x, yPos = point.y;
+  ScreenIntPoint point = touch.mScreenPoint;
 
   switch (mState) {
     case ANIMATING_ZOOM:
       // We just interrupted a double-tap animation, so force a redraw in case
       // this touchstart is just a tap that doesn't end up triggering a redraw.
       {
         MonitorAutoLock monitor(mMonitor);
         // Bring the resolution back in sync with the zoom.
@@ -402,18 +401,18 @@ nsEventStatus AsyncPanZoomController::On
         RequestContentRepaint();
         ScheduleComposite();
       }
       // Fall through.
     case FLING:
       CancelAnimation();
       // Fall through.
     case NOTHING:
-      mX.StartTouch(xPos);
-      mY.StartTouch(yPos);
+      mX.StartTouch(point.x);
+      mY.StartTouch(point.y);
       SetState(TOUCHING);
       break;
     case TOUCHING:
     case PANNING:
     case PINCHING:
     case WAITING_LISTENERS:
       NS_WARNING("Received impossible touch in OnTouchStart");
       break;
@@ -525,17 +524,17 @@ nsEventStatus AsyncPanZoomController::On
 }
 
 nsEventStatus AsyncPanZoomController::OnScaleBegin(const PinchGestureInput& aEvent) {
   if (!mAllowZoom) {
     return nsEventStatus_eConsumeNoDefault;
   }
 
   SetState(PINCHING);
-  mLastZoomFocus = gfx::Point(aEvent.mFocusPoint.x, aEvent.mFocusPoint.y);
+  mLastZoomFocus = aEvent.mFocusPoint;
 
   return nsEventStatus_eConsumeNoDefault;
 }
 
 nsEventStatus AsyncPanZoomController::OnScale(const PinchGestureInput& aEvent) {
   if (mState != PINCHING) {
     return nsEventStatus_eConsumeNoDefault;
   }
@@ -548,28 +547,30 @@ nsEventStatus AsyncPanZoomController::On
 
   float spanRatio = aEvent.mCurrentSpan / aEvent.mPreviousSpan;
 
   {
     MonitorAutoLock monitor(mMonitor);
 
     gfxFloat resolution = CalculateResolution(mFrameMetrics).width;
     gfxFloat userZoom = mFrameMetrics.mZoom.width;
-    gfx::Point focusPoint = gfx::Point(aEvent.mFocusPoint.x, aEvent.mFocusPoint.y);
-    gfxFloat xFocusChange = (mLastZoomFocus.x - focusPoint.x) / resolution;
-    gfxFloat yFocusChange = (mLastZoomFocus.y - focusPoint.y) / resolution;
+    ScreenPoint focusPoint = aEvent.mFocusPoint;
+
+    CSSPoint focusChange = ScreenPoint::ToCSSPoint(mLastZoomFocus - focusPoint,
+                                                   1.0 / resolution,
+                                                   1.0 / resolution);
     // If displacing by the change in focus point will take us off page bounds,
     // then reduce the displacement such that it doesn't.
-    if (mX.DisplacementWillOverscroll(xFocusChange) != Axis::OVERSCROLL_NONE) {
-      xFocusChange -= mX.DisplacementWillOverscrollAmount(xFocusChange);
+    if (mX.DisplacementWillOverscroll(focusChange.x) != Axis::OVERSCROLL_NONE) {
+      focusChange.x -= mX.DisplacementWillOverscrollAmount(focusChange.x);
     }
-    if (mY.DisplacementWillOverscroll(yFocusChange) != Axis::OVERSCROLL_NONE) {
-      yFocusChange -= mY.DisplacementWillOverscrollAmount(yFocusChange);
+    if (mY.DisplacementWillOverscroll(focusChange.y) != Axis::OVERSCROLL_NONE) {
+      focusChange.y -= mY.DisplacementWillOverscrollAmount(focusChange.y);
     }
-    ScrollBy(gfx::Point(xFocusChange, yFocusChange));
+    ScrollBy(focusChange.ToUnknownPoint());
 
     // When we zoom in with focus, we can zoom too much towards the boundaries
     // that we actually go over them. These are the needed displacements along
     // either axis such that we don't overscroll the boundaries when zooming.
     gfxFloat neededDisplacementX = 0, neededDisplacementY = 0;
 
     // Only do the scaling if we won't go over 8x zoom in or out.
     bool doScale = (spanRatio > 1.0 && userZoom < mMaxZoom) ||
@@ -725,27 +726,26 @@ void AsyncPanZoomController::StartPannin
   double angle = atan2(dy, dx); // range [-pi, pi]
   angle = fabs(angle); // range [0, pi]
 
   SetState(PANNING);
 }
 
 void AsyncPanZoomController::UpdateWithTouchAtDevicePoint(const MultiTouchInput& aEvent) {
   SingleTouchData& touch = GetFirstSingleTouch(aEvent);
-  nsIntPoint point = touch.mScreenPoint;
-  int32_t xPos = point.x, yPos = point.y;
+  ScreenIntPoint point = touch.mScreenPoint;
   TimeDuration timeDelta = TimeDuration().FromMilliseconds(aEvent.mTime - mLastEventTime);
 
   // Probably a duplicate event, just throw it away.
   if (timeDelta.ToMilliseconds() <= EPSILON) {
     return;
   }
 
-  mX.UpdateWithTouchAtDevicePoint(xPos, timeDelta);
-  mY.UpdateWithTouchAtDevicePoint(yPos, timeDelta);
+  mX.UpdateWithTouchAtDevicePoint(point.x, timeDelta);
+  mY.UpdateWithTouchAtDevicePoint(point.y, timeDelta);
 }
 
 void AsyncPanZoomController::TrackTouch(const MultiTouchInput& aEvent) {
   TimeDuration timeDelta = TimeDuration().FromMilliseconds(aEvent.mTime - mLastEventTime);
 
   // Probably a duplicate event, just throw it away.
   if (timeDelta.ToMilliseconds() <= EPSILON) {
     return;
@@ -828,29 +828,29 @@ void AsyncPanZoomController::ScrollBy(co
   gfx::Point newOffset(mFrameMetrics.mScrollOffset.x + aOffset.x,
                        mFrameMetrics.mScrollOffset.y + aOffset.y);
   FrameMetrics metrics(mFrameMetrics);
   metrics.mScrollOffset = CSSPoint::FromUnknownPoint(newOffset);
   mFrameMetrics = metrics;
 }
 
 void AsyncPanZoomController::ScaleWithFocus(float aZoom,
-                                            const gfx::Point& aFocus) {
+                                            const ScreenPoint& aFocus) {
   float zoomFactor = aZoom / mFrameMetrics.mZoom.width;
   gfxFloat resolution = CalculateResolution(mFrameMetrics).width;
 
   SetZoomAndResolution(aZoom);
 
   // If the new scale is very small, we risk multiplying in huge rounding
   // errors, so don't bother adjusting the scroll offset.
   if (resolution >= 0.01f) {
     mFrameMetrics.mScrollOffset.x +=
-      gfxFloat(aFocus.x) * (zoomFactor - 1.0) / resolution;
+      aFocus.x * (zoomFactor - 1.0) / resolution;
     mFrameMetrics.mScrollOffset.y +=
-      gfxFloat(aFocus.y) * (zoomFactor - 1.0) / resolution;
+      aFocus.y * (zoomFactor - 1.0) / resolution;
   }
 }
 
 bool AsyncPanZoomController::EnlargeDisplayPortAlongAxis(float aSkateSizeMultiplier,
                                                          double aEstimatedPaintDuration,
                                                          float aCompositionBounds,
                                                          float aVelocity,
                                                          float aAcceleration,
--- a/gfx/layers/ipc/AsyncPanZoomController.h
+++ b/gfx/layers/ipc/AsyncPanZoomController.h
@@ -337,17 +337,17 @@ protected:
 
   /**
    * Scales the viewport by an amount (note that it multiplies this scale in to
    * the current scale, it doesn't set it to |aScale|). Also considers a focus
    * point so that the page zooms outward from that point.
    *
    * XXX: Fix focus point calculations.
    */
-  void ScaleWithFocus(float aScale, const gfx::Point& aFocus);
+  void ScaleWithFocus(float aScale, const ScreenPoint& aFocus);
 
   /**
    * Schedules a composite on the compositor thread. Wrapper for
    * CompositorParent::ScheduleRenderOnCompositorThread().
    */
   void ScheduleComposite();
 
   /**
@@ -541,17 +541,17 @@ private:
   uint32_t mLastEventTime;
 
   // Start time of an animation. This is used for a zoom to animation to mark
   // the beginning.
   TimeStamp mAnimationStartTime;
 
   // Stores the previous focus point if there is a pinch gesture happening. Used
   // to allow panning by moving multiple fingers (thus moving the focus point).
-  gfx::Point mLastZoomFocus;
+  ScreenPoint mLastZoomFocus;
 
   // Stores the state of panning and zooming this frame. This is protected by
   // |mMonitor|; that is, it should be held whenever this is updated.
   PanZoomState mState;
 
   // How long it took in the past to paint after a series of previous requests.
   nsTArray<TimeDuration> mPreviousPaintDurations;
 
--- a/gfx/layers/ipc/GestureEventListener.cpp
+++ b/gfx/layers/ipc/GestureEventListener.cpp
@@ -96,19 +96,19 @@ nsEventStatus GestureEventListener::Hand
       // Another finger has been added; it can't be a tap anymore.
       HandleTapCancel(event);
     }
 
     break;
   }
   case MultiTouchInput::MULTITOUCH_MOVE: {
     // If we move too much, bail out of the tap.
-    nsIntPoint touch = (nsIntPoint&)event.mTouches[0].mScreenPoint;
+    ScreenIntPoint delta = event.mTouches[0].mScreenPoint - mTouchStartPosition;
     if (mTouches.Length() == 1 &&
-        NS_hypot(mTouchStartPosition.x - touch.x, mTouchStartPosition.y - touch.y) >
+        NS_hypot(delta.x, delta.y) >
           mAsyncPanZoomController->GetDPI() * mAsyncPanZoomController->GetTouchStartTolerance())
     {
       HandleTapCancel(event);
     }
 
     bool foundAlreadyExistingTouch = false;
     for (size_t i = 0; i < mTouches.Length(); i++) {
       for (size_t j = 0; j < event.mTouches.Length(); j++) {
@@ -195,24 +195,21 @@ nsEventStatus GestureEventListener::Hand
   return HandlePinchGestureEvent(event, false);
 }
 
 nsEventStatus GestureEventListener::HandlePinchGestureEvent(const MultiTouchInput& aEvent, bool aClearTouches)
 {
   nsEventStatus rv = nsEventStatus_eIgnore;
 
   if (mTouches.Length() > 1 && !aClearTouches) {
-    const nsIntPoint& firstTouch = mTouches[0].mScreenPoint,
-                      secondTouch = mTouches[mTouches.Length() - 1].mScreenPoint;
-    nsIntPoint focusPoint =
-      nsIntPoint((firstTouch.x + secondTouch.x)/2,
-                 (firstTouch.y + secondTouch.y)/2);
-    float currentSpan =
-      float(NS_hypot(firstTouch.x - secondTouch.x,
-                     firstTouch.y - secondTouch.y));
+    const ScreenIntPoint& firstTouch = mTouches[0].mScreenPoint,
+                         secondTouch = mTouches[mTouches.Length() - 1].mScreenPoint;
+    ScreenPoint focusPoint = ScreenPoint(firstTouch + secondTouch) / 2;
+    ScreenIntPoint delta = secondTouch - firstTouch;
+    float currentSpan = float(NS_hypot(delta.x, delta.y));
 
     switch (mState) {
     case GESTURE_NONE:
       mPreviousSpan = currentSpan;
       mState = GESTURE_WAITING_PINCH;
       // Deliberately fall through. If the user pinched and took their fingers
       // off the screen such that they still had 1 left on it, we want there to
       // be no resistance. We should only reset |mSpanChange| once all fingers
--- a/gfx/layers/ipc/GestureEventListener.h
+++ b/gfx/layers/ipc/GestureEventListener.h
@@ -217,15 +217,15 @@ protected:
   CancelableTask *mLongTapTimeoutTask;
   inline void CancelLongTapTimeoutTask();
 
   /**
    * Position of the last touch starting. This is only valid during an attempt
    * to determine if a touch is a tap. This means that it is used in both the
    * "GESTURE_WAITING_SINGLE_TAP" and "GESTURE_WAITING_DOUBLE_TAP" states.
    */
-  nsIntPoint mTouchStartPosition;
+  ScreenIntPoint mTouchStartPosition;
 };
 
 }
 }
 
 #endif
--- a/layout/base/Units.h
+++ b/layout/base/Units.h
@@ -121,15 +121,22 @@ typedef gfx::IntRectTyped<LayerPixel> La
  * On non-OMTC platforms this should be equivalent to LayerPixel units.
  * On OMTC platforms these may diverge from LayerPixel units temporarily,
  * while an asynchronous zoom is happening, but should eventually converge
  * back to LayerPixel units. Some variables (such as those representing
  * chrome UI element sizes) that are not subject to content zoom should
  * generally be represented in ScreenPixel units.
  */
 struct ScreenPixel {
+  static CSSPoint ToCSSPoint(const gfx::PointTyped<ScreenPixel>& aPoint, float aResolutionX, float aResolutionY) {
+    return CSSPoint(aPoint.x * aResolutionX,
+                    aPoint.y * aResolutionY);
+  }
 };
 
 typedef gfx::PointTyped<ScreenPixel> ScreenPoint;
+typedef gfx::IntPointTyped<ScreenPixel> ScreenIntPoint;
+typedef gfx::SizeTyped<ScreenPixel> ScreenSize;
+typedef gfx::IntSizeTyped<ScreenPixel> ScreenIntSize;
 
 };
 
 #endif
--- a/widget/InputData.h
+++ b/widget/InputData.h
@@ -4,16 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef InputData_h__
 #define InputData_h__
 
 #include "nsDebug.h"
 #include "nsPoint.h"
 #include "nsTArray.h"
+#include "Units.h"
 
 class nsTouchEvent;
 class nsMouseEvent;
 namespace mozilla {
 
 
 enum InputType
 {
@@ -80,18 +81,18 @@ protected:
  * within a MultiTouchInput.
  *
  * fixme/bug 775746: Make dom::Touch inherit from this class.
  */
 class SingleTouchData
 {
 public:
   SingleTouchData(int32_t aIdentifier,
-                  nsIntPoint aScreenPoint,
-                  nsIntPoint aRadius,
+                  ScreenIntPoint aScreenPoint,
+                  ScreenSize aRadius,
                   float aRotationAngle,
                   float aForce)
     : mIdentifier(aIdentifier),
       mScreenPoint(aScreenPoint),
       mRadius(aRadius),
       mRotationAngle(aRotationAngle),
       mForce(aForce)
   {
@@ -104,24 +105,24 @@ public:
   }
 
   // A unique number assigned to each SingleTouchData within a MultiTouchInput so
   // that they can be easily distinguished when handling a touch start/move/end.
   int32_t mIdentifier;
 
   // Point on the screen that the touch hit, in device pixels. They are
   // coordinates on the screen.
-  nsIntPoint mScreenPoint;
+  ScreenIntPoint mScreenPoint;
 
   // Radius that the touch covers, i.e. if you're using your thumb it will
   // probably be larger than using your pinky, even with the same force.
   // Radius can be different along x and y. For example, if you press down with
   // your entire finger vertically, the y radius will be much larger than the x
   // radius.
-  nsIntPoint mRadius;
+  ScreenSize mRadius;
 
   float mRotationAngle;
 
   // How hard the screen is being pressed.
   float mForce;
 };
 
 /**
@@ -184,17 +185,17 @@ public:
   {
     PINCHGESTURE_START,
     PINCHGESTURE_SCALE,
     PINCHGESTURE_END
   };
 
   PinchGestureInput(PinchGestureType aType,
                     uint32_t aTime,
-                    const nsIntPoint& aFocusPoint,
+                    const ScreenPoint& aFocusPoint,
                     float aCurrentSpan,
                     float aPreviousSpan)
     : InputData(PINCHGESTURE_INPUT, aTime),
       mType(aType),
       mFocusPoint(aFocusPoint),
       mCurrentSpan(aCurrentSpan),
       mPreviousSpan(aPreviousSpan)
   {
@@ -204,17 +205,17 @@ public:
 
   PinchGestureType mType;
 
   // Center point of the pinch gesture. That is, if there are two fingers on the
   // screen, it is their midpoint. In the case of more than two fingers, the
   // point is implementation-specific, but can for example be the midpoint
   // between the very first and very last touch. This is in device pixels and
   // are the coordinates on the screen of this midpoint.
-  nsIntPoint mFocusPoint;
+  ScreenPoint mFocusPoint;
 
   // The distance in device pixels (though as a float for increased precision
   // and because it is the distance along both the x and y axis) between the
   // touches responsible for the pinch gesture.
   float mCurrentSpan;
 
   // The previous |mCurrentSpan| in the PinchGestureInput preceding this one.
   // This is only really relevant during a PINCHGESTURE_SCALE because when it is
@@ -234,24 +235,24 @@ public:
   {
     TAPGESTURE_LONG,
     TAPGESTURE_UP,
     TAPGESTURE_CONFIRMED,
     TAPGESTURE_DOUBLE,
     TAPGESTURE_CANCEL
   };
 
-  TapGestureInput(TapGestureType aType, uint32_t aTime, const nsIntPoint& aPoint)
+  TapGestureInput(TapGestureType aType, uint32_t aTime, const ScreenIntPoint& aPoint)
     : InputData(TAPGESTURE_INPUT, aTime),
       mType(aType),
       mPoint(aPoint)
   {
 
 
   }
 
   TapGestureType mType;
-  nsIntPoint mPoint;
+  ScreenIntPoint mPoint;
 };
 
 }
 
 #endif // InputData_h__
--- a/widget/android/AndroidJavaWrappers.cpp
+++ b/widget/android/AndroidJavaWrappers.cpp
@@ -792,19 +792,23 @@ AndroidGeckoEvent::MakeMultiTouchInput(n
     if (type < 0) {
         // An event we don't know about
         return event;
     }
 
     const nsIntPoint& offset = widget->WidgetToScreenOffset();
     event.mTouches.SetCapacity(endIndex - startIndex);
     for (int i = startIndex; i < endIndex; i++) {
+        nsIntPoint point = Points()[i] - offset;
+        nsIntPoint radius = PointRadii()[i];
         SingleTouchData data(PointIndicies()[i],
-                             Points()[i] - offset,
-                             PointRadii()[i],
+                             ScreenIntPoint::FromUnknownPoint(
+                               gfx::IntPoint(point.x, point.y)),
+                             ScreenSize::FromUnknownSize(
+                               gfx::Size(radius.x, radius.y)),
                              Orientations()[i],
                              Pressures()[i]);
         event.mTouches.AppendElement(data);
     }
 
     return event;
 }
 
--- a/widget/xpwidgets/InputData.cpp
+++ b/widget/xpwidgets/InputData.cpp
@@ -52,18 +52,20 @@ MultiTouchInput::MultiTouchInput(const n
     float rotationAngle, force;
     domTouch->GetIdentifier(&identifier);
     domTouch->GetRadiusX(&radiusX);
     domTouch->GetRadiusY(&radiusY);
     domTouch->GetRotationAngle(&rotationAngle);
     domTouch->GetForce(&force);
 
     SingleTouchData data(identifier,
-                         domTouch->mRefPoint,
-                         nsIntPoint(radiusX, radiusY),
+                         ScreenIntPoint::FromUnknownPoint(
+                           gfx::IntPoint(domTouch->mRefPoint.x,
+                                         domTouch->mRefPoint.y)),
+                         ScreenSize(radiusX, radiusY),
                          rotationAngle,
                          force);
 
     mTouches.AppendElement(data);
   }
 }
 
 // This conversion from nsMouseEvent to MultiTouchInput is needed because on
@@ -95,14 +97,16 @@ MultiTouchInput::MultiTouchInput(const n
     mType = MULTITOUCH_CANCEL;
     break;
   default:
     NS_WARNING("Did not assign a type to a MultiTouchInput");
     break;
   }
 
   mTouches.AppendElement(SingleTouchData(0,
-                                         aMouseEvent.refPoint,
-                                         nsIntPoint(1, 1),
+                                         ScreenIntPoint::FromUnknownPoint(
+                                           gfx::IntPoint(aMouseEvent.refPoint.x,
+                                                         aMouseEvent.refPoint.y)),
+                                         ScreenSize(1, 1),
                                          180.0f,
                                          1.0f));
 }
 }