Bug 1142437 - Better deal with delayed state change notifications from APZ. r=botond

This commit is contained in:
Kartikaya Gupta 2015-03-19 06:54:34 -04:00
Родитель c2d393f065
Коммит 83d084edc5
3 изменённых файлов: 22 добавлений и 8 удалений

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

@ -282,7 +282,7 @@ APZEventState::ProcessTouchEvent(const WidgetTouchEvent& aEvent,
}
// fall through
case NS_TOUCH_CANCEL:
mActiveElementManager->HandleTouchEnd(mEndTouchIsClick);
mActiveElementManager->HandleTouchEndEvent(mEndTouchIsClick);
// fall through
case NS_TOUCH_MOVE: {
SendPendingTouchPreventedResponse(isTouchPrevented, aGuid);
@ -365,6 +365,7 @@ APZEventState::ProcessAPZStateChange(const nsCOMPtr<nsIDocument>& aDocument,
case APZStateChange::EndTouch:
{
mEndTouchIsClick = aArg;
mActiveElementManager->HandleTouchEnd();
break;
}
default:

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

@ -109,9 +109,9 @@ ActiveElementManager::HandlePanStart()
}
void
ActiveElementManager::HandleTouchEnd(bool aWasClick)
ActiveElementManager::HandleTouchEndEvent(bool aWasClick)
{
AEM_LOG("Touch end, aWasClick: %d\n", aWasClick);
AEM_LOG("Touch end event, aWasClick: %d\n", aWasClick);
// If the touch was a click, make mTarget :active right away.
// nsEventStateManager will reset the active element when processing
@ -129,6 +129,13 @@ ActiveElementManager::HandleTouchEnd(bool aWasClick)
ResetTouchBlockState();
}
void
ActiveElementManager::HandleTouchEnd()
{
AEM_LOG("Touch end, clearing pan state\n");
mCanBePanSet = false;
}
bool
ActiveElementManager::ActiveElementUsesStyle() const
{

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

@ -33,14 +33,15 @@ public:
/**
* Specify the target of a touch. Typically this should be called right
* before HandleTouchStart(), but we give callers the flexibility to specify
* the target later if they don't know it at the time they call
* HandleTouchStart().
* after HandleTouchStart(), but in cases where the APZ needs to wait for
* a content response the HandleTouchStart() may be delayed, in which case
* this function can be called first.
* |aTarget| may be nullptr.
*/
void SetTargetElement(dom::EventTarget* aTarget);
/**
* Handle a touch-start event.
* Handle a touch-start state notification from APZ. This notification
* may be delayed until after touch listeners have responded to the APZ.
* @param aCanBePan whether the touch can be a pan
*/
void HandleTouchStart(bool aCanBePan);
@ -52,7 +53,12 @@ public:
* Handle a touch-end or touch-cancel event.
* @param aWasClick whether the touch was a click
*/
void HandleTouchEnd(bool aWasClick);
void HandleTouchEndEvent(bool aWasClick);
/**
* Handle a touch-end state notification from APZ. This notification may be
* delayed until after touch listeners have responded to the APZ.
*/
void HandleTouchEnd();
/**
* @return true iff the currently active element (or one of its ancestors)
* actually had a style for the :active pseudo-class. The currently active