diff options
| author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-22 15:40:17 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-22 15:40:17 +0200 |
| commit | 43a42f108af6bcbd91f2672731c3047c26213af1 (patch) | |
| tree | 7fa092e5f5d873c72f2486a70e26be26f7a38bec /Source/WebKit/qt/Api/qwebpage.cpp | |
| parent | d9cf437c840c6eb7417bdd97e6c40979255d3158 (diff) | |
| download | qtwebkit-43a42f108af6bcbd91f2672731c3047c26213af1.tar.gz | |
Imported WebKit commit 302e7806bff028bd1167a1ec7c86a1ee00ecfb49 (http://svn.webkit.org/repository/webkit/trunk@132067)
New snapshot that fixes build without QtWidgets
Diffstat (limited to 'Source/WebKit/qt/Api/qwebpage.cpp')
| -rw-r--r-- | Source/WebKit/qt/Api/qwebpage.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp index 9019f4688..a9eb9a099 100644 --- a/Source/WebKit/qt/Api/qwebpage.cpp +++ b/Source/WebKit/qt/Api/qwebpage.cpp @@ -94,6 +94,7 @@ #include "PageClientQt.h" #include "PageGroup.h" #include "Pasteboard.h" +#include "PlatformGestureEvent.h" #include "PlatformKeyboardEvent.h" #include "PlatformTouchEvent.h" #include "PlatformWheelEvent.h" @@ -131,6 +132,7 @@ #include <QDragMoveEvent> #include <QDropEvent> #include <QFileDialog> +#include <QGestureEvent> #include <QInputDialog> #include <QLabel> #include <QMenu> @@ -1333,6 +1335,37 @@ bool QWebPagePrivate::touchEvent(QTouchEvent* event) #endif } +bool QWebPagePrivate::gestureEvent(QGestureEvent* event) +{ +#if ENABLE(GESTURE_EVENTS) + WebCore::Frame* frame = QWebFramePrivate::core(mainFrame.data()); + if (!frame->view()) + return false; + + // QGestureEvents can contain updates for multiple gestures. + bool handled = false; + QGesture* gesture = event->gesture(Qt::TapGesture); + // Beware that gestures send by DumpRenderTree will have state Qt::NoGesture, + // due to not originating from a GestureRecognizer. + if (gesture && (gesture->state() == Qt::GestureStarted || gesture->state() == Qt::NoGesture)) { + frame->eventHandler()->handleGestureEvent(convertGesture(event, gesture)); + event->setAccepted(true); + handled = true; + } + gesture = event->gesture(Qt::TapAndHoldGesture); + if (gesture && (gesture->state() == Qt::GestureStarted || gesture->state() == Qt::NoGesture)) { + frame->eventHandler()->sendContextMenuEventForGesture(convertGesture(event, gesture)); + event->setAccepted(true); + handled = true; + } + + return handled; +#else + event->ignore(); + return false; +#endif +} + /*! This method is used by the input method to query a set of properties of the page to be able to support complex input method operations as support for surrounding @@ -3143,6 +3176,11 @@ bool QWebPage::event(QEvent *ev) case QEvent::TouchCancel: // Return whether the default action was cancelled in the JS event handler return d->touchEvent(static_cast<QTouchEvent*>(ev)); +#ifndef QT_NO_GESTURES + case QEvent::Gesture: + d->gestureEvent(static_cast<QGestureEvent*>(ev)); + break; +#endif #ifndef QT_NO_PROPERTIES case QEvent::DynamicPropertyChange: d->dynamicPropertyChangeEvent(static_cast<QDynamicPropertyChangeEvent*>(ev)); |
