[Qt][WK2] Convert touch-point area
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Apr 2012 16:28:20 +0000 (16:28 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Apr 2012 16:28:20 +0000 (16:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=84434

Patch by Allan Sandfeld Jensen <allan.jensen@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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@115071 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/WebKitTestRunner/EventSenderProxy.h
Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl
Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp
Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/qt/EventSenderProxyQt.cpp

index a7f65c787d0ff72bafc389dfe9549d26ceb657b6..0eb74c9572fcc6a079ff882925d06065b7eae40b 100644 (file)
@@ -1,3 +1,28 @@
+2012-04-24  Allan Sandfeld Jensen  <allan.jensen@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  <mnaganov@chromium.org>
 
         [Chromium] Unreviewed test expectations update.
index e3a6b3c89385376dbfd3233ecaa60c4607613aa2..8168513190f694af45ae0f7b46cd49f07f7f2935 100644 (file)
@@ -61,6 +61,7 @@ public:
     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 @@ private:
 #if ENABLE(TOUCH_EVENTS)
     QList<QTouchEvent::TouchPoint> m_touchPoints;
     Qt::KeyboardModifiers m_touchModifiers;
+    QPoint m_touchPointRadius;
     bool m_touchActive;
 #endif
 #endif
index d1dc605f8de0345206939adfd00bb99336356282..934be6d575f7b222038b33763f0bc0bc1cbd56ab 100644 (file)
@@ -47,6 +47,7 @@ module WTR {
         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();
index e4cb069511b0962fad9c641a054d6696490a9d46..93431e3f140ec0932ad8ab35db8aadb168cdcae1 100644 (file)
@@ -398,6 +398,27 @@ void EventSendingController::setTouchModifier(const JSStringRef &modifier, bool
     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"));
index 02673024e448c0099764e03d24476e953b3c563c..8ea2db009a619916fef486d2a94cd7bf3370a8d1 100644 (file)
@@ -67,6 +67,7 @@ public:
     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();
index e324f57df33a6efeb8dc63945f262b909d43ab77..b3b9396f813834e89ff1a1837db530a4bb617148 100644 (file)
@@ -707,6 +707,17 @@ WKRetainPtr<WKTypeRef> TestController::didReceiveSynchronousMessageFromInjectedB
             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();
index c91b7af9af0f8e38f29cf17bd3f4c17b081100ba..edb635979d5eb7dc296a49d8b0592e8865e2f7af 100644 (file)
@@ -318,15 +318,20 @@ void EventSenderProxy::addTouchPoint(int x, int y)
     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 @@ void EventSenderProxy::setTouchModifier(WKEventModifiers modifier, bool enable)
         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 @@ void EventSenderProxy::clearTouchPoints()
     m_touchPoints.clear();
     m_touchModifiers = Qt::KeyboardModifiers();
     m_touchActive = false;
+    m_touchPointRadius = QPoint();
 }
 
 void EventSenderProxy::releaseTouchPoint(int index)