Bug 1515774 - Use Screen pixels for gesture detection. r=botond
☠☠ backed out by 031ad7f55774 ☠ ☠
authorEitan Isaacson <eitan@monotonous.org>
Tue, 29 Jan 2019 20:51:39 +0000
changeset 456019 8e17cc234256bc31d3fffa8889c26364e1228350
parent 455991 8ea7e6bb566945f20133d0284bffd317cf2fa5e6
child 456020 69c8787c67d63de23bfdc058d634934d3e1601b5
push id35467
push userrgurzau@mozilla.com
push dateWed, 30 Jan 2019 09:49:29 +0000
treeherdermozilla-central@68941a0829dc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1515774
milestone67.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 1515774 - Use Screen pixels for gesture detection. r=botond We currently use ParentLayer pixels in GestureEventListener, it should be Screen pixels because we care about physical distances and thresholds, not layer-relative ones. Differential Revision: https://phabricator.services.mozilla.com/D17042
gfx/layers/apz/src/APZCTreeManager.cpp
gfx/layers/apz/src/AsyncPanZoomController.cpp
gfx/layers/apz/src/GestureEventListener.cpp
gfx/layers/apz/src/GestureEventListener.h
gfx/layers/apz/test/gtest/InputUtils.h
widget/InputData.cpp
widget/InputData.h
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -1886,20 +1886,18 @@ void APZCTreeManager::SetupScrollbarDrag
 void APZCTreeManager::SynthesizePinchGestureFromMouseWheel(
     const ScrollWheelInput& aWheelInput,
     const RefPtr<AsyncPanZoomController>& aTarget) {
   MOZ_ASSERT(aTarget);
 
   ScreenPoint focusPoint = aWheelInput.mOrigin;
 
   // Compute span values based on the wheel delta.
-  // See the PinchGestureInput constructor called below for why
-  // it's OK to use ParentLayer coordinates for the span values.
-  ParentLayerCoord oldSpan = 100;
-  ParentLayerCoord newSpan = oldSpan + aWheelInput.mDeltaY;
+  ScreenCoord oldSpan = 100;
+  ScreenCoord newSpan = oldSpan + aWheelInput.mDeltaY;
 
   // There's no ambiguity as to the target for pinch gesture events.
   TargetConfirmationFlags confFlags{true};
 
   PinchGestureInput pinchStart{PinchGestureInput::PINCHGESTURE_START,
                                aWheelInput.mTime,
                                aWheelInput.mTimeStamp,
                                focusPoint,
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -1073,28 +1073,30 @@ nsEventStatus AsyncPanZoomController::Ha
     const ScreenToParentLayerMatrix4x4& aTransformToApzc) {
   APZThreadUtils::AssertOnControllerThread();
 
   nsEventStatus rv = nsEventStatus_eIgnore;
 
   switch (aEvent.mInputType) {
     case MULTITOUCH_INPUT: {
       MultiTouchInput multiTouchInput = aEvent.AsMultiTouchInput();
-      if (!multiTouchInput.TransformToLocal(aTransformToApzc)) {
-        return rv;
-      }
-
       RefPtr<GestureEventListener> listener = GetGestureEventListener();
       if (listener) {
+        // We only care about screen coordinates in the gesture listener,
+        // so we don't bother transforming the event to parent layer coordinates
         rv = listener->HandleInputEvent(multiTouchInput);
         if (rv == nsEventStatus_eConsumeNoDefault) {
           return rv;
         }
       }
 
+      if (!multiTouchInput.TransformToLocal(aTransformToApzc)) {
+        return rv;
+      }
+
       switch (multiTouchInput.mType) {
         case MultiTouchInput::MULTITOUCH_START:
           rv = OnTouchStart(multiTouchInput);
           break;
         case MultiTouchInput::MULTITOUCH_MOVE:
           rv = OnTouchMove(multiTouchInput);
           break;
         case MultiTouchInput::MULTITOUCH_END:
@@ -1187,32 +1189,34 @@ nsEventStatus AsyncPanZoomController::Ha
 nsEventStatus AsyncPanZoomController::HandleGestureEvent(
     const InputData& aEvent) {
   APZThreadUtils::AssertOnControllerThread();
 
   nsEventStatus rv = nsEventStatus_eIgnore;
 
   switch (aEvent.mInputType) {
     case PINCHGESTURE_INPUT: {
-      const PinchGestureInput& pinchGestureInput = aEvent.AsPinchGestureInput();
+      PinchGestureInput pinchGestureInput = aEvent.AsPinchGestureInput();
+      pinchGestureInput.TransformToLocal(GetTransformToThis());
       switch (pinchGestureInput.mType) {
         case PinchGestureInput::PINCHGESTURE_START:
           rv = OnScaleBegin(pinchGestureInput);
           break;
         case PinchGestureInput::PINCHGESTURE_SCALE:
           rv = OnScale(pinchGestureInput);
           break;
         case PinchGestureInput::PINCHGESTURE_END:
           rv = OnScaleEnd(pinchGestureInput);
           break;
       }
       break;
     }
     case TAPGESTURE_INPUT: {
-      const TapGestureInput& tapGestureInput = aEvent.AsTapGestureInput();
+      TapGestureInput tapGestureInput = aEvent.AsTapGestureInput();
+      tapGestureInput.TransformToLocal(GetTransformToThis());
       switch (tapGestureInput.mType) {
         case TapGestureInput::TAPGESTURE_LONG:
           rv = OnLongPress(tapGestureInput);
           break;
         case TapGestureInput::TAPGESTURE_LONG_UP:
           rv = OnLongPressUp(tapGestureInput);
           break;
         case TapGestureInput::TAPGESTURE_UP:
--- a/gfx/layers/apz/src/GestureEventListener.cpp
+++ b/gfx/layers/apz/src/GestureEventListener.cpp
@@ -33,34 +33,34 @@ static const float PINCH_START_THRESHOLD
 /**
  * Determines how fast a one touch pinch zooms in and out. The greater the
  * value, the faster it zooms.
  */
 static const float ONE_TOUCH_PINCH_SPEED = 0.005f;
 
 static bool sLongTapEnabled = true;
 
-ParentLayerPoint GetCurrentFocus(const MultiTouchInput& aEvent) {
-  const ParentLayerPoint& firstTouch = aEvent.mTouches[0].mLocalScreenPoint;
-  const ParentLayerPoint& secondTouch = aEvent.mTouches[1].mLocalScreenPoint;
+ScreenPoint GetCurrentFocus(const MultiTouchInput& aEvent) {
+  const ScreenPoint& firstTouch = aEvent.mTouches[0].mScreenPoint;
+  const ScreenPoint& secondTouch = aEvent.mTouches[1].mScreenPoint;
   return (firstTouch + secondTouch) / 2;
 }
 
-ParentLayerCoord GetCurrentSpan(const MultiTouchInput& aEvent) {
-  const ParentLayerPoint& firstTouch = aEvent.mTouches[0].mLocalScreenPoint;
-  const ParentLayerPoint& secondTouch = aEvent.mTouches[1].mLocalScreenPoint;
-  ParentLayerPoint delta = secondTouch - firstTouch;
+ScreenCoord GetCurrentSpan(const MultiTouchInput& aEvent) {
+  const ScreenPoint& firstTouch = aEvent.mTouches[0].mScreenPoint;
+  const ScreenPoint& secondTouch = aEvent.mTouches[1].mScreenPoint;
+  ScreenPoint delta = secondTouch - firstTouch;
   return delta.Length();
 }
 
-ParentLayerCoord GestureEventListener::GetYSpanFromGestureStartPoint() {
+ScreenCoord GestureEventListener::GetYSpanFromGestureStartPoint() {
   // use the position that began the one-touch-pinch gesture rather
   // mTouchStartPosition
-  const ParentLayerPoint start = mOneTouchPinchStartPosition;
-  const ParentLayerPoint& current = mTouches[0].mLocalScreenPoint;
+  const ScreenPoint start = mOneTouchPinchStartPosition;
+  const ScreenPoint& current = mTouches[0].mScreenPoint;
   return current.y - start.y;
 }
 
 TapGestureInput CreateTapEvent(const MultiTouchInput& aTouch,
                                TapGestureInput::TapGestureType aType) {
   return TapGestureInput(aType, aTouch.mTime, aTouch.mTimeStamp,
                          aTouch.mTouches[0].mScreenPoint, aTouch.modifiers);
 }
@@ -152,17 +152,17 @@ int32_t GestureEventListener::GetLastTou
 void GestureEventListener::SetLongTapEnabled(bool aLongTapEnabled) {
   sLongTapEnabled = aLongTapEnabled;
 }
 
 nsEventStatus GestureEventListener::HandleInputTouchSingleStart() {
   switch (mState) {
     case GESTURE_NONE:
       SetState(GESTURE_FIRST_SINGLE_TOUCH_DOWN);
-      mTouchStartPosition = mLastTouchInput.mTouches[0].mLocalScreenPoint;
+      mTouchStartPosition = mLastTouchInput.mTouches[0].mScreenPoint;
 
       if (sLongTapEnabled) {
         CreateLongTapTimeoutTask();
       }
       CreateMaxTapTimeoutTask();
       break;
     case GESTURE_FIRST_SINGLE_TOUCH_UP:
       if (SecondTapIsFar()) {
@@ -171,17 +171,17 @@ nsEventStatus GestureEventListener::Hand
         CancelLongTapTimeoutTask();
         CancelMaxTapTimeoutTask();
         mSingleTapSent = Nothing();
         SetState(GESTURE_NONE);
       } else {
         // Otherwise, reset the touch start position so that, if this turns into
         // a one-touch-pinch gesture, it uses the second tap's down position as
         // the focus, rather than the first tap's.
-        mTouchStartPosition = mLastTouchInput.mTouches[0].mLocalScreenPoint;
+        mTouchStartPosition = mLastTouchInput.mTouches[0].mScreenPoint;
         SetState(GESTURE_SECOND_SINGLE_TOUCH_DOWN);
       }
       break;
     default:
       NS_WARNING("Unhandled state upon single touch start");
       SetState(GESTURE_NONE);
       break;
   }
@@ -235,20 +235,19 @@ nsEventStatus GestureEventListener::Hand
       SetState(GESTURE_NONE);
       break;
   }
 
   return rv;
 }
 
 bool GestureEventListener::MoveDistanceExceeds(ScreenCoord aThreshold) const {
-  const ParentLayerPoint start = mLastTouchInput.mTouches[0].mLocalScreenPoint;
-  ParentLayerPoint delta = start - mTouchStartPosition;
   ScreenPoint screenDelta =
-      mAsyncPanZoomController->ToScreenCoordinates(delta, start);
+      ScreenPoint(mLastTouchInput.mTouches[0].mScreenPoint) -
+      mTouchStartPosition;
   return (screenDelta.Length() > aThreshold);
 }
 
 bool GestureEventListener::MoveDistanceIsLarge() const {
   return MoveDistanceExceeds(mAsyncPanZoomController->GetTouchStartTolerance());
 }
 
 bool GestureEventListener::SecondTapIsFar() const {
@@ -299,22 +298,21 @@ nsEventStatus GestureEventListener::Hand
           // If the one-touch-pinch feature is disabled, bail out of the double-
           // tap gesture instead.
           SetState(GESTURE_NONE);
           break;
         }
 
         SetState(GESTURE_ONE_TOUCH_PINCH);
 
-        ParentLayerCoord currentSpan = 1.0f;
-        ParentLayerPoint currentFocus = mTouchStartPosition;
+        ScreenCoord currentSpan = 1.0f;
+        ScreenPoint currentFocus = mTouchStartPosition;
 
         // save the position that the one-touch-pinch gesture actually begins
-        mOneTouchPinchStartPosition =
-            mLastTouchInput.mTouches[0].mLocalScreenPoint;
+        mOneTouchPinchStartPosition = mLastTouchInput.mTouches[0].mScreenPoint;
 
         PinchGestureInput pinchEvent(
             PinchGestureInput::PINCHGESTURE_START, mLastTouchInput.mTime,
             mLastTouchInput.mTimeStamp, currentFocus, currentSpan, currentSpan,
             mLastTouchInput.modifiers);
 
         rv = mAsyncPanZoomController->HandleGestureEvent(pinchEvent);
 
@@ -327,18 +325,18 @@ nsEventStatus GestureEventListener::Hand
     case GESTURE_MULTI_TOUCH_DOWN: {
       if (mLastTouchInput.mTouches.Length() < 2) {
         NS_WARNING(
             "Wrong input: less than 2 moving points in "
             "GESTURE_MULTI_TOUCH_DOWN state");
         break;
       }
 
-      ParentLayerCoord currentSpan = GetCurrentSpan(mLastTouchInput);
-      ParentLayerPoint currentFocus = GetCurrentFocus(mLastTouchInput);
+      ScreenCoord currentSpan = GetCurrentSpan(mLastTouchInput);
+      ScreenPoint currentFocus = GetCurrentFocus(mLastTouchInput);
 
       mSpanChange += fabsf(currentSpan - mPreviousSpan);
       mFocusChange += (currentFocus - mPreviousFocus).Length();
       if (mSpanChange > PINCH_START_THRESHOLD ||
           mFocusChange > PINCH_START_THRESHOLD) {
         SetState(GESTURE_PINCH);
         PinchGestureInput pinchEvent(
             PinchGestureInput::PINCHGESTURE_START, mLastTouchInput.mTime,
@@ -361,34 +359,34 @@ nsEventStatus GestureEventListener::Hand
       if (mLastTouchInput.mTouches.Length() < 2) {
         NS_WARNING(
             "Wrong input: less than 2 moving points in GESTURE_PINCH state");
         // Prevent APZC::OnTouchMove() from handling this wrong input
         rv = nsEventStatus_eConsumeNoDefault;
         break;
       }
 
-      ParentLayerCoord currentSpan = GetCurrentSpan(mLastTouchInput);
+      ScreenCoord currentSpan = GetCurrentSpan(mLastTouchInput);
 
       PinchGestureInput pinchEvent(
           PinchGestureInput::PINCHGESTURE_SCALE, mLastTouchInput.mTime,
           mLastTouchInput.mTimeStamp, GetCurrentFocus(mLastTouchInput),
           currentSpan, mPreviousSpan, mLastTouchInput.modifiers);
 
       rv = mAsyncPanZoomController->HandleGestureEvent(pinchEvent);
       mPreviousSpan = currentSpan;
 
       break;
     }
 
     case GESTURE_ONE_TOUCH_PINCH: {
-      ParentLayerCoord currentSpan = GetYSpanFromGestureStartPoint();
+      ScreenCoord currentSpan = GetYSpanFromGestureStartPoint();
       float effectiveSpan =
           1.0f + (fabsf(currentSpan.value) * ONE_TOUCH_PINCH_SPEED);
-      ParentLayerPoint currentFocus = mTouchStartPosition;
+      ScreenPoint currentFocus = mTouchStartPosition;
 
       // Invert zoom.
       if (currentSpan.value < 0) {
         effectiveSpan = 1.0f / effectiveSpan;
       }
 
       PinchGestureInput pinchEvent(
           PinchGestureInput::PINCHGESTURE_SCALE, mLastTouchInput.mTime,
@@ -463,36 +461,36 @@ nsEventStatus GestureEventListener::Hand
       if (mTouches.Length() < 2) {
         SetState(GESTURE_NONE);
       }
       break;
 
     case GESTURE_PINCH:
       if (mTouches.Length() < 2) {
         SetState(GESTURE_NONE);
-        ParentLayerPoint point = PinchGestureInput::BothFingersLifted();
+        ScreenPoint point = PinchGestureInput::BothFingersLifted<ScreenPixel>();
         if (mTouches.Length() == 1) {
           // As user still keeps one finger down the event's focus point should
           // contain meaningful data.
-          point = mTouches[0].mLocalScreenPoint;
+          point = mTouches[0].mScreenPoint;
         }
         PinchGestureInput pinchEvent(PinchGestureInput::PINCHGESTURE_END,
                                      mLastTouchInput.mTime,
                                      mLastTouchInput.mTimeStamp, point, 1.0f,
                                      1.0f, mLastTouchInput.modifiers);
         mAsyncPanZoomController->HandleGestureEvent(pinchEvent);
       }
 
       rv = nsEventStatus_eConsumeNoDefault;
 
       break;
 
     case GESTURE_ONE_TOUCH_PINCH: {
       SetState(GESTURE_NONE);
-      ParentLayerPoint point(-1, -1);
+      ScreenPoint point = PinchGestureInput::BothFingersLifted<ScreenPixel>();
       PinchGestureInput pinchEvent(PinchGestureInput::PINCHGESTURE_END,
                                    mLastTouchInput.mTime,
                                    mLastTouchInput.mTimeStamp, point, 1.0f,
                                    1.0f, mLastTouchInput.modifiers);
       mAsyncPanZoomController->HandleGestureEvent(pinchEvent);
 
       rv = nsEventStatus_eConsumeNoDefault;
 
--- a/gfx/layers/apz/src/GestureEventListener.h
+++ b/gfx/layers/apz/src/GestureEventListener.h
@@ -151,17 +151,17 @@ class GestureEventListener final {
   bool MoveDistanceExceeds(ScreenCoord aThreshold) const;
   bool MoveDistanceIsLarge() const;
   bool SecondTapIsFar() const;
 
   /**
    * Returns current vertical span, counting from the where the gesture first
    * began (after a brief delay detecting the gesture from first touch).
    */
-  ParentLayerCoord GetYSpanFromGestureStartPoint();
+  ScreenCoord GetYSpanFromGestureStartPoint();
 
   /**
    * Do actual state transition and reset substates.
    */
   void SetState(GestureState aState);
 
   RefPtr<AsyncPanZoomController> mAsyncPanZoomController;
 
@@ -180,27 +180,27 @@ class GestureEventListener final {
   GestureState mState;
 
   /**
    * Total change in span since we detected a pinch gesture. Only used when we
    * are in the |GESTURE_WAITING_PINCH| state and need to know how far zoomed
    * out we are compared to our original pinch span. Note that this does _not_
    * continue to be updated once we jump into the |GESTURE_PINCH| state.
    */
-  ParentLayerCoord mSpanChange;
+  ScreenCoord mSpanChange;
 
   /**
    * Previous span calculated for the purposes of setting inside a
    * PinchGestureInput.
    */
-  ParentLayerCoord mPreviousSpan;
+  ScreenCoord mPreviousSpan;
 
   /* Properties similar to mSpanChange and mPreviousSpan, but for the focus */
-  ParentLayerCoord mFocusChange;
-  ParentLayerPoint mPreviousFocus;
+  ScreenCoord mFocusChange;
+  ScreenPoint mPreviousFocus;
 
   /**
    * Cached copy of the last touch input.
    */
   MultiTouchInput mLastTouchInput;
 
   /**
    * Cached copy of the last tap gesture input.
@@ -214,28 +214,28 @@ class GestureEventListener final {
   /**
    * Position of the last touch that exceeds the GetTouchStartTolerance when
    * performing a one-touch-pinch gesture; using the mTouchStartPosition is
    * slightly inaccurate because by the time the touch position has passed
    * the threshold for the gesture, there is already a span that the zoom
    * is calculated from, instead of starting at 1.0 when the threshold gets
    * passed.
    */
-  ParentLayerPoint mOneTouchPinchStartPosition;
+  ScreenPoint mOneTouchPinchStartPosition;
 
   /**
    * Position of the last touch starting. This is only valid during an attempt
    * to determine if a touch is a tap. If a touch point moves away from
    * mTouchStartPosition to the distance greater than
    * AsyncPanZoomController::GetTouchStartTolerance() while in
    * GESTURE_FIRST_SINGLE_TOUCH_DOWN, GESTURE_FIRST_SINGLE_TOUCH_MAX_TAP_DOWN
    * or GESTURE_SECOND_SINGLE_TOUCH_DOWN then we're certain the gesture is
    * not tap.
    */
-  ParentLayerPoint mTouchStartPosition;
+  ScreenPoint mTouchStartPosition;
 
   /**
    * Task used to timeout a long tap. This gets posted to the UI thread such
    * that it runs a time when a single tap happens. We cache it so that
    * we can cancel it if any other touch event happens.
    *
    * The task is supposed to be non-null if in GESTURE_FIRST_SINGLE_TOUCH_DOWN
    * and GESTURE_FIRST_SINGLE_TOUCH_MAX_TAP_DOWN states.
--- a/gfx/layers/apz/test/gtest/InputUtils.h
+++ b/gfx/layers/apz/test/gtest/InputUtils.h
@@ -26,20 +26,18 @@
  * TestAsyncPanZoomController. Using this template allows us to test individual
  * APZC instances in isolation and also an entire APZ tree, while using the same
  * code to dispatch input events.
  */
 
 PinchGestureInput CreatePinchGestureInput(
     PinchGestureInput::PinchGestureType aType, const ScreenPoint& aFocus,
     float aCurrentSpan, float aPreviousSpan) {
-  ParentLayerPoint localFocus(aFocus.x, aFocus.y);
-  PinchGestureInput result(aType, 0, TimeStamp(), localFocus, aCurrentSpan,
+  PinchGestureInput result(aType, 0, TimeStamp(), aFocus, aCurrentSpan,
                            aPreviousSpan, 0);
-  result.mFocusPoint = aFocus;
   return result;
 }
 
 template <class InputReceiver>
 void SetDefaultAllowedTouchBehavior(const RefPtr<InputReceiver>& aTarget,
                                     uint64_t aInputBlockId,
                                     int touchPoints = 1) {
   nsTArray<uint32_t> defaultBehaviors;
--- a/widget/InputData.cpp
+++ b/widget/InputData.cpp
@@ -544,37 +544,25 @@ ParentLayerPoint PanGestureInput::UserMu
 }
 
 PinchGestureInput::PinchGestureInput()
     : InputData(PINCHGESTURE_INPUT), mType(PINCHGESTURE_START) {}
 
 PinchGestureInput::PinchGestureInput(PinchGestureType aType, uint32_t aTime,
                                      TimeStamp aTimeStamp,
                                      const ScreenPoint& aFocusPoint,
-                                     ParentLayerCoord aCurrentSpan,
-                                     ParentLayerCoord aPreviousSpan,
+                                     ScreenCoord aCurrentSpan,
+                                     ScreenCoord 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,
-                                     ParentLayerCoord aCurrentSpan,
-                                     ParentLayerCoord aPreviousSpan,
-                                     Modifiers aModifiers)
-    : InputData(PINCHGESTURE_INPUT, aTime, aTimeStamp, aModifiers),
-      mType(aType),
-      mLocalFocusPoint(aLocalFocusPoint),
-      mCurrentSpan(aCurrentSpan),
-      mPreviousSpan(aPreviousSpan) {}
-
 bool PinchGestureInput::TransformToLocal(
     const ScreenToParentLayerMatrix4x4& aTransform) {
   if (mFocusPoint == BothFingersLifted<ScreenPixel>()) {
     // Special value, no transform required.
     mLocalFocusPoint = BothFingersLifted();
     return true;
   }
   Maybe<ParentLayerPoint> point = UntransformBy(aTransform, mFocusPoint);
--- a/widget/InputData.h
+++ b/widget/InputData.h
@@ -409,34 +409,20 @@ class PinchGestureInput : public InputDa
     PinchGestureType, (
       PINCHGESTURE_START,
       PINCHGESTURE_SCALE,
       PINCHGESTURE_END
   ));
   // clang-format on
 
   // Construct a pinch gesture from a Screen point.
-  // (Technically, we should take the span values in Screen pixels as well,
-  // but that would require also storing them in Screen pixels and then
-  // converting them in TransformToLocal() like the focus point. Since pinch
-  // gesture events are processed by the root content APZC, the only transform
-  // between Screen and ParentLayer pixels should be a translation, which is
-  // irrelevant to span values, so we don't bother.)
   PinchGestureInput(PinchGestureType aType, uint32_t aTime,
                     TimeStamp aTimeStamp, const ScreenPoint& aFocusPoint,
-                    ParentLayerCoord aCurrentSpan,
-                    ParentLayerCoord aPreviousSpan, Modifiers aModifiers);
-
-  // Construct a pinch 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,
-                    ParentLayerCoord aCurrentSpan,
-                    ParentLayerCoord aPreviousSpan, Modifiers aModifiers);
+                    ScreenCoord aCurrentSpan, ScreenCoord 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
@@ -449,22 +435,22 @@ class PinchGestureInput : public InputDa
   // store |BothFingersLifted()|.
   ScreenPoint mFocusPoint;
 
   // |mFocusPoint| transformed to the local coordinates of the APZC targeted
   // by the hit. This is set and used by APZ.
   ParentLayerPoint mLocalFocusPoint;
 
   // The distance between the touches responsible for the pinch gesture.
-  ParentLayerCoord mCurrentSpan;
+  ScreenCoord mCurrentSpan;
 
   // The previous |mCurrentSpan| in the PinchGestureInput preceding this one.
   // This is only really relevant during a PINCHGESTURE_SCALE because when it is
   // of this type then there must have been a history of spans.
-  ParentLayerCoord mPreviousSpan;
+  ScreenCoord mPreviousSpan;
 
   // A special value for mFocusPoint used in PINCHGESTURE_END events to
   // indicate that both fingers have been lifted. If only one finger has
   // been lifted, the coordinates of the remaining finger are expected to
   // be stored in mFocusPoint.
   // For pinch events that were not triggered by touch gestures, the
   // value of mFocusPoint in a PINCHGESTURE_END event is always expected
   // to be this value.