Bug 1304729 - When transitioning from a pinch to a pan, make sure we start the pan with the correct coordinates. r=botond

MozReview-Commit-ID: CC4gPT2jubR
This commit is contained in:
Kartikaya Gupta 2016-09-22 14:54:01 -04:00
Родитель 83607aede9
Коммит 0e04f56656
5 изменённых файлов: 9 добавлений и 27 удалений

Просмотреть файл

@ -1442,8 +1442,8 @@ nsEventStatus AsyncPanZoomController::OnScaleEnd(const PinchGestureInput& aEvent
// Non-negative focus point would indicate that one finger is still down
if (aEvent.mFocusPoint.x != -1 && aEvent.mFocusPoint.y != -1) {
mPanDirRestricted = false;
mX.StartTouch(aEvent.mFocusPoint.x, aEvent.mTime);
mY.StartTouch(aEvent.mFocusPoint.y, aEvent.mTime);
mX.StartTouch(aEvent.mLocalFocusPoint.x, aEvent.mTime);
mY.StartTouch(aEvent.mLocalFocusPoint.y, aEvent.mTime);
SetState(TOUCHING);
} else {
// Otherwise, handle the fingers being lifted.

Просмотреть файл

@ -105,6 +105,7 @@ nsEventStatus GestureEventListener::HandleInputEvent(const MultiTouchInput& aEve
for (size_t j = 0; j < mTouches.Length(); j++) {
if (aEvent.mTouches[i].mIdentifier == mTouches[j].mIdentifier) {
mTouches[j].mScreenPoint = aEvent.mTouches[i].mScreenPoint;
mTouches[j].mLocalScreenPoint = aEvent.mTouches[i].mLocalScreenPoint;
}
}
}
@ -385,11 +386,11 @@ nsEventStatus GestureEventListener::HandleInputTouchEnd()
case GESTURE_PINCH:
if (mTouches.Length() < 2) {
SetState(GESTURE_NONE);
ScreenPoint point(-1, -1);
ParentLayerPoint point(-1, -1);
if (mTouches.Length() == 1) {
// As user still keeps one finger down the event's focus point should
// contain meaningful data.
point = mTouches[0].mScreenPoint;
point = mTouches[0].mLocalScreenPoint;
}
PinchGestureInput pinchEvent(PinchGestureInput::PINCHGESTURE_END,
mLastTouchInput.mTime,

Просмотреть файл

@ -51,9 +51,10 @@ CreatePinchGestureInput(PinchGestureInput::PinchGestureType aType,
const ScreenIntPoint& aFocus,
float aCurrentSpan, float aPreviousSpan)
{
PinchGestureInput result(aType, 0, TimeStamp(), aFocus,
ParentLayerPoint localFocus(aFocus.x, aFocus.y);
PinchGestureInput result(aType, 0, TimeStamp(), localFocus,
aCurrentSpan, aPreviousSpan, 0);
result.mLocalFocusPoint = ParentLayerPoint(aFocus.x, aFocus.y);
result.mFocusPoint = aFocus;
return result;
}

Просмотреть файл

@ -565,19 +565,6 @@ PinchGestureInput::PinchGestureInput()
{
}
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,

Просмотреть файл

@ -428,14 +428,7 @@ public:
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);
// Construct a tap gesture from a ParentLayer point.
// 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, float aCurrentSpan,