Title: [106470] trunk/Source/WebCore
Revision
106470
Author
[email protected]
Date
2012-02-01 09:38:58 -0800 (Wed, 01 Feb 2012)

Log Message

[Qt] Set all PlatformTouchPoint values possible from a QTouch event.
https://bugs.webkit.org/show_bug.cgi?id=77442

Patch by Allan Sandfeld Jensen <[email protected]> on 2012-02-01
Reviewed by Kenneth Rohde Christiansen.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (106469 => 106470)


--- trunk/Source/WebCore/ChangeLog	2012-02-01 17:22:02 UTC (rev 106469)
+++ trunk/Source/WebCore/ChangeLog	2012-02-01 17:38:58 UTC (rev 106470)
@@ -1,3 +1,13 @@
+2012-02-01  Allan Sandfeld Jensen  <[email protected]>
+
+        [Qt] Set all PlatformTouchPoint values possible from a QTouch event.
+        https://bugs.webkit.org/show_bug.cgi?id=77442
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        * platform/qt/PlatformTouchPointQt.cpp:
+        (WebCore::PlatformTouchPoint::PlatformTouchPoint):
+
 2012-02-01  Peter Rybin  <[email protected]>
 
         Web Inspector: CodeGeneratorInspector.py: move type builder code to dedicated InspectorTypeBuilder .h/.cpp

Modified: trunk/Source/WebCore/platform/qt/PlatformTouchPointQt.cpp (106469 => 106470)


--- trunk/Source/WebCore/platform/qt/PlatformTouchPointQt.cpp	2012-02-01 17:22:02 UTC (rev 106469)
+++ trunk/Source/WebCore/platform/qt/PlatformTouchPointQt.cpp	2012-02-01 17:38:58 UTC (rev 106470)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the WebKit project.
  *
- * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2009,2012 Nokia Corporation and/or its subsidiary(-ies)
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -28,17 +28,29 @@
 namespace WebCore {
 
 PlatformTouchPoint::PlatformTouchPoint(const QTouchEvent::TouchPoint& point)
+    // The QTouchEvent::TouchPoint API states that ids will be >= 0.
+    : m_id(point.id())
+    , m_screenPos(point.screenPos().toPoint())
+    , m_pos(point.pos().toPoint())
 {
-    // The QTouchEvent::TouchPoint API states that ids will be >= 0.
-    m_id = static_cast<unsigned>(point.id());
     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;
     }
-    m_screenPos = point.screenPos().toPoint();
-    m_pos = point.pos().toPoint();
+    // Qt reports touch point size as rectangles, but we will pretend it is an oval.
+    QRect touchRect = point.rect().toAlignedRect();
+    if (touchRect.isValid()) {
+        m_radiusX = point.rect().width() / 2;
+        m_radiusY = point.rect().height() / 2;
+    } else {
+        // http://www.w3.org/TR/2011/WD-touch-events-20110505: 1 if no value is known.
+        m_radiusX = 1;
+        m_radiusY = 1;
+    }
+    m_force = point.pressure();
+    // FIXME: Support m_rotationAngle if QTouchEvent at some point supports it.
 }
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to