diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-25 15:09:11 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-25 15:09:11 +0200 |
commit | a89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd (patch) | |
tree | b7abd9f49ae1d4d2e426a5883bfccd42b8e2ee12 /Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp | |
parent | 8d473cf9743f1d30a16a27114e93bd5af5648d23 (diff) | |
download | qtwebkit-a89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd.tar.gz |
Imported WebKit commit eb5c1b8fe4d4b1b90b5137433fc58a91da0e6878 (http://svn.webkit.org/repository/webkit/trunk@118516)
Diffstat (limited to 'Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp | 38 |
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); } |