Title: [108643] trunk
Revision
108643
Author
[email protected]
Date
2012-02-23 11:00:11 -0800 (Thu, 23 Feb 2012)

Log Message

[Qt] Add support for touch cancellation
https://bugs.webkit.org/show_bug.cgi?id=79348

Reviewed by Kenneth Rohde Christiansen.

Source/WebCore:

Map Qt touch cancel events to the WebCore equivalent.

No new tests, unskipped existing test for Qt 5.

* platform/PlatformTouchPoint.h:
(PlatformTouchPoint):
* platform/qt/PlatformTouchEventQt.cpp:
(WebCore::PlatformTouchEvent::PlatformTouchEvent):
* platform/qt/PlatformTouchPointQt.cpp:
(WebCore::PlatformTouchPoint::PlatformTouchPoint):

Source/WebKit/qt:

Forward incoming touch cancellation events to the WebCore
event handler.

* Api/qgraphicswebview.cpp:
(QGraphicsWebView::sceneEvent):
* Api/qwebpage.cpp:
(QWebPage::event):
* Api/qwebview.cpp:
(QWebView::event):

Source/WebKit2:

Convert and forward incoming touch cancellation events
to the web process.

* Shared/qt/WebEventFactoryQt.cpp:
(WebKit::webEventTypeForEvent):
(WebKit::WebEventFactory::createWebTouchEvent):
* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebView::event):
* UIProcess/qt/QtWebPageEventHandler.cpp:
(QtWebPageEventHandler::handleEvent):

Tools:

Added straight-forward touch cancellation event sending to Qt WK1 DRT
and WK2 WTR.

* DumpRenderTree/qt/EventSenderQt.cpp:
(EventSender::touchCancel):
(EventSender::cancelTouchPoint):
* DumpRenderTree/qt/EventSenderQt.h:
(EventSender):
* WebKitTestRunner/EventSenderProxy.h:
(EventSenderProxy):
* WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
* WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
(WTR::EventSendingController::touchCancel):
(WTR):
(WTR::EventSendingController::cancelTouchPoint):
* WebKitTestRunner/InjectedBundle/EventSendingController.h:
(EventSendingController):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::didReceiveSynchronousMessageFromInjectedBundle):
* WebKitTestRunner/qt/EventSenderProxyQt.cpp:
(WTR::EventSenderProxy::touchCancel):
(WTR):
(WTR::EventSenderProxy::cancelTouchPoint):

LayoutTests:

Moved touch cancel event layout tests from general skip list to the
Qt 4 specific one. The Qt 5 version we depend on has QEvent::TouchCancel, which
is all we need in order to implement touch cancellation in DRT/WTR.

* platform/qt-4.8/Skipped:
* platform/qt/Skipped:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (108642 => 108643)


--- trunk/LayoutTests/ChangeLog	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/LayoutTests/ChangeLog	2012-02-23 19:00:11 UTC (rev 108643)
@@ -1,3 +1,17 @@
+2012-02-23  Simon Hausmann  <[email protected]>
+
+        [Qt] Add support for touch cancellation
+        https://bugs.webkit.org/show_bug.cgi?id=79348
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Moved touch cancel event layout tests from general skip list to the
+        Qt 4 specific one. The Qt 5 version we depend on has QEvent::TouchCancel, which
+        is all we need in order to implement touch cancellation in DRT/WTR.
+
+        * platform/qt-4.8/Skipped:
+        * platform/qt/Skipped:
+
 2012-02-23  ChangSeok Oh  <[email protected]>
 
         [GTK] DRT doesn't support scheduleAsynchronousKeyDown.

Modified: trunk/LayoutTests/platform/qt/Skipped (108642 => 108643)


--- trunk/LayoutTests/platform/qt/Skipped	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/LayoutTests/platform/qt/Skipped	2012-02-23 19:00:11 UTC (rev 108643)
@@ -1534,8 +1534,6 @@
 fast/repaint/block-selection-gap-stale-cache.html
 fast/repaint/inline-overflow.html
 fast/repaint/inline-relative-positioned.html
