Title: [114917] trunk
Revision
114917
Author
commit-qu...@webkit.org
Date
2012-04-23 10:36:57 -0700 (Mon, 23 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-23
Reviewed by Kenneth Rohde Christiansen.

Source/WebKit2:

Missed WebKit2 conversion in commit r106470.

* Shared/qt/WebEventFactoryQt.cpp:
(WebKit::WebEventFactory::createWebTouchEvent):

Tools:

Add feature to set touch-point radius for emitted touch-events.

* DumpRenderTree/qt/EventSenderQt.cpp:
(EventSender::addTouchPoint):
(EventSender::updateTouchPoint):
(EventSender::setTouchPointRadius):
(EventSender::clearTouchPoints):
* DumpRenderTree/qt/EventSenderQt.h:
(EventSender):

LayoutTests:

Expand the basic touch test, to check touch-point radius, if feature
is available in EventSender.

* fast/events/touch/script-tests/basic-single-touch-events.js:
(verifyTouchPoint):
(verifyTouch):
(singleTouchSequence):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (114916 => 114917)


--- trunk/LayoutTests/ChangeLog	2012-04-23 17:29:24 UTC (rev 114916)
+++ trunk/LayoutTests/ChangeLog	2012-04-23 17:36:57 UTC (rev 114917)
@@ -1,3 +1,18 @@
+2012-04-23  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.
+
+        Expand the basic touch test, to check touch-point radius, if feature
+        is available in EventSender.
+
+        * fast/events/touch/script-tests/basic-single-touch-events.js:
+        (verifyTouchPoint):
+        (verifyTouch):
+        (singleTouchSequence):
+
 2012-04-23  Pierre Rossi  <pierre.ro...@gmail.com>
 
         [Qt] Unreviewed gardening.

Modified: trunk/LayoutTests/fast/events/touch/script-tests/basic-single-touch-events.js (114916 => 114917)


--- trunk/LayoutTests/fast/events/touch/script-tests/basic-single-touch-events.js	2012-04-23 17:29:24 UTC (rev 114916)
+++ trunk/LayoutTests/fast/events/touch/script-tests/basic-single-touch-events.js	2012-04-23 17:36:57 UTC (rev 114917)
@@ -40,13 +40,17 @@
     shouldBe("lastEvent.pageY", "0");
 }
 
