Bug 1016035 - Delay the processing of a PanGestureInput block until we know whether it's a swipe. r=kats

--HG--
extra : commitid : 5utp02GzYAW
extra : rebase_source : 4415c7ac8fd3a8dbb718593bee63e89e8ba1625c
This commit is contained in:
Markus Stange 2015-08-12 00:11:54 -04:00
Родитель 360a9bf3d5
Коммит 49c4d7a190
4 изменённых файлов: 28 добавлений и 2 удалений

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

@ -426,6 +426,7 @@ PanGestureBlockState::PanGestureBlockState(const nsRefPtr<AsyncPanZoomController
const PanGestureInput& aInitialEvent)
: CancelableBlockState(aTargetApzc, aTargetConfirmed)
, mInterrupted(false)
, mWaitingForContentResponse(aInitialEvent.mRequiresContentResponse)
{
if (aTargetConfirmed) {
// Find the nearest APZC in the overscroll handoff chain that is scrollable.
@ -509,7 +510,22 @@ PanGestureBlockState::SetContentResponse(bool aPreventDefault)
if (aPreventDefault) {
mInterrupted = true;
}
return CancelableBlockState::SetContentResponse(aPreventDefault);
bool stateChanged = CancelableBlockState::SetContentResponse(aPreventDefault);
if (mWaitingForContentResponse) {
mWaitingForContentResponse = false;
stateChanged = true;
}
return stateChanged;
}
bool
PanGestureBlockState::IsReadyForHandling() const
{
if (!CancelableBlockState::IsReadyForHandling()) {
return false;
}
return !mWaitingForContentResponse ||
IsContentResponseTimerExpired();
}
bool

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

@ -262,6 +262,7 @@ public:
const PanGestureInput& aEvent);
bool SetContentResponse(bool aPreventDefault) override;
bool IsReadyForHandling() const override;
bool HasEvents() const override;
void DropEvents() override;
void HandleEvents() override;
@ -285,6 +286,7 @@ public:
private:
nsTArray<PanGestureInput> mEvents;
bool mInterrupted;
bool mWaitingForContentResponse;
};
/**

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

@ -310,7 +310,8 @@ public:
mPanDisplacement(aPanDisplacement),
mLineOrPageDeltaX(0),
mLineOrPageDeltaY(0),
mHandledByAPZ(false)
mHandledByAPZ(false),
mRequiresContentResponse(false)
{
}
@ -336,6 +337,12 @@ public:
int32_t mLineOrPageDeltaY;
bool mHandledByAPZ;
// If this is true, the input block started by this event needs to be put
// on hold until a content response has arrived, even if the block has a
// confirmed target. This is used by events that can result in a swipe
// instead of a scroll.
bool mRequiresContentResponse;
};
/**

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

@ -4872,6 +4872,7 @@ PanGestureTypeForEvent(NSEvent* aEvent)
panEvent.mLineOrPageDeltaY = lineOrPageDeltaY;
bool canTriggerSwipe = [self shouldConsiderStartingSwipeFromEvent:theEvent];
panEvent.mRequiresContentResponse = canTriggerSwipe;
mGeckoChild->DispatchAPZWheelInputEvent(panEvent, canTriggerSwipe);
} else if (usePreciseDeltas) {
// This is on 10.6 or old touchpads that don't have any phase information.