[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
hausmann at webkit.org
hausmann at webkit.org
Tue Jan 5 23:47:13 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 27d00b3f8732b95dd614f0c53b4309429dd6ed52
Author: hausmann at webkit.org <hausmann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Dec 11 15:46:54 2009 +0000
Added support for creating synthetic touch events with EventSender
in Qt's DumpRenderTree.
Patch by Simon Hausmann <hausmann at webkit.org>, Kim Grönholm <kim.gronholm at nomovok.com> on 2009-12-11
Reviewed by Antti Koivisto.
https://bugs.webkit.org/show_bug.cgi?id=32114
* DumpRenderTree/qt/EventSenderQt.cpp:
(EventSender::addTouchPoint):
(EventSender::updateTouchPoint):
(EventSender::touchStart):
(EventSender::touchMove):
(EventSender::touchEnd):
(EventSender::clearTouchPoints):
(EventSender::releaseTouchPoint):
(EventSender::sendTouchEvent):
* DumpRenderTree/qt/EventSenderQt.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51987 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index f2d6969..119d265 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,23 @@
+2009-12-11 Simon Hausmann <hausmann at webkit.org>, Kim Grönholm <kim.gronholm at nomovok.com>
+
+ Reviewed by Antti Koivisto.
+
+ Added support for creating synthetic touch events with EventSender
+ in Qt's DumpRenderTree.
+
+ https://bugs.webkit.org/show_bug.cgi?id=32114
+
+ * DumpRenderTree/qt/EventSenderQt.cpp:
+ (EventSender::addTouchPoint):
+ (EventSender::updateTouchPoint):
+ (EventSender::touchStart):
+ (EventSender::touchMove):
+ (EventSender::touchEnd):
+ (EventSender::clearTouchPoints):
+ (EventSender::releaseTouchPoint):
+ (EventSender::sendTouchEvent):
+ * DumpRenderTree/qt/EventSenderQt.h:
+
2009-12-11 Benjamin Poulain <benjamin.poulain at nokia.com>
Reviewed by Darin Adler.
diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp
index a0da273..bc6fc32 100644
--- a/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.cpp
@@ -251,6 +251,75 @@ void EventSender::scheduleAsynchronousClick()
QApplication::postEvent(m_page, event2);
}
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+
+void EventSender::addTouchPoint(int x, int y)
+{
+ int id = m_touchPoints.count();
+ QTouchEvent::TouchPoint point(id);
+ m_touchPoints.append(point);
+ updateTouchPoint(id, x, y);
+ m_touchPoints[id].setState(Qt::TouchPointPressed);
+}
+
+void EventSender::updateTouchPoint(int index, int x, int y)
+{
+ if (index < 0 || index >= m_touchPoints.count())
+ return;
+
+ QTouchEvent::TouchPoint &p = m_touchPoints[index];
+ p.setPos(QPointF(x, y));
+ p.setState(Qt::TouchPointMoved);
+}
+
+void EventSender::touchStart()
+{
+ sendTouchEvent(QEvent::TouchBegin);
+}
+
+void EventSender::touchMove()
+{
+ sendTouchEvent(QEvent::TouchUpdate);
+}
+
+void EventSender::touchEnd()
+{
+ for (int i = 0; i < m_touchPoints.count(); ++i)
+ m_touchPoints[i].setState(Qt::TouchPointReleased);
+ sendTouchEvent(QEvent::TouchEnd);
+}
+
+void EventSender::clearTouchPoints()
+{
+ m_touchPoints.clear();
+}
+
+void EventSender::releaseTouchPoint(int index)
+{
+ if (index < 0 || index >= m_touchPoints.count())
+ return;
+
+ m_touchPoints[index].setState(Qt::TouchPointReleased);
+}
+
+void EventSender::sendTouchEvent(QEvent::Type type)
+{
+ QTouchEvent event(type);
+ event.setTouchPoints(m_touchPoints);
+ QApplication::sendEvent(m_page, &event);
+ QList<QTouchEvent::TouchPoint>::Iterator it = m_touchPoints.begin();
+ while (it != m_touchPoints.end()) {
+ if (it->state() == Qt::TouchPointReleased)
+ it = m_touchPoints.erase(it);
+ else {
+ it->setState(Qt::TouchPointStationary);
+ ++it;
+ }
+ }
+}
+
+#endif
+
QWebFrame* EventSender::frameUnderMouse() const
{
QWebFrame* frame = m_page->mainFrame();
diff --git a/WebKitTools/DumpRenderTree/qt/EventSenderQt.h b/WebKitTools/DumpRenderTree/qt/EventSenderQt.h
index fd74455..31a8c56 100644
--- a/WebKitTools/DumpRenderTree/qt/EventSenderQt.h
+++ b/WebKitTools/DumpRenderTree/qt/EventSenderQt.h
@@ -40,6 +40,10 @@
#include <qwebpage.h>
#include <qwebframe.h>
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+#include <QTouchEvent>
+#endif
+
class EventSender : public QObject {
Q_OBJECT
public:
@@ -54,11 +58,24 @@ public slots:
void clearKillRing() {}
void contextClick();
void scheduleAsynchronousClick();
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ void addTouchPoint(int x, int y);
+ void updateTouchPoint(int index, int x, int y);
+ void touchStart();
+ void touchMove();
+ void touchEnd();
+ void clearTouchPoints();
+ void releaseTouchPoint(int index);
+#endif
private:
+ void sendTouchEvent(QEvent::Type);
QPoint m_mousePos;
QWebPage* m_page;
int m_timeLeap;
QWebFrame* frameUnderMouse() const;
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+ QList<QTouchEvent::TouchPoint> m_touchPoints;
+#endif
};
#endif // EventSenderQt_h
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list