Title: [115071] trunk/Tools
Revision
115071
Author
commit-qu...@webkit.org
Date
2012-04-24 09:28:20 -0700 (Tue, 24 Apr 2012)

Log Message

[Qt][WK2] Convert touch-point area
https://bugs.webkit.org/show_bug.cgi?id=84434

Patch by Allan Sandfeld Jensen <allan.jen...@nokia.com> on 2012-04-24
Reviewed by Kenneth Rohde Christiansen.

Fix failing test after r114917 by also adding the new EventSender API
to WebKitTestRunner.

* WebKitTestRunner/EventSenderProxy.h:
(EventSenderProxy):
* WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
* WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
(WTR::EventSendingController::setTouchPointRadius):
* WebKitTestRunner/InjectedBundle/EventSendingController.h:
(EventSendingController):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::didReceiveSynchronousMessageFromInjectedBundle):
* WebKitTestRunner/qt/EventSenderProxyQt.cpp:
(WTR::EventSenderProxy::addTouchPoint):
(WTR::EventSenderProxy::updateTouchPoint):
(WTR::EventSenderProxy::setTouchPointRadius):
(WTR::EventSenderProxy::clearTouchPoints):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (115070 => 115071)


--- trunk/Tools/ChangeLog	2012-04-24 16:21:24 UTC (rev 115070)
+++ trunk/Tools/ChangeLog	2012-04-24 16:28:20 UTC (rev 115071)
@@ -1,3 +1,28 @@
+2012-04-24  Allan Sandfeld Jensen  <allan.jen...@nokia.com>
+
+        [Qt][WK2] Convert touch-point area
+        https://bugs.webkit.org/show_bug.cgi?id=84434
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Fix failing test after r114917 by also adding the new EventSender API
+        to WebKitTestRunner.
+
+        * WebKitTestRunner/EventSenderProxy.h:
+        (EventSenderProxy):
+        * WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl:
+        * WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
+        (WTR::EventSendingController::setTouchPointRadius):
+        * WebKitTestRunner/InjectedBundle/EventSendingController.h:
+        (EventSendingController):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::didReceiveSynchronousMessageFromInjectedBundle):
+        * WebKitTestRunner/qt/EventSenderProxyQt.cpp:
+        (WTR::EventSenderProxy::addTouchPoint):
+        (WTR::EventSenderProxy::updateTouchPoint):
+        (WTR::EventSenderProxy::setTouchPointRadius):
+        (WTR::EventSenderProxy::clearTouchPoints):
+
 2012-04-24  Mikhail Naganov  <mnaga...@chromium.org>
 
         [Chromium] Unreviewed test expectations update.

Modified: trunk/Tools/WebKitTestRunner/EventSenderProxy.h (115070 => 115071)


--- trunk/Tools/WebKitTestRunner/EventSenderProxy.h	2012-04-24 16:21:24 UTC (rev 115070)
+++ trunk/Tools/WebKitTestRunner/EventSenderProxy.h	2012-04-24 16:28:20 UTC (rev 115071)
@@ -61,6 +61,7 @@
     void addTouchPoint(int x, int y);
     void updateTouchPoint(int index, int x, int y);
     void setTouchModifier(WKEventModifiers, bool enable);
+    void setTouchPointRadius(int radiusX, int radiusY);
     void touchStart();
     void touchMove();
     void touchEnd();
@@ -108,6 +109,7 @@
 #if ENABLE(TOUCH_EVENTS)
     QList<QTouchEvent::TouchPoint> m_touchPoints;
     Qt::KeyboardModifiers m_touchModifiers;
+    QPoint m_touchPointRadius;
     bool m_touchActive;
 #endif
 #endif

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl (115070 => 115071)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl	2012-04-24 16:21:24 UTC (rev 115070)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl	2012-04-24 16:28:20 UTC (rev 115071)
@@ -47,6 +47,7 @@
         void addTouchPoint(in long x, in long y);
         void updateTouchPoint(in long index, in long x, in long y);
         void setTouchModifier(in DOMString modifier, in boolean enable);
+        void setTouchPointRadius(in long radiusX, in long radiusY);
         void touchStart();
         void touchMove();
         void touchEnd();

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp (115070 => 115071)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp	2012-04-24 16:21:24 UTC (rev 115070)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp	2012-04-24 16:28:20 UTC (rev 115071)
@@ -398,6 +398,27 @@
     WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
 }
 
