WebTouchEvent previous_event = previous_event_;
previous_event_ = event;
+ if (!event.touchesLength) {
+ error_msg->append("Touch event is empty.\n");
+ return false;
+ }
+
+ if (!WebInputEvent::isTouchEventType(event.type))
+ error_msg->append("Touch event has invalid type.\n");
+
// Allow "hard" restarting of touch stream validation. This is necessary
// in cases where touch event forwarding ceases in response to the event ack
// or removal of touch handlers.
error_msg->append("Previously active touch point not in new event.\n");
}
+ bool found_valid_state_for_type = false;
for (unsigned i = 0; i < event.touchesLength; ++i) {
const WebTouchPoint& point = event.touches[i];
const WebTouchPoint* previous_point =
case WebTouchPoint::StateReleased:
if (event.type != WebInputEvent::TouchEnd)
error_msg->append("Released touch point outside touchend.\n");
+ else
+ found_valid_state_for_type = true;
break;
case WebTouchPoint::StatePressed:
if (event.type != WebInputEvent::TouchStart)
error_msg->append("Pressed touch point outside touchstart.\n");
+ else
+ found_valid_state_for_type = true;
break;
case WebTouchPoint::StateMoved:
if (event.type != WebInputEvent::TouchMove)
error_msg->append("Moved touch point outside touchmove.\n");
+ else
+ found_valid_state_for_type = true;
break;
case WebTouchPoint::StateStationary:
case WebTouchPoint::StateCancelled:
if (event.type != WebInputEvent::TouchCancel)
error_msg->append("Cancelled touch point outside touchcancel.\n");
+ else
+ found_valid_state_for_type = true;
break;
}
}
+
+ if (!found_valid_state_for_type)
+ error_msg->append("No valid touch point corresponding to event type.");
+
return error_msg->empty();
}