-# eventSender missing touchCancel() and cancelTouchPoint()
-fast/events/touch/send-oncancel-event.html
 
 # Relies on WebKit API [WebView _loadBackForwardListFromOtherView:]
 fast/loader/crash-copying-backforwardlist.html

Modified: trunk/LayoutTests/platform/qt-4.8/Skipped (108642 => 108643)


--- trunk/LayoutTests/platform/qt-4.8/Skipped	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/LayoutTests/platform/qt-4.8/Skipped	2012-02-23 19:00:11 UTC (rev 108643)
@@ -62,3 +62,6 @@
 http/tests/misc/drag-over-iframe-invalid-source-crash.html
 fast/events/drag-selects-image.html
 #################################################
+
+# eventSender missing touchCancel() and cancelTouchPoint()
+fast/events/touch/send-oncancel-event.html

Modified: trunk/Source/WebCore/ChangeLog (108642 => 108643)


--- trunk/Source/WebCore/ChangeLog	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Source/WebCore/ChangeLog	2012-02-23 19:00:11 UTC (rev 108643)
@@ -1,3 +1,21 @@
+2012-02-23  Simon Hausmann  <[email protected]>
+
+        [Qt] Add support for touch cancellation
+        https://bugs.webkit.org/show_bug.cgi?id=79348
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Map Qt touch cancel events to the WebCore equivalent.
+
+        No new tests, unskipped existing test for Qt 5.
+
+        * platform/PlatformTouchPoint.h:
+        (PlatformTouchPoint):
+        * platform/qt/PlatformTouchEventQt.cpp:
+        (WebCore::PlatformTouchEvent::PlatformTouchEvent):
+        * platform/qt/PlatformTouchPointQt.cpp:
+        (WebCore::PlatformTouchPoint::PlatformTouchPoint):
+
 2012-02-23  Erik Arvidsson  <[email protected]>
 
         Unreviewed. Rebaseline binding test files.

Modified: trunk/Source/WebCore/platform/PlatformTouchPoint.h (108642 => 108643)


--- trunk/Source/WebCore/platform/PlatformTouchPoint.h	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Source/WebCore/platform/PlatformTouchPoint.h	2012-02-23 19:00:11 UTC (rev 108643)
@@ -48,7 +48,7 @@
     PlatformTouchPoint() { };
 
 #if PLATFORM(QT)
-    PlatformTouchPoint(const QTouchEvent::TouchPoint&);
+    PlatformTouchPoint(const QTouchEvent::TouchPoint&, State);
 #elif PLATFORM(EFL)
     PlatformTouchPoint(unsigned id, const IntPoint& windowPos, State);
 #endif

Modified: trunk/Source/WebCore/platform/qt/PlatformTouchEventQt.cpp (108642 => 108643)


--- trunk/Source/WebCore/platform/qt/PlatformTouchEventQt.cpp	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Source/WebCore/platform/qt/PlatformTouchEventQt.cpp	2012-02-23 19:00:11 UTC (rev 108643)
@@ -40,12 +40,40 @@
     case QEvent::TouchEnd:
         m_type = PlatformEvent::TouchEnd;
         break;
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    case QEvent::TouchCancel:
+        m_type = PlatformEvent::TouchCancel;
+        break;
+#endif
     }
 
     const QList<QTouchEvent::TouchPoint>& points = event->touchPoints();
-    for (int i = 0; i < points.count(); ++i)
-        m_touchPoints.append(PlatformTouchPoint(points.at(i)));
+    for (int i = 0; i < points.count(); ++i) {
+        PlatformTouchPoint::State state = PlatformTouchPoint::TouchStateEnd;
 
+        switch (points.at(i).state()) {
+        case Qt::TouchPointReleased:
+            state = PlatformTouchPoint::TouchReleased;
+            break;
+        case Qt::TouchPointMoved:
+            state = PlatformTouchPoint::TouchMoved;
+            break;
+        case Qt::TouchPointPressed:
+            state = PlatformTouchPoint::TouchPressed;
+            break;
+        case Qt::TouchPointStationary:
+            state = PlatformTouchPoint::TouchStationary;
+            break;
+        }
+
+        // Qt does not have a Qt::TouchPointCancelled point state, so if we receive a touch cancel event,
+        // simply cancel all touch points here.
+        if (m_type == PlatformEvent::TouchCancel)
+            state = PlatformTouchPoint::TouchCancelled;
+
+        m_touchPoints.append(PlatformTouchPoint(points.at(i), state));
+    }
+
     m_modifiers = 0;
     if (event->modifiers()  & Qt::ShiftModifier)
         m_modifiers |= ShiftKey;