-function verifyTouchPoint(list, point, x, y, id)
+function verifyTouchPoint(list, point, x, y, id, rx, ry)
 {
     shouldBe("lastEvent." + list + "[" + point + "].pageX", x.toString());
     shouldBe("lastEvent." + list + "[" + point + "].pageY", y.toString());
     shouldBe("lastEvent." + list + "[" + point + "].clientX", x.toString());
     shouldBe("lastEvent." + list + "[" + point + "].clientY", y.toString());
     shouldBe("lastEvent." + list + "[" + point + "].identifier", id.toString());
+    if (eventSender.setTouchPointRadius) {
+        shouldBe("lastEvent." + list + "[" + point + "].webkitRadiusX", rx.toString());
+        shouldBe("lastEvent." + list + "[" + point + "].webkitRadiusY", ry.toString());
+    }
 }
 
 function verifyTouch(which) {
@@ -55,13 +59,13 @@
            verifyTouchEvent("touchstart", 1, 1, 1);
            shouldBe("lastEvent.shiftKey", "false");
            shouldBeEqualToString("lastEvent.touches[0].target.id", "touchtarget");
-           verifyTouchPoint("touches", 0, 10, 10, 0);
-           verifyTouchPoint("changedTouches", 0, 10, 10, 0);
-           verifyTouchPoint("targetTouches", 0, 10, 10, 0);
+           verifyTouchPoint("touches", 0, 10, 10, 0, 10, 10);
+           verifyTouchPoint("changedTouches", 0, 10, 10, 0, 10, 10);
+           verifyTouchPoint("targetTouches", 0, 10, 10, 0, 10, 10);
         break;
         case 1:
            verifyTouchEvent("touchmove", 1, 1, 1);
-           verifyTouchPoint("touches", 0, 50, 50, 0);
+           verifyTouchPoint("touches", 0, 50, 50, 0, 12, 12);
            shouldBe("lastEvent.shiftKey", "true");
            shouldBe("lastEvent.altKey", "true");
            shouldBe("lastEvent.ctrlKey", "false");
@@ -69,7 +73,7 @@
         break;
         case 2:
             verifyTouchEvent("touchend", 0, 1, 0);
-            verifyTouchPoint("changedTouches", 0, 50, 50, 0);
+            verifyTouchPoint("changedTouches", 0, 50, 50, 0, 12, 12);
             shouldBe("lastEvent.shiftKey", "false");
             shouldBe("lastEvent.altKey", "false");
         break;
@@ -88,9 +92,13 @@
 
 function singleTouchSequence()
 {
+    if (eventSender.setTouchPointRadius)
+        eventSender.setTouchPointRadius(10,10);
     eventSender.addTouchPoint(10, 10);
     eventSender.touchStart();
 
+    if (eventSender.setTouchPointRadius)
+        eventSender.setTouchPointRadius(12,12);
     eventSender.updateTouchPoint(0, 50, 50);
     eventSender.setTouchModifier("shift", true);
     eventSender.setTouchModifier("alt", true);

Added: trunk/LayoutTests/platform/qt/fast/events/touch/basic-single-touch-events-expected.txt (0 => 114917)


--- trunk/LayoutTests/platform/qt/fast/events/touch/basic-single-touch-events-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/qt/fast/events/touch/basic-single-touch-events-expected.txt	2012-04-23 17:36:57 UTC (rev 114917)
@@ -0,0 +1,84 @@
+This tests basic single touch event support.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS lastEvent.type is "touchstart"
+PASS lastEvent.touches.length is 1
+PASS lastEvent.changedTouches.length is 1
+PASS lastEvent.targetTouches.length is 1
+PASS lastEvent.pageX is 0
+PASS lastEvent.pageY is 0
+PASS lastEvent.shiftKey is false
+PASS lastEvent.touches[0].target.id is "touchtarget"
+PASS lastEvent.touches[0].pageX is 10
+PASS lastEvent.touches[0].pageY is 10
+PASS lastEvent.touches[0].clientX is 10
+PASS lastEvent.touches[0].clientY is 10
+PASS lastEvent.touches[0].identifier is 0
+PASS lastEvent.touches[0].webkitRadiusX is 10
+PASS lastEvent.touches[0].webkitRadiusY is 10
+PASS lastEvent.changedTouches[0].pageX is 10
+PASS lastEvent.changedTouches[0].pageY is 10
+PASS lastEvent.changedTouches[0].clientX is 10
+PASS lastEvent.changedTouches[0].clientY is 10
+PASS lastEvent.changedTouches[0].identifier is 0
+PASS lastEvent.changedTouches[0].webkitRadiusX is 10
+PASS lastEvent.changedTouches[0].webkitRadiusY is 10
+PASS lastEvent.targetTouches[0].pageX is 10
+PASS lastEvent.targetTouches[0].pageY is 10
+PASS lastEvent.targetTouches[0].clientX is 10
+PASS lastEvent.targetTouches[0].clientY is 10
+PASS lastEvent.targetTouches[0].identifier is 0
+PASS lastEvent.targetTouches[0].webkitRadiusX is 10
+PASS lastEvent.targetTouches[0].webkitRadiusY is 10
+PASS lastEvent.type is "touchmove"
+PASS lastEvent.touches.length is 1
+PASS lastEvent.changedTouches.length is 1
+PASS lastEvent.targetTouches.length is 1
+PASS lastEvent.pageX is 0
+PASS lastEvent.pageY is 0
+PASS lastEvent.touches[0].pageX is 50
+PASS lastEvent.touches[0].pageY is 50
+PASS lastEvent.touches[0].clientX is 50
+PASS lastEvent.touches[0].clientY is 50
+PASS lastEvent.touches[0].identifier is 0
+PASS lastEvent.touches[0].webkitRadiusX is 12
+PASS lastEvent.touches[0].webkitRadiusY is 12
+PASS lastEvent.shiftKey is true
+PASS lastEvent.altKey is true
+PASS lastEvent.ctrlKey is false
+PASS lastEvent.metaKey is false
+PASS lastEvent.type is "touchend"
+PASS lastEvent.touches.length is 0
+PASS lastEvent.changedTouches.length is 1
+PASS lastEvent.targetTouches.length is 0
+PASS lastEvent.pageX is 0
+PASS lastEvent.pageY is 0
+PASS lastEvent.changedTouches[0].pageX is 50
+PASS lastEvent.changedTouches[0].pageY is 50
+PASS lastEvent.changedTouches[0].clientX is 50
+PASS lastEvent.changedTouches[0].clientY is 50
+PASS lastEvent.changedTouches[0].identifier is 0
+PASS lastEvent.changedTouches[0].webkitRadiusX is 12
+PASS lastEvent.changedTouches[0].webkitRadiusY is 12
+PASS lastEvent.shiftKey is false
+PASS lastEvent.altKey is false
+PASS lastEvent.type is "touchstart"
+PASS lastEvent.touches.length is 1
+PASS lastEvent.changedTouches.length is 1
+PASS lastEvent.targetTouches.length is 1
+PASS lastEvent.pageX is 0
+PASS lastEvent.pageY is 0
+PASS lastEvent.targetTouches[0].target.tagName is "DIV"
+PASS lastEvent.type is "touchmove"
+PASS lastEvent.touches.length is 1
+PASS lastEvent.changedTouches.length is 1
+PASS lastEvent.targetTouches.length is 1
+PASS lastEvent.pageX is 0
+PASS lastEvent.pageY is 0
+PASS lastEvent.touches[0].target.tagName is "DIV"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/Source/WebKit2/ChangeLog (114916 => 114917)


--- trunk/Source/WebKit2/ChangeLog	2012-04-23 17:29:24 UTC (rev 114916)
+++ trunk/Source/WebKit2/ChangeLog	2012-04-23 17:36:57 UTC (rev 114917)
@@ -1,3 +1,15 @@
+2012-04-23  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.
+
+        Missed WebKit2 conversion in commit r106470.
+
+        * Shared/qt/WebEventFactoryQt.cpp:
+        (WebKit::WebEventFactory::createWebTouchEvent):
+
 2012-04-23  Balazs Kelemen  <kbal...@webkit.org>
 
         [Qt] Add desktop zooming support for QQuickWebView

Modified: trunk/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp (114916 => 114917)


--- trunk/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp	2012-04-23 17:29:24 UTC (rev 114916)
+++ trunk/Source/WebKit2/Shared/qt/WebEventFactoryQt.cpp	2012-04-23 17:36:57 UTC (rev 114917)
@@ -209,7 +209,8 @@
         if (type == WebEvent::TouchCancel)
             state = WebPlatformTouchPoint::TouchCancelled;
 
-        m_touchPoints.append(WebPlatformTouchPoint(id, state, touchPoint.screenPos().toPoint(), fromItemTransform.map(touchPoint.pos()).toPoint()));
+        IntSize radius(touchPoint.rect().width()/ 2, touchPoint.rect().height() / 2);
+        m_touchPoints.append(WebPlatformTouchPoint(id, state, touchPoint.screenPos().toPoint(), fromItemTransform.map(touchPoint.pos()).toPoint(), radius, 0.0, touchPoint.pressure()));
     }
 
     return WebTouchEvent(type, m_touchPoints, modifiers, timestamp);

Modified: trunk/Tools/ChangeLog (114916 => 114917)


--- trunk/Tools/ChangeLog	2012-04-23 17:29:24 UTC (rev 114916)
+++ trunk/Tools/ChangeLog	2012-04-23 17:36:57 UTC (rev 114917)
@@ -1,3 +1,20 @@
+2012-04-23  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.
+
+        Add feature to set touch-point radius for emitted touch-events.
+
+        * DumpRenderTree/qt/EventSenderQt.cpp:
+        (EventSender::addTouchPoint):
+        (EventSender::updateTouchPoint):
+        (EventSender::setTouchPointRadius):
+        (EventSender::clearTouchPoints):
+        * DumpRenderTree/qt/EventSenderQt.h:
+        (EventSender):
+
 2012-04-23  Christophe Dumez  <christophe.du...@intel.com>
 
         [EFL] EFL's LayoutTestController does not implement elementDoesAutoCompleteForElementWithId

Modified: trunk/Tools/DumpRenderTree/qt/EventSenderQt.cpp (114916 => 114917)


--- trunk/Tools/DumpRenderTree/qt/EventSenderQt.cpp	2012-04-23 17:29:24 UTC (rev 114916)
+++ trunk/Tools/DumpRenderTree/qt/EventSenderQt.cpp	2012-04-23 17:36:57 UTC (rev 114917)
@@ -411,6 +411,8 @@
     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);
 }
 
