Title: [99860] trunk/Source/WebKit2
Revision
99860
Author
[email protected]
Date
2011-11-10 08:27:58 -0800 (Thu, 10 Nov 2011)

Log Message

[Qt] Clean up how singe / double taps are handled
https://bugs.webkit.org/show_bug.cgi?id=72024

Reviewed by Simon Hausmann.

Move all decision making to the QtWebPageProxy.

* UIProcess/qt/QtTapGestureRecognizer.cpp:
(WebKit::QtTapGestureRecognizer::QtTapGestureRecognizer):
(WebKit::QtTapGestureRecognizer::recognize):
(WebKit::QtTapGestureRecognizer::tapTimeout):
* UIProcess/qt/QtTapGestureRecognizer.h:
* UIProcess/qt/QtWebPageProxy.cpp:
(QtWebPageProxy::QtWebPageProxy):
(QtWebPageProxy::handleSingleTapEvent):
(QtWebPageProxy::handleDoubleTapEvent):
* UIProcess/qt/QtWebPageProxy.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (99859 => 99860)


--- trunk/Source/WebKit2/ChangeLog	2011-11-10 16:15:56 UTC (rev 99859)
+++ trunk/Source/WebKit2/ChangeLog	2011-11-10 16:27:58 UTC (rev 99860)
@@ -1,3 +1,23 @@
+2011-11-10  Kenneth Rohde Christiansen  <[email protected]>
+
+        [Qt] Clean up how singe / double taps are handled
+        https://bugs.webkit.org/show_bug.cgi?id=72024
+
+        Reviewed by Simon Hausmann.
+
+        Move all decision making to the QtWebPageProxy.
+
+        * UIProcess/qt/QtTapGestureRecognizer.cpp:
+        (WebKit::QtTapGestureRecognizer::QtTapGestureRecognizer):
+        (WebKit::QtTapGestureRecognizer::recognize):
+        (WebKit::QtTapGestureRecognizer::tapTimeout):
+        * UIProcess/qt/QtTapGestureRecognizer.h:
+        * UIProcess/qt/QtWebPageProxy.cpp:
+        (QtWebPageProxy::QtWebPageProxy):
+        (QtWebPageProxy::handleSingleTapEvent):
+        (QtWebPageProxy::handleDoubleTapEvent):
+        * UIProcess/qt/QtWebPageProxy.h:
+
 2011-11-10  Simon Hausmann  <[email protected]>
 
         [Qt] Clean up build system

Modified: trunk/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.cpp (99859 => 99860)


--- trunk/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.cpp	2011-11-10 16:15:56 UTC (rev 99859)
+++ trunk/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.cpp	2011-11-10 16:27:58 UTC (rev 99860)
@@ -23,27 +23,23 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 #include "config.h"
-
 #include "QtTapGestureRecognizer.h"
 
+#include "QtWebPageProxy.h"
 #include "QtViewportInteractionEngine.h"