Modified: trunk/Source/WebCore/platform/qt/PlatformTouchPointQt.cpp (108642 => 108643)


--- trunk/Source/WebCore/platform/qt/PlatformTouchPointQt.cpp	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Source/WebCore/platform/qt/PlatformTouchPointQt.cpp	2012-02-23 19:00:11 UTC (rev 108643)
@@ -27,18 +27,13 @@
 
 namespace WebCore {
 
-PlatformTouchPoint::PlatformTouchPoint(const QTouchEvent::TouchPoint& point)
+PlatformTouchPoint::PlatformTouchPoint(const QTouchEvent::TouchPoint& point, State state)
     // The QTouchEvent::TouchPoint API states that ids will be >= 0.
     : m_id(point.id())
+    , m_state(state)
     , m_screenPos(point.screenPos().toPoint())
     , m_pos(point.pos().toPoint())
 {
-    switch (point.state()) {
-    case Qt::TouchPointReleased: m_state = TouchReleased; break;
-    case Qt::TouchPointMoved: m_state = TouchMoved; break;
-    case Qt::TouchPointPressed: m_state = TouchPressed; break;
-    case Qt::TouchPointStationary: m_state = TouchStationary; break;
-    }
     // Qt reports touch point size as rectangles, but we will pretend it is an oval.
     QRect touchRect = point.rect().toAlignedRect();
     if (touchRect.isValid()) {

Modified: trunk/Source/WebKit/qt/Api/qgraphicswebview.cpp (108642 => 108643)


--- trunk/Source/WebKit/qt/Api/qgraphicswebview.cpp	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Source/WebKit/qt/Api/qgraphicswebview.cpp	2012-02-23 19:00:11 UTC (rev 108643)
@@ -312,7 +312,11 @@
 
     if (d->page && (event->type() == QEvent::TouchBegin
                 || event->type() == QEvent::TouchEnd
-                || event->type() == QEvent::TouchUpdate)) {
+                || event->type() == QEvent::TouchUpdate
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+                || event->type() == QEvent::TouchCancel
+#endif
+       )) {
         d->page->event(event);
 
         // Always return true so that we'll receive also TouchUpdate and TouchEnd events

Modified: trunk/Source/WebKit/qt/Api/qwebpage.cpp (108642 => 108643)


--- trunk/Source/WebKit/qt/Api/qwebpage.cpp	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Source/WebKit/qt/Api/qwebpage.cpp	2012-02-23 19:00:11 UTC (rev 108643)
@@ -3116,6 +3116,9 @@
     case QEvent::TouchBegin:
     case QEvent::TouchUpdate:
     case QEvent::TouchEnd:
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    case QEvent::TouchCancel:
+#endif
         // Return whether the default action was cancelled in the JS event handler
         return d->touchEvent(static_cast<QTouchEvent*>(ev));
 #ifndef QT_NO_PROPERTIES

Modified: trunk/Source/WebKit/qt/Api/qwebview.cpp (108642 => 108643)


--- trunk/Source/WebKit/qt/Api/qwebview.cpp	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Source/WebKit/qt/Api/qwebview.cpp	2012-02-23 19:00:11 UTC (rev 108643)
@@ -703,7 +703,11 @@
 #endif
         } else if (e->type() == QEvent::TouchBegin 
                    || e->type() == QEvent::TouchEnd 
-                   || e->type() == QEvent::TouchUpdate) {
+                   || e->type() == QEvent::TouchUpdate
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+                   || e->type() == QEvent::TouchCancel
+#endif
+                  ) {
             d->page->event(e);
 
             // Always return true so that we'll receive also TouchUpdate and TouchEnd events

Modified: trunk/Source/WebKit/qt/ChangeLog (108642 => 108643)


--- trunk/Source/WebKit/qt/ChangeLog	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Source/WebKit/qt/ChangeLog	2012-02-23 19:00:11 UTC (rev 108643)
@@ -1,3 +1,20 @@
+2012-02-23  Simon Hausmann  <[email protected]>
+
+        [Qt] Add support for touch cancellation
+        https://bugs.webkit.org/show_bug.cgi?id=79348
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Forward incoming touch cancellation events to the WebCore
+        event handler.
+
+        * Api/qgraphicswebview.cpp:
+        (QGraphicsWebView::sceneEvent):
+        * Api/qwebpage.cpp:
+        (QWebPage::event):
+        * Api/qwebview.cpp:
+        (QWebView::event):
+
 2012-02-22  Hajime Morrita  <[email protected]>
 
         NOTIFICATIONS should be implemented as PageSupplement

Modified: trunk/Source/WebKit2/ChangeLog (108642 => 108643)


--- trunk/Source/WebKit2/ChangeLog	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Source/WebKit2/ChangeLog	2012-02-23 19:00:11 UTC (rev 108643)
@@ -1,3 +1,21 @@
+2012-02-23  Simon Hausmann  <[email protected]>
+
+        [Qt] Add support for touch cancellation
+        https://bugs.webkit.org/show_bug.cgi?id=79348
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Convert and forward incoming touch cancellation events
+        to the web process.
+
+        * Shared/qt/WebEventFactoryQt.cpp:
+        (WebKit::webEventTypeForEvent):
+        (WebKit::WebEventFactory::createWebTouchEvent):
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebView::event):
+        * UIProcess/qt/QtWebPageEventHandler.cpp:
+        (QtWebPageEventHandler::handleEvent):
+
 2012-02-23  Brent Fulgham  <[email protected]>
 
         [WinCairo] Build fix after r108428.

Modified: trunk/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp (108642 => 108643)


--- trunk/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp	2012-02-23 19:00:11 UTC (rev 108643)
@@ -86,6 +86,8 @@
         return WebEvent::TouchMove;
     case QEvent::TouchEnd:
         return WebEvent::TouchEnd;
+    case QEvent::TouchCancel:
+        return WebEvent::TouchCancel;
 #endif
     default:
         // assert
@@ -207,6 +209,11 @@
             break;
         }
 
+        // Qt does not have a Qt::TouchPointCancelled point state, so if we receive a touch cancel event,
+        // simply cancel all touch points here.
+        if (type == WebEvent::TouchCancel)
+            state = WebPlatformTouchPoint::TouchCancelled;
+
         m_touchPoints.append(WebPlatformTouchPoint(id, state, touchPoint.screenPos().toPoint(), fromItemTransform.map(touchPoint.pos()).toPoint()));
     }
 

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (108642 => 108643)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-02-23 19:00:11 UTC (rev 108643)
@@ -1389,6 +1389,7 @@
     case QEvent::FocusOut:
     case QEvent::TouchBegin:
     case QEvent::TouchEnd:
+    case QEvent::TouchCancel:
     case QEvent::TouchUpdate:
         if (d->pageView->eventHandler()->handleEvent(ev))
             return true;

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp (108642 => 108643)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp	2012-02-23 19:00:11 UTC (rev 108643)
@@ -143,6 +143,7 @@
         return handleFocusOutEvent(static_cast<QFocusEvent*>(ev));
     case QEvent::TouchBegin:
     case QEvent::TouchEnd:
+    case QEvent::TouchCancel:
     case QEvent::TouchUpdate:
         touchEvent(static_cast<QTouchEvent*>(ev));
         return true;

Modified: trunk/Tools/ChangeLog (108642 => 108643)


--- trunk/Tools/ChangeLog	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Tools/ChangeLog	2012-02-23 19:00:11 UTC (rev 108643)
@@ -1,3 +1,34 @@
+2012-02-23  Simon Hausmann  <[email protected]>
+
+        [Qt] Add support for touch cancellation
+        https://bugs.webkit.org/show_bug.cgi?id=79348
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Added straight-forward touch cancellation event sending to Qt WK1 DRT
+        and WK2 WTR.
+
+        * DumpRenderTree/qt/EventSenderQt.cpp:
+        (EventSender::touchCancel):
+        (EventSender::cancelTouchPoint):
+        * DumpRenderTree/qt/EventSenderQt.h:
+        (EventSender):
+        * WebKitTestRunner/EventSenderProxy.h:
+        (EventSenderProxy):
+        * WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
+        * WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
+        (WTR::EventSendingController::touchCancel):
+        (WTR):
+        (WTR::EventSendingController::cancelTouchPoint):
+        * WebKitTestRunner/InjectedBundle/EventSendingController.h:
+        (EventSendingController):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::didReceiveSynchronousMessageFromInjectedBundle):
+        * WebKitTestRunner/qt/EventSenderProxyQt.cpp:
+        (WTR::EventSenderProxy::touchCancel):
+        (WTR):
+        (WTR::EventSenderProxy::cancelTouchPoint):
+
 2012-02-23  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r108626.