+
+void EventSendingController::setTouchPointRadius(int radiusX, int radiusY)
+{
+    WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
+    WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, WKMutableDictionaryCreate());
+
+    WKRetainPtr<WKStringRef> subMessageKey(AdoptWK, WKStringCreateWithUTF8CString("SubMessage"));
+    WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("SetTouchPointRadius"));
+    WKDictionaryAddItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
+
+    WKRetainPtr<WKStringRef> xKey(AdoptWK, WKStringCreateWithUTF8CString("RadiusX"));
+    WKRetainPtr<WKUInt64Ref> xRef(AdoptWK, WKUInt64Create(radiusX));
+    WKDictionaryAddItem(EventSenderMessageBody.get(), xKey.get(), xRef.get());
+
+    WKRetainPtr<WKStringRef> yKey(AdoptWK, WKStringCreateWithUTF8CString("RadiusY"));
+    WKRetainPtr<WKUInt64Ref> yRef(AdoptWK, WKUInt64Create(radiusY));
+    WKDictionaryAddItem(EventSenderMessageBody.get(), yKey.get(), yRef.get());
+
+    WKBundlePostSynchronousMessage(InjectedBundle::shared().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+}
+
 void EventSendingController::touchStart()
 {
     WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h (115070 => 115071)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h	2012-04-24 16:21:24 UTC (rev 115070)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h	2012-04-24 16:28:20 UTC (rev 115071)
@@ -67,6 +67,7 @@
     void addTouchPoint(int x, int y);
     void updateTouchPoint(int index, int x, int y);
     void setTouchModifier(const JSStringRef &modifier, bool enable);
+    void setTouchPointRadius(int radiusX, int radiusY);
     void touchStart();
     void touchMove();
     void touchEnd();

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (115070 => 115071)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2012-04-24 16:21:24 UTC (rev 115070)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2012-04-24 16:28:20 UTC (rev 115071)
@@ -707,6 +707,17 @@
             return 0;
         }
 
+        if (WKStringIsEqualToUTF8CString(subMessageName, "SetTouchPointRadius")) {
+            WKRetainPtr<WKStringRef> xKey = adoptWK(WKStringCreateWithUTF8CString("RadiusX"));
+            int x = static_cast<int>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, xKey.get()))));
+
+            WKRetainPtr<WKStringRef> yKey = adoptWK(WKStringCreateWithUTF8CString("RadiusY"));
+            int y = static_cast<int>(WKUInt64GetValue(static_cast<WKUInt64Ref>(WKDictionaryGetItemForKey(messageBodyDictionary, yKey.get()))));
+
+            m_eventSenderProxy->setTouchPointRadius(x, y);
+            return 0;
+        }
+
         if (WKStringIsEqualToUTF8CString(subMessageName, "TouchStart")) {
             WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), true);
             m_eventSenderProxy->touchStart();

Modified: trunk/Tools/WebKitTestRunner/qt/EventSenderProxyQt.cpp (115070 => 115071)


--- trunk/Tools/WebKitTestRunner/qt/EventSenderProxyQt.cpp	2012-04-24 16:21:24 UTC (rev 115070)
+++ trunk/Tools/WebKitTestRunner/qt/EventSenderProxyQt.cpp	2012-04-24 16:28:20 UTC (rev 115071)
@@ -318,15 +318,20 @@
     point.setPos(pos);
     point.setStartPos(pos);
     point.setState(Qt::TouchPointPressed);
+    if (!m_touchPointRadius.isNull())
+        point.setRect(QRectF(pos - m_touchPointRadius, pos + m_touchPointRadius));
     m_touchPoints.append(point);
 }
 
 void EventSenderProxy::updateTouchPoint(int index, int x, int y)
 {
     ASSERT(index >= 0 && index < m_touchPoints.count());
+    QPointF pos(x, y);
     QTouchEvent::TouchPoint &p = m_touchPoints[index];
-    p.setPos(QPointF(x, y));
+    p.setPos(pos);
     p.setState(Qt::TouchPointMoved);
+    if (!m_touchPointRadius.isNull())
+        p.setRect(QRectF(pos - m_touchPointRadius, pos + m_touchPointRadius));
 }
 
 void EventSenderProxy::setTouchModifier(WKEventModifiers modifier, bool enable)
@@ -339,6 +344,11 @@
         m_touchModifiers &= ~mod;
 }
 
+void EventSenderProxy::setTouchPointRadius(int radiusX, int radiusY)
+{
+    m_touchPointRadius = QPoint(radiusX, radiusY);
+}
+
 void EventSenderProxy::touchStart()
 {
     if (!m_touchActive) {
@@ -376,6 +386,7 @@
     m_touchPoints.clear();
     m_touchModifiers = Qt::KeyboardModifiers();
     m_touchActive = false;
+    m_touchPointRadius = QPoint();
 }
 
 void EventSenderProxy::releaseTouchPoint(int index)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to