Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / content / common / input / gesture_event_stream_validator.cc
index a6229f9..eccdbe0 100644 (file)
@@ -24,8 +24,10 @@ bool GestureEventStreamValidator::Validate(const blink::WebGestureEvent& event,
   error_msg->clear();
   switch (event.type) {
     case WebInputEvent::GestureScrollBegin:
-      if (scrolling_ || pinching_)
+      if (scrolling_)
         error_msg->append("Scroll begin during scroll\n");
+      if (pinching_)
+        error_msg->append("Scroll begin during pinch\n");
       scrolling_ = true;
       break;
     case WebInputEvent::GestureScrollUpdate:
@@ -42,18 +44,16 @@ bool GestureEventStreamValidator::Validate(const blink::WebGestureEvent& event,
       scrolling_ = false;
       break;
     case WebInputEvent::GesturePinchBegin:
-      if (!scrolling_)
-        error_msg->append("Pinch begin outside of scroll\n");
       if (pinching_)
         error_msg->append("Pinch begin during pinch\n");
       pinching_ = true;
       break;
     case WebInputEvent::GesturePinchUpdate:
-      if (!pinching_ || !scrolling_)
+      if (!pinching_)
         error_msg->append("Pinch update outside of pinch\n");
       break;
     case WebInputEvent::GesturePinchEnd:
-      if (!pinching_ || !scrolling_)
+      if (!pinching_)
         error_msg->append("Pinch end outside of pinch\n");
       pinching_ = false;
       break;
@@ -62,11 +62,19 @@ bool GestureEventStreamValidator::Validate(const blink::WebGestureEvent& event,
         error_msg->append("Missing tap end event\n");
       waiting_for_tap_end_ = true;
       break;
-    case WebInputEvent::GestureTap:
+    case WebInputEvent::GestureTapUnconfirmed:
+      if (!waiting_for_tap_end_)
+        error_msg->append("Missing TapDown event before TapUnconfirmed\n");
+      break;
     case WebInputEvent::GestureTapCancel:
-    case WebInputEvent::GestureDoubleTap:
       if (!waiting_for_tap_end_)
-        error_msg->append("Missing GestureTapDown event\n");
+        error_msg->append("Missing TapDown event before TapCancel\n");
+      waiting_for_tap_end_ = false;
+      break;
+    case WebInputEvent::GestureTap:
+    case WebInputEvent::GestureDoubleTap:
+      // Both Tap and DoubleTap gestures may be synthetically inserted, and do
+      // not require a preceding TapDown.
       waiting_for_tap_end_ = false;
       break;
     default: