Title: [122438] trunk/Source/WebKit2
Revision
122438
Author
abe...@webkit.org
Date
2012-07-12 03:04:42 -0700 (Thu, 12 Jul 2012)

Log Message

[Qt][WK2] ASSERT: "!m_viewportItem->isMoving()" in QtViewportHandler::flickMoveEnded()
https://bugs.webkit.org/show_bug.cgi?id=90875

Reviewed by Kenneth Rohde Christiansen.

Since MultiPointTouchArea and PinchArea use the childMouseEventFilter
method to filter touch events and because Flickable filters child mouse
events the canvas calls this function before propagating the touch event
to the WebView. Since Flickable does not accept touch events the canvas
tries to propagate a synthesized mouse event through the base class
childMouseEventFilter function which is accepted by Flickable and
interferes with the input events we send to Flicakble hence messes up
the internal state of the WebView.
This patch reimplements the virtual childMouseEventFilter method so that all
the mouse and touch events can be processed by WebKit before they arrive to
Flickable.

* UIProcess/API/qt/qquickwebview.cpp:
(QQuickWebView::childMouseEventFilter):
* UIProcess/API/qt/qquickwebview_p.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (122437 => 122438)


--- trunk/Source/WebKit2/ChangeLog	2012-07-12 10:04:31 UTC (rev 122437)
+++ trunk/Source/WebKit2/ChangeLog	2012-07-12 10:04:42 UTC (rev 122438)
@@ -1,3 +1,26 @@
+2012-07-11  Andras Becsi  <andras.be...@nokia.com>
+
+        [Qt][WK2] ASSERT: "!m_viewportItem->isMoving()" in QtViewportHandler::flickMoveEnded()
+        https://bugs.webkit.org/show_bug.cgi?id=90875
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Since MultiPointTouchArea and PinchArea use the childMouseEventFilter
+        method to filter touch events and because Flickable filters child mouse
+        events the canvas calls this function before propagating the touch event
+        to the WebView. Since Flickable does not accept touch events the canvas
+        tries to propagate a synthesized mouse event through the base class
+        childMouseEventFilter function which is accepted by Flickable and
+        interferes with the input events we send to Flicakble hence messes up
+        the internal state of the WebView.
+        This patch reimplements the virtual childMouseEventFilter method so that all
+        the mouse and touch events can be processed by WebKit before they arrive to
+        Flickable.
+
+        * UIProcess/API/qt/qquickwebview.cpp:
+        (QQuickWebView::childMouseEventFilter):
+        * UIProcess/API/qt/qquickwebview_p.h:
+
 2012-07-12  Carlos Garcia Campos  <cgar...@igalia.com>
 
         Unreviewed. Fix GTK+ debug build after r122425.

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp (122437 => 122438)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-07-12 10:04:31 UTC (rev 122437)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp	2012-07-12 10:04:42 UTC (rev 122438)
@@ -1655,6 +1655,38 @@
     WTF::initializeMainThread();
 }
 
+bool QQuickWebView::childMouseEventFilter(QQuickItem* item, QEvent* event)
+{
+    if (!isVisible() || !isEnabled() || !s_flickableViewportEnabled)
+        return QQuickFlickable::childMouseEventFilter(item, event);
+
+    // This function is used by MultiPointTouchArea and PinchArea to filter
+    // touch events, thus to hinder the canvas from sending synthesized
+    // mouse events to the Flickable implementation we need to reimplement
+    // childMouseEventFilter and filter incoming touch events as well.
+
+    switch (event->type()) {
+    case QEvent::MouseButtonPress:
+        mousePressEvent(static_cast<QMouseEvent*>(event));
+        return event->isAccepted();
+    case QEvent::MouseMove:
+        mouseMoveEvent(static_cast<QMouseEvent*>(event));
+        return event->isAccepted();
+    case QEvent::MouseButtonRelease:
+        mouseReleaseEvent(static_cast<QMouseEvent*>(event));
+        return event->isAccepted();
+    case QEvent::TouchBegin:
+    case QEvent::TouchUpdate:
+    case QEvent::TouchEnd:
+        touchEvent(static_cast<QTouchEvent*>(event));
+        return event->isAccepted();
+    default:
+        break;
+    }
+
+    return QQuickFlickable::childMouseEventFilter(item, event);
+}
+
 void QQuickWebView::geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry)
 {
     Q_D(QQuickWebView);

Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h (122437 => 122438)


--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h	2012-07-12 10:04:31 UTC (rev 122437)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h	2012-07-12 10:04:42 UTC (rev 122438)
@@ -168,6 +168,7 @@
     void navigationRequested(QWebNavigationRequest* request);
 
 protected:
+    virtual bool childMouseEventFilter(QQuickItem*, QEvent*);
     virtual void geometryChanged(const QRectF&, const QRectF&);
     virtual void componentComplete();
     virtual void keyPressEvent(QKeyEvent*);

Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp (122437 => 122438)


--- trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp	2012-07-12 10:04:31 UTC (rev 122437)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebPageEventHandler.cpp	2012-07-12 10:04:42 UTC (rev 122438)
@@ -118,6 +118,7 @@
     static QPointF lastPos = QPointF();
     QTransform fromItemTransform = m_webPage->transformFromItem();
     QPointF webPagePoint = fromItemTransform.map(ev->localPos());
+    ev->accept();
     if (lastPos == webPagePoint)
         return;
     lastPos = webPagePoint;
@@ -139,6 +140,7 @@
         m_previousClickButton = ev->button();
     }
 
+    ev->accept();
     m_webPageProxy->handleMouseEvent(NativeWebMouseEvent(ev, fromItemTransform, m_clickCount));
 
     m_lastClick = webPagePoint;
@@ -147,6 +149,7 @@
 
 void QtWebPageEventHandler::handleMouseReleaseEvent(QMouseEvent* ev)
 {
+    ev->accept();
     QTransform fromItemTransform = m_webPage->transformFromItem();
     m_webPageProxy->handleMouseEvent(NativeWebMouseEvent(ev, fromItemTransform, /*eventClickCount*/ 0));
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to