summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp')
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp38
1 files changed, 29 insertions, 9 deletions
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp b/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp
index 8311528b5..529df01eb 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp
@@ -38,7 +38,20 @@ QWebKitTest::~QWebKitTest()
{
}
-bool QWebKitTest::touchDoubleTap(QObject* item, qreal x, qreal y, int delay)
+static QTouchEvent::TouchPoint touchPoint(qreal x, qreal y)
+{
+ QPointF localPos(x, y);
+
+ QTouchEvent::TouchPoint point;
+ point.setLastPos(localPos);
+ QRectF touchRect(0, 0, 40, 40);
+ touchRect.moveCenter(localPos);
+ point.setRect(touchRect);
+
+ return point;
+}
+
+bool QWebKitTest::touchTap(QObject* item, qreal x, qreal y, int delay)
{
if (!qobject_cast<QQuickWebView*>(item)) {
// FIXME: We only support the actual web view for now.
@@ -48,16 +61,23 @@ bool QWebKitTest::touchDoubleTap(QObject* item, qreal x, qreal y, int delay)
// FIXME: implement delay using QTest::qWait() or similar.
Q_UNUSED(delay);
+ m_webViewPrivate->pageView->eventHandler()->handleSingleTapEvent(touchPoint(x, y));
- QPointF localPos(x, y);
+ return true;
+}
- QTouchEvent::TouchPoint point;
- point.setLastPos(localPos);
- QRectF touchRect(0, 0, 40, 40);
- touchRect.moveCenter(localPos);
- point.setRect(touchRect);
+bool QWebKitTest::touchDoubleTap(QObject* item, qreal x, qreal y, int delay)
+{
+ if (!qobject_cast<QQuickWebView*>(item)) {
+ // FIXME: We only support the actual web view for now.
+ qWarning("Touch event \"DoubleTap\" not accepted by receiving item");
+ return false;
+ }
+
+ // FIXME: implement delay using QTest::qWait() or similar.
+ Q_UNUSED(delay);
- m_webViewPrivate->pageView->eventHandler()->handleDoubleTapEvent(point);
+ m_webViewPrivate->pageView->eventHandler()->handleDoubleTapEvent(touchPoint(x, y));
return true;
}
@@ -108,5 +128,5 @@ QVariant QWebKitTest::isScalable() const
QVariant QWebKitTest::layoutSize() const
{
- return QSizeF(m_webViewPrivate->attributes.layoutSize.width(), m_webViewPrivate->attributes.layoutSize.height());
+ return QSizeF(m_webViewPrivate->attributes.layoutSize);
}