Source/WebKit/chromium: Use new type-specific WebGestureEvent fields
[WebKit-https.git] / Tools / DumpRenderTree / chromium / TestRunner / EventSender.cpp
index 1ebd741..d5eaac4 100644 (file)
@@ -286,6 +286,7 @@ EventSender::EventSender()
     bindMethod("gestureScrollFirstPoint", &EventSender::gestureScrollFirstPoint);
     bindMethod("gestureScrollUpdate", &EventSender::gestureScrollUpdate);
     bindMethod("gestureTap", &EventSender::gestureTap);
+    bindMethod("gestureTapDown", &EventSender::gestureTapDown);
     bindMethod("gestureLongPress", &EventSender::gestureLongPress);
     bindMethod("gestureTwoFingerTap", &EventSender::gestureTwoFingerTap);
     bindMethod("zoomPageIn", &EventSender::zoomPageIn);
@@ -1112,6 +1113,12 @@ void EventSender::gestureTap(const CppArgumentList& arguments, CppVariant* resul
     gestureEvent(WebInputEvent::GestureTap, arguments);
 }
 
+void EventSender::gestureTapDown(const CppArgumentList& arguments, CppVariant* result)
+{
+    result->setNull();
+    gestureEvent(WebInputEvent::GestureTapDown, arguments);
+}
+
 void EventSender::gestureLongPress(const CppArgumentList& arguments, CppVariant* result)
 {
     result->setNull();
@@ -1146,12 +1153,12 @@ void EventSender::gestureEvent(WebInputEvent::Type type, const CppArgumentList&
 
     switch (type) {
     case WebInputEvent::GestureScrollUpdate:
-        event.deltaX = static_cast<float>(arguments[0].toDouble());
-        event.deltaY = static_cast<float>(arguments[1].toDouble());
+        event.data.scrollUpdate.deltaX = static_cast<float>(arguments[0].toDouble());
+        event.data.scrollUpdate.deltaY = static_cast<float>(arguments[1].toDouble());
         event.x = m_currentGestureLocation.x;
         event.y = m_currentGestureLocation.y;
-        m_currentGestureLocation.x = m_currentGestureLocation.x + event.deltaX;
-        m_currentGestureLocation.y = m_currentGestureLocation.y + event.deltaY;
+        m_currentGestureLocation.x = m_currentGestureLocation.x + event.data.scrollUpdate.deltaX;
+        m_currentGestureLocation.y = m_currentGestureLocation.y + event.data.scrollUpdate.deltaY;
         break;
 
     case WebInputEvent::GestureScrollBegin:
@@ -1160,16 +1167,18 @@ void EventSender::gestureEvent(WebInputEvent::Type type, const CppArgumentList&
         event.y = m_currentGestureLocation.y;
         break;
     case WebInputEvent::GestureScrollEnd:
-        event.deltaX = static_cast<float>(arguments[0].toDouble());
-        event.deltaY = static_cast<float>(arguments[1].toDouble());
         event.x = m_currentGestureLocation.x;
         event.y = m_currentGestureLocation.y;
         break;
     case WebInputEvent::GestureTap:
-        if (arguments.size() >= 3) {
-            // Tap count.
-            event.deltaX = static_cast<float>(arguments[2].toDouble());
-        }
+        if (arguments.size() >= 3)
+            event.data.tap.tapCount = static_cast<float>(arguments[2].toDouble());
+        else
+          event.data.tap.tapCount = 1;
+        event.x = point.x;
+        event.y = point.y;
+        break;
+    case WebInputEvent::GestureTapDown:
         event.x = point.x;
         event.y = point.y;
         break;
@@ -1221,8 +1230,8 @@ void EventSender::gestureFlingStart(const CppArgumentList& arguments, CppVariant
     event.globalX = event.x;
     event.globalY = event.y;
 
-    event.deltaX = static_cast<float>(arguments[2].toDouble());
-    event.deltaY = static_cast<float>(arguments[3].toDouble());
+    event.data.flingStart.velocityX = static_cast<float>(arguments[2].toDouble());
+    event.data.flingStart.velocityY = static_cast<float>(arguments[3].toDouble());
     event.timeStampSeconds = getCurrentEventTimeSec();
     webview()->handleInputEvent(event);
 }