Bug 950300 - Cancel APZC panning is the first touchmove is preventDefault'ed. r=kats

This commit is contained in:
Vivien Nicolas 2013-12-20 10:11:01 +01:00
Родитель 549b9bddc1
Коммит 88d9b0d654
3 изменённых файлов: 39 добавлений и 10 удалений

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

@ -279,7 +279,7 @@ const ContentPanning = {
this._activationTimer.cancel();
}
if (this.panning) {
if (this.panning && docShell.asyncPanZoomEnabled === false) {
// Only do this when we're actually executing a pan gesture.
// Otherwise synthetic mouse events will be canceled.
evt.stopPropagation();

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

@ -288,6 +288,7 @@ TabChild::TabChild(ContentChild* aManager, const TabContext& aContext, uint32_t
, mOrientation(eScreenOrientation_PortraitPrimary)
, mUpdateHitRegion(false)
, mContextMenuHandled(false)
, mWaitingTouchListeners(false)
{
}
@ -1868,16 +1869,43 @@ TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent,
WidgetTouchEvent localEvent(aEvent);
nsEventStatus status = DispatchWidgetEvent(localEvent);
if (IsAsyncPanZoomEnabled()) {
nsCOMPtr<nsPIDOMWindow> outerWindow = do_GetInterface(mWebNav);
nsCOMPtr<nsPIDOMWindow> innerWindow = outerWindow->GetCurrentInnerWindow();
if (innerWindow && innerWindow->HasTouchEventListeners()) {
SendContentReceivedTouch(aGuid, nsIPresShell::gPreventMouseEvents ||
localEvent.mFlags.mMultipleActionsPrevented);
}
} else {
if (!IsAsyncPanZoomEnabled()) {
UpdateTapState(localEvent, status);
return true;
}
nsCOMPtr<nsPIDOMWindow> outerWindow = do_GetInterface(mWebNav);
nsCOMPtr<nsPIDOMWindow> innerWindow = outerWindow->GetCurrentInnerWindow();
if (!innerWindow || !innerWindow->HasTouchEventListeners()) {
SendContentReceivedTouch(aGuid, false);
return true;
}
bool isTouchPrevented = nsIPresShell::gPreventMouseEvents ||
localEvent.mFlags.mMultipleActionsPrevented;
switch (aEvent.message) {
case NS_TOUCH_START: {
if (isTouchPrevented) {
SendContentReceivedTouch(aGuid, isTouchPrevented);
} else {
mWaitingTouchListeners = true;
}
break;
}
case NS_TOUCH_MOVE:
case NS_TOUCH_END:
case NS_TOUCH_CANCEL: {
if (mWaitingTouchListeners) {
SendContentReceivedTouch(aGuid, isTouchPrevented);
mWaitingTouchListeners = false;
}
break;
}
default:
NS_WARNING("Unknown touch event type");
}
return true;

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

@ -499,6 +499,7 @@ private:
ScreenOrientation mOrientation;
bool mUpdateHitRegion;
bool mContextMenuHandled;
bool mWaitingTouchListeners;
DISALLOW_EVIL_CONSTRUCTORS(TabChild);
};