Bug 960565 - Reset touch counter with every touch start event. r=kats

This commit is contained in:
Dmitry Rozhkov 2014-01-22 16:06:35 +02:00
parent d42102847c
commit 1aa8b3f123

View File

@ -320,7 +320,9 @@ APZCTreeManager::ReceiveInputEvent(const InputData& aEvent,
case MULTITOUCH_INPUT: {
const MultiTouchInput& multiTouchInput = aEvent.AsMultiTouchInput();
if (multiTouchInput.mType == MultiTouchInput::MULTITOUCH_START) {
mTouchCount++;
// MULTITOUCH_START input contains all active touches of the current
// session thus resetting mTouchCount.
mTouchCount = multiTouchInput.mTouches.Length();
mApzcForInputBlock = GetTargetAPZC(ScreenPoint(multiTouchInput.mTouches[0].mScreenPoint));
if (multiTouchInput.mTouches.Length() == 1) {
// If we have one touch point, this might be the start of a pan.
@ -363,6 +365,7 @@ APZCTreeManager::ReceiveInputEvent(const InputData& aEvent,
if (multiTouchInput.mType == MultiTouchInput::MULTITOUCH_CANCEL ||
multiTouchInput.mType == MultiTouchInput::MULTITOUCH_END) {
if (mTouchCount >= multiTouchInput.mTouches.Length()) {
// MULTITOUCH_END input contains only released touches thus decrementing.
mTouchCount -= multiTouchInput.mTouches.Length();
} else {
NS_WARNING("Got an unexpected touchend/touchcancel");
@ -438,7 +441,9 @@ APZCTreeManager::ProcessTouchEvent(const WidgetTouchEvent& aEvent,
return ret;
}
if (aEvent.message == NS_TOUCH_START) {
mTouchCount++;
// NS_TOUCH_START event contains all active touches of the current
// session thus resetting mTouchCount.
mTouchCount = aEvent.touches.Length();
mApzcForInputBlock = GetTouchInputBlockAPZC(aEvent);
if (mApzcForInputBlock) {
// Cache apz transform so it can be used for future events in this block.
@ -477,6 +482,7 @@ APZCTreeManager::ProcessTouchEvent(const WidgetTouchEvent& aEvent,
if (aEvent.message == NS_TOUCH_CANCEL ||
aEvent.message == NS_TOUCH_END) {
if (mTouchCount >= aEvent.touches.Length()) {
// NS_TOUCH_END event contains only released touches thus decrementing.
mTouchCount -= aEvent.touches.Length();
} else {
NS_WARNING("Got an unexpected touchend/touchcancel");