Bug 1193062 - Make PanGestureInput transform processing work like ScrollWheelInput processing. r=kats

PanGestureInput events need to be sent to the pre-scroll position, just like wheel events.

--HG--
extra : commitid : CjK4ecz5AHl
extra : rebase_source : 438bc15164d10ddbc18e01435289859dafcf8db4
extra : histedit_source : 88a04fa28a5ceebebf48ed900d05eb9416b00b40
This commit is contained in:
Markus Stange 2015-08-07 14:37:16 -04:00
parent d55472e3ca
commit bceb8af7be

View File

@ -620,12 +620,29 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
}
break;
} case PANGESTURE_INPUT: {
FlushRepaintsToClearScreenToGeckoTransform();
PanGestureInput& panInput = aEvent.AsPanGestureInput();
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(panInput.mPanStartPoint,
&hitResult);
if (apzc) {
MOZ_ASSERT(hitResult == HitLayer || hitResult == HitDispatchToContentRegion);
// For pan gesture events, the call to ReceiveInputEvent below may result in
// scrolling, which changes the async transform. However, the event we
// want to pass to gecko should be the pre-scroll event coordinates,
// transformed into the gecko space. (pre-scroll because the mouse
// cursor is stationary during pan gesture scrolling, unlike touchmove
// events). Since we just flushed the pending repaints the transform to
// gecko space should only consist of overscroll-cancelling transforms.
Matrix4x4 transformToGecko = GetScreenToApzcTransform(apzc)
* GetApzcToGeckoTransform(apzc);
MOZ_ASSERT(transformToGecko.Is2D());
ScreenPoint untransformedStartPoint = TransformTo<ScreenPixel>(
transformToGecko, panInput.mPanStartPoint);
ScreenPoint untransformedDisplacement = TransformVector<ScreenPixel>(
transformToGecko, panInput.mPanDisplacement, panInput.mPanStartPoint);
result = mInputQueue->ReceiveInputEvent(
apzc,
/* aTargetConfirmed = */ hitResult == HitLayer,
@ -633,13 +650,8 @@ APZCTreeManager::ReceiveInputEvent(InputData& aEvent,
// Update the out-parameters so they are what the caller expects.
apzc->GetGuid(aOutTargetGuid);
Matrix4x4 transformToGecko = GetScreenToApzcTransform(apzc)
* GetApzcToGeckoTransform(apzc);
MOZ_ASSERT(transformToGecko.Is2D());
panInput.mPanStartPoint = TransformTo<ScreenPixel>(
transformToGecko, panInput.mPanStartPoint);
panInput.mPanDisplacement = TransformVector<ScreenPixel>(
transformToGecko, panInput.mPanDisplacement, panInput.mPanStartPoint);
panInput.mPanStartPoint = untransformedStartPoint;
panInput.mPanDisplacement = untransformedDisplacement;
}
break;
} case PINCHGESTURE_INPUT: { // note: no one currently sends these