Modified: trunk/Tools/DumpRenderTree/qt/EventSenderQt.cpp (108642 => 108643)


--- trunk/Tools/DumpRenderTree/qt/EventSenderQt.cpp	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Tools/DumpRenderTree/qt/EventSenderQt.cpp	2012-02-23 19:00:11 UTC (rev 108643)
@@ -463,6 +463,14 @@
     m_touchActive = false;
 }
 
+#if QT_VERSION >= 0x050000
+void EventSender::touchCancel()
+{
+    sendTouchEvent(QEvent::TouchCancel);
+    m_touchActive = false;
+}
+#endif
+
 void EventSender::clearTouchPoints()
 {
     m_touchPoints.clear();
@@ -478,6 +486,14 @@
     m_touchPoints[index].setState(Qt::TouchPointReleased);
 }
 
+void EventSender::cancelTouchPoint(int index)
+{
+    // FIXME: No cancellation state in Qt 5, mapped to release instead.
+    // PlatformTouchEvent conversion later will map all touch points to
+    // cancelled.
+    releaseTouchPoint(index);
+}
+
 void EventSender::sendTouchEvent(QEvent::Type type)
 {
 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)

Modified: trunk/Tools/DumpRenderTree/qt/EventSenderQt.h (108642 => 108643)


--- trunk/Tools/DumpRenderTree/qt/EventSenderQt.h	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Tools/DumpRenderTree/qt/EventSenderQt.h	2012-02-23 19:00:11 UTC (rev 108643)
@@ -73,6 +73,9 @@
     void touchStart();
     void touchMove();
     void touchEnd();
+#if QT_VERSION >= 0x050000
+    void touchCancel();
+#endif
     void zoomPageIn();
     void zoomPageOut();
     void textZoomIn();
@@ -80,6 +83,7 @@
     void scalePageBy(float scaleFactor, float x, float y);
     void clearTouchPoints();
     void releaseTouchPoint(int index);
+    void cancelTouchPoint(int index);
 
 protected:
     void timerEvent(QTimerEvent*);

Modified: trunk/Tools/WebKitTestRunner/EventSenderProxy.h (108642 => 108643)


--- trunk/Tools/WebKitTestRunner/EventSenderProxy.h	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Tools/WebKitTestRunner/EventSenderProxy.h	2012-02-23 19:00:11 UTC (rev 108643)
@@ -64,8 +64,10 @@
     void touchStart();
     void touchMove();
     void touchEnd();
+    void touchCancel();
     void clearTouchPoints();
     void releaseTouchPoint(int index);
+    void cancelTouchPoint(int index);
 #endif
 
 private:

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl (108642 => 108643)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl	2012-02-23 19:00:11 UTC (rev 108643)
@@ -50,8 +50,10 @@
         void touchStart();
         void touchMove();
         void touchEnd();