+#include <QLineF>
 #include <QTouchEvent>
 
 namespace WebKit {
 
-QtTapGestureRecognizer::QtTapGestureRecognizer(QtViewportInteractionEngine* interactionEngine)
+QtTapGestureRecognizer::QtTapGestureRecognizer(QtViewportInteractionEngine* interactionEngine, QtWebPageProxy* page)
     : QtGestureRecognizer(interactionEngine)
-    , m_webPageProxy(0)
+    , m_webPageProxy(page)
     , m_tapState(NoTap)
 {
     reset();
 }
 
-void QtTapGestureRecognizer::setWebPageProxy(WebPageProxy* proxy)
-{
-    m_webPageProxy = proxy;
-}
-
 bool QtTapGestureRecognizer::recognize(const QTouchEvent* event, qint64 eventTimestampMillis)
 {
     if (event->touchPoints().size() != 1) {
@@ -99,7 +95,7 @@
                 QPointF startPosition = touchPoint.startScreenPos();
                 QPointF endPosition = touchPoint.screenPos();
                 if (QLineF(endPosition, startPosition).length() < maxDoubleTapDistance && m_webPageProxy)
-                    m_webPageProxy->findZoomableAreaForPoint(touchPoint.pos().toPoint());
+                    m_webPageProxy->handleDoubleTapEvent(touchPoint);
                 break;
             }
         case SingleTapStarted:
@@ -120,14 +116,10 @@
     return false;
 }
 
-
 void QtTapGestureRecognizer::tapTimeout()
 {
     m_doubleTapTimer.stop();
-    QTouchEvent::TouchPoint tapPoint = m_touchBeginEventForTap->touchPoints().at(0);
-    WebGestureEvent gesture(WebEvent::GestureSingleTap, tapPoint.pos().toPoint(), tapPoint.screenPos().toPoint(), WebEvent::Modifiers(0), 0);
-    if (m_webPageProxy)
-        m_webPageProxy->handleGestureEvent(gesture);
+    m_webPageProxy->handleSingleTapEvent(m_touchBeginEventForTap->touchPoints().at(0));
     m_touchBeginEventForTap.clear();
 }
 

Modified: trunk/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.h (99859 => 99860)


--- trunk/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.h	2011-11-10 16:15:56 UTC (rev 99859)
+++ trunk/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.h	2011-11-10 16:27:58 UTC (rev 99860)
@@ -28,9 +28,10 @@
 
 #include "QtGestureRecognizer.h"
 
-#include "WebPageProxy.h"
 #include <QtCore/QBasicTimer>
+#include <QtCore/QObject>
 #include <QtCore/QtGlobal>
+#include <wtf/OwnPtr.h>
 
 QT_BEGIN_NAMESPACE
 class QTouchEvent;
@@ -42,12 +43,13 @@
 const int tapAndHoldTime = 800;
 const int doubleClickInterval = 400;
 
+class QtWebPageProxy;
+
 namespace WebKit {
 
 class QtTapGestureRecognizer : public QObject, private QtGestureRecognizer {
 public:
-    QtTapGestureRecognizer(QtViewportInteractionEngine*);
-    void setWebPageProxy(WebPageProxy*);
+    QtTapGestureRecognizer(QtViewportInteractionEngine*, QtWebPageProxy*);
     bool recognize(const QTouchEvent*, qint64 eventTimestampMillis);
     void reset();
 
@@ -57,7 +59,7 @@
     void tapAndHoldTimeout();
 
 private:
-    WebPageProxy* m_webPageProxy;
+    QtWebPageProxy* m_webPageProxy;
     QBasicTimer m_doubleTapTimer;
     QBasicTimer m_tapAndHoldTimer;
     OwnPtr<QTouchEvent> m_touchBeginEventForTap;

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp (99859 => 99860)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp	2011-11-10 16:15:56 UTC (rev 99859)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.cpp	2011-11-10 16:27:58 UTC (rev 99860)
@@ -133,7 +133,7 @@
     , m_interactionEngine(viewportInteractionEngine)
     , m_panGestureRecognizer(viewportInteractionEngine)
     , m_pinchGestureRecognizer(viewportInteractionEngine)
-    , m_tapGestureRecognizer(viewportInteractionEngine)
+    , m_tapGestureRecognizer(viewportInteractionEngine, this)
     , m_policyInterface(policyInterface)
     , m_context(contextRef ? toImpl(contextRef) : defaultWKContext())
     , m_undoStack(adoptPtr(new QUndoStack(this)))
@@ -142,7 +142,6 @@
 {
     ASSERT(viewInterface);
     m_webPageProxy = m_context->createWebPage(this, toImpl(pageGroupRef));
-    m_tapGestureRecognizer.setWebPageProxy(m_webPageProxy.get());
     m_history = QWKHistoryPrivate::createHistory(this, m_webPageProxy->backForwardList());
     if (!contextRef)
         s_defaultPageProxyCount++;
@@ -337,6 +336,17 @@
     return accepted;
 }
 
+void QtWebPageProxy::handleSingleTapEvent(const QTouchEvent::TouchPoint& point)
+{
+    WebGestureEvent gesture(WebEvent::GestureSingleTap, point.pos().toPoint(), point.screenPos().toPoint(), WebEvent::Modifiers(0), 0);
+    m_webPageProxy->handleGestureEvent(gesture);
+}
+
+void QtWebPageProxy::handleDoubleTapEvent(const QTouchEvent::TouchPoint& point)
+{
+    m_webPageProxy->findZoomableAreaForPoint(point.pos().toPoint());
+}
+
 void QtWebPageProxy::timerEvent(QTimerEvent* ev)
 {
     int timerId = ev->timerId();

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h (99859 => 99860)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h	2011-11-10 16:15:56 UTC (rev 99859)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageProxy.h	2011-11-10 16:27:58 UTC (rev 99860)
@@ -38,6 +38,7 @@
 #include <QBasicTimer>
 #include <QGraphicsView>
 #include <QKeyEvent>
+#include <QTouchEvent>
 #include <QMenu>
 #include <QSharedPointer>
 
@@ -195,6 +196,9 @@
     void handleDownloadRequest(DownloadProxy*);
     void init();
 
+    void handleSingleTapEvent(const QTouchEvent::TouchPoint&);
+    void handleDoubleTapEvent(const QTouchEvent::TouchPoint&);
+
 public Q_SLOTS:
     void navigationStateChanged();
     void didReceiveDownloadResponse(QWebDownloadItem*);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to