@@ -419,9 +421,12 @@
     if (index < 0 || index >= m_touchPoints.count())
         return;
 
-    QTouchEvent::TouchPoint &p = m_touchPoints[index];
-    p.setPos(QPointF(x, y));
-    p.setState(Qt::TouchPointMoved);
+    const QPointF pos(x, y);
+    QTouchEvent::TouchPoint &point = m_touchPoints[index];
+    point.setPos(pos);
+    point.setState(Qt::TouchPointMoved);
+    if (!m_touchPointRadius.isNull())
+        point.setRect(QRectF(pos - m_touchPointRadius, pos + m_touchPointRadius));
 }
 
 void EventSender::setTouchModifier(const QString &modifier, bool enable)
@@ -442,6 +447,11 @@
         m_touchModifiers &= ~mod;
 }
 
+void EventSender::setTouchPointRadius(int radiusX, int radiusY)
+{
+    m_touchPointRadius = QPoint(radiusX, radiusY);
+}
+
 void EventSender::touchStart()
 {
     if (!m_touchActive) {
@@ -480,6 +490,7 @@
     m_touchPoints.clear();
     m_touchModifiers = Qt::KeyboardModifiers();
     m_touchActive = false;
+    m_touchPointRadius = QPoint();
 }
 
 void EventSender::releaseTouchPoint(int index)

Modified: trunk/Tools/DumpRenderTree/qt/EventSenderQt.h (114916 => 114917)


--- trunk/Tools/DumpRenderTree/qt/EventSenderQt.h	2012-04-23 17:29:24 UTC (rev 114916)
+++ trunk/Tools/DumpRenderTree/qt/EventSenderQt.h	2012-04-23 17:36:57 UTC (rev 114917)
@@ -70,6 +70,7 @@
     void addTouchPoint(int x, int y);
     void updateTouchPoint(int index, int x, int y);
     void setTouchModifier(const QString &modifier, bool enable);
+    void setTouchPointRadius(int radiusX, int radiusY);
     void touchStart();
     void touchMove();
     void touchEnd();
@@ -101,6 +102,7 @@
     void replaySavedEvents(bool flush);
     QPoint m_mousePos;
     QPoint m_clickPos;
+    QPoint m_touchPointRadius;
     Qt::MouseButtons m_mouseButtons;
     QWebPage* m_page;
     int m_clickCount;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to