+        void touchCancel();
         void clearTouchPoints();
         void releaseTouchPoint(in long index);
+        void cancelTouchPoint(in long index);
 #endif
     };
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp (108642 => 108643)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp	2012-02-23 19:00:11 UTC (rev 108643)
@@ -434,6 +434,18 @@
     WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
 }
 
+void EventSendingController::touchCancel()
+{
+    WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
+    WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
+
+    WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
+    WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("TouchCancel"));
+    WKDictionaryAddItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
+
+    WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+}
+
 void EventSendingController::clearTouchPoints()
 {
     WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
@@ -461,6 +473,22 @@
 
     WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
 }
+
+void EventSendingController::cancelTouchPoint(int index)
+{
+    WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
+    WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
+
+    WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
+    WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("CancelTouchPoint"));
+    WKDictionaryAddItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
+
+    WKRetainPtr<WKStringRef> indexKey = adoptWK(WKStringCreateWithUTF8CString("Index"));
+    WKRetainPtr<WKUInt64Ref> indexRef = WKUInt64Create(index);
+    WKDictionaryAddItem(EventSenderMessageBody.get(), indexKey.get(), indexRef.get());
+
+    WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+}
 #endif
 
 // Object Creation

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h (108642 => 108643)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h	2012-02-23 19:00:11 UTC (rev 108643)
@@ -70,8 +70,10 @@
     void touchStart();
     void touchMove();
     void touchEnd();
+    void touchCancel();
     void clearTouchPoints();
     void releaseTouchPoint(int index);
+    void cancelTouchPoint(int index);
 #endif
 
 private:

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (108642 => 108643)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2012-02-23 19:00:11 UTC (rev 108643)
@@ -699,6 +699,13 @@
             return 0;
         }
 
+        if (WKStringIsEqualToUTF8CString(subMessageName, "TouchCancel")) {
+            WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), true);
+            m_eventSenderProxy->touchCancel();
+            WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), false);
+            return 0;
+        }
+
         if (WKStringIsEqualToUTF8CString(subMessageName, "ClearTouchPoints")) {
             m_eventSenderProxy->clearTouchPoints();
             return 0;
@@ -710,6 +717,13 @@
             m_eventSenderProxy->releaseTouchPoint(index);
             return 0;
         }
+
+        if (WKStringIsEqualToUTF8CString(subMessageName, "CancelTouchPoint")) {
+            WKRetainPtr<WKStringRef> indexKey = adoptWK(WKStringCreateWithUTF8CString("Index"));
+            int index = static_cast<int>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, indexKey.get()))));
+            m_eventSenderProxy->cancelTouchPoint(index);
+            return 0;
+        }
 #endif
         ASSERT_NOT_REACHED();
     }

Modified: trunk/Tools/WebKitTestRunner/qt/EventSenderProxyQt.cpp (108642 => 108643)


--- trunk/Tools/WebKitTestRunner/qt/EventSenderProxyQt.cpp	2012-02-23 18:58:51 UTC (rev 108642)
+++ trunk/Tools/WebKitTestRunner/qt/EventSenderProxyQt.cpp	2012-02-23 19:00:11 UTC (rev 108643)
@@ -365,6 +365,12 @@
     m_touchActive = false;
 }
 
+void EventSenderProxy::touchCancel()
+{
+    sendTouchEvent(QEvent::TouchCancel);
+    m_touchActive = false;
+}
+
 void EventSenderProxy::clearTouchPoints()
 {
     m_touchPoints.clear();
@@ -380,6 +386,14 @@
     m_touchPoints[index].setState(Qt::TouchPointReleased);
 }
 
+void EventSenderProxy::cancelTouchPoint(int index)
+{
+    // FIXME: No cancellation state in Qt 5, mapped to release instead.
+    // PlatformTouchEvent conversion later will map all touch points to
+    // cancelled.
+    releaseTouchPoint(index);
+}
+
 void EventSenderProxy::sendTouchEvent(QEvent::Type type)
 {
     static QTouchDevice* device = 0;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to