[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

commit-queue at webkit.org commit-queue at webkit.org
Wed Dec 22 12:24:56 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit d85122dd0a82fa773555d16f610d0216de480239
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Aug 22 22:42:41 2010 +0000

    2010-08-22  Juha Savolainen  <juha.savolainen at weego.fi>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            [Qt] Add QTouchEvents support for WebKit2
            https://bugs.webkit.org/show_bug.cgi?id=44330
    
            This patch adds support for QTouchEvents in WebKit2. A new WebEvent-class
            is created for touchevents, WebTouchEvent. Also touchpoints needed a new
            class, WebPlatformTouchPoint. This is similar solution like in other
            events(like MouseEvent) on WebKit2. These classes are introduced in WebEvent.h
            Also there was a need to create an empty constructor to PlatformTouchPoint-class.
    
            * platform/PlatformTouchPoint.h:
            (WebCore::PlatformTouchPoint::PlatformTouchPoint):
    2010-08-22  Juha Savolainen  <juha.savolainen at weego.fi>
    
            Reviewed by Kenneth Rohde Christiansen.
    
            [Qt] Add QTouchEvents support for WebKit2
            https://bugs.webkit.org/show_bug.cgi?id=44330
    
            This patch adds support for QTouchEvents in WebKit2. A new WebEvent-class
            is created for touchevents, WebTouchEvent. Also touchpoints needed a new
            class, WebPlatformTouchPoint. This is similar solution like in other
            events(like MouseEvent) on WebKit2. These classes are introduced in WebEvent.h
            Also there was a need to create an empty constructor to PlatformTouchPoint-class.
    
            * DerivedSources.pro:
            * Shared/CoreIPCSupport/WebPageMessageKinds.h:
            (WebPageMessage::):
            * Shared/WebEvent.h:
            (WebKit::WebEvent::):
            (WebKit::WebTouchPoint::):
            (WebKit::WebTouchPoint::WebTouchPoint):
            (WebKit::WebTouchPoint::id):
            (WebKit::WebTouchPoint::state):
            (WebKit::WebTouchPoint::screenPosX):
            (WebKit::WebTouchPoint::screenPosY):
            (WebKit::WebTouchPoint::posX):
            (WebKit::WebTouchPoint::posY):
            (WebKit::WebTouchPoint::setState):
            (WebKit::WebTouchPoint::encode):
            (WebKit::WebTouchPoint::decode):
            (WebKit::WebTouchEvent::WebTouchEvent):
            (WebKit::WebTouchEvent::type):
            (WebKit::WebTouchEvent::touchPoints):
            (WebKit::WebTouchEvent::encode):
            (WebKit::WebTouchEvent::decode):
            (WebKit::WebTouchEvent::isTouchEventType):
            * Shared/WebEventConversion.cpp:
            (WebKit::WebKit2PlatformTouchPoint::WebKit2PlatformTouchPoint):
            (WebKit::WebKit2PlatformTouchEvent::WebKit2PlatformTouchEvent):
            (WebKit::platform):
            * Shared/WebEventConversion.h:
            * Shared/qt/WebEventFactoryQt.cpp:
            (WebKit::webEventTypeForEvent):
            (WebKit::WebEventFactory::createWebTouchEvent):
            * Shared/qt/WebEventFactoryQt.h:
            * UIProcess/API/qt/qgraphicswkview.cpp:
            (QGraphicsWKView::event):
            (QGraphicsWKView::touchEvent):
            * UIProcess/API/qt/qgraphicswkview.h:
            * UIProcess/API/qt/qwkpage.cpp:
            (QWKPagePrivate::touchEvent):
            * UIProcess/API/qt/qwkpage_p.h:
            * UIProcess/WebPageProxy.cpp:
            (WebKit::WebPageProxy::touchEvent):
            * UIProcess/WebPageProxy.h:
            * WebProcess/WebPage/WebPage.cpp:
            (WebKit::WebPage::touchEvent):
            (WebKit::WebPage::didReceiveMessage):
            * WebProcess/WebPage/WebPage.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65788 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index baf3c4b..3b394ae 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2010-08-22  Juha Savolainen  <juha.savolainen at weego.fi>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Add QTouchEvents support for WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=44330
+
+        This patch adds support for QTouchEvents in WebKit2. A new WebEvent-class
+        is created for touchevents, WebTouchEvent. Also touchpoints needed a new
+        class, WebPlatformTouchPoint. This is similar solution like in other
+        events(like MouseEvent) on WebKit2. These classes are introduced in WebEvent.h 
+        Also there was a need to create an empty constructor to PlatformTouchPoint-class.
+
+        * platform/PlatformTouchPoint.h:
+        (WebCore::PlatformTouchPoint::PlatformTouchPoint):
+
 2010-08-22  Daniel Bates  <dbates at rim.com>
 
         Reviewed by Eric Seidel.
diff --git a/WebCore/platform/PlatformTouchPoint.h b/WebCore/platform/PlatformTouchPoint.h
index 4a667a0..3a25736 100644
--- a/WebCore/platform/PlatformTouchPoint.h
+++ b/WebCore/platform/PlatformTouchPoint.h
@@ -45,6 +45,7 @@ public:
 
 #if PLATFORM(QT)
     PlatformTouchPoint(const QTouchEvent::TouchPoint&);
+    PlatformTouchPoint() {};
 #elif PLATFORM(ANDROID)
     PlatformTouchPoint(const IntPoint& windowPos, State);
 #endif
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 73fa533..64bc969 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,62 @@
+2010-08-22  Juha Savolainen  <juha.savolainen at weego.fi>
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        [Qt] Add QTouchEvents support for WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=44330
+
+        This patch adds support for QTouchEvents in WebKit2. A new WebEvent-class
+        is created for touchevents, WebTouchEvent. Also touchpoints needed a new
+        class, WebPlatformTouchPoint. This is similar solution like in other
+        events(like MouseEvent) on WebKit2. These classes are introduced in WebEvent.h 
+        Also there was a need to create an empty constructor to PlatformTouchPoint-class.
+
+        * DerivedSources.pro:
+        * Shared/CoreIPCSupport/WebPageMessageKinds.h:
+        (WebPageMessage::):
+        * Shared/WebEvent.h:
+        (WebKit::WebEvent::):
+        (WebKit::WebTouchPoint::):
+        (WebKit::WebTouchPoint::WebTouchPoint):
+        (WebKit::WebTouchPoint::id):
+        (WebKit::WebTouchPoint::state):
+        (WebKit::WebTouchPoint::screenPosX):
+        (WebKit::WebTouchPoint::screenPosY):
+        (WebKit::WebTouchPoint::posX):
+        (WebKit::WebTouchPoint::posY):
+        (WebKit::WebTouchPoint::setState):
+        (WebKit::WebTouchPoint::encode):
+        (WebKit::WebTouchPoint::decode):
+        (WebKit::WebTouchEvent::WebTouchEvent):
+        (WebKit::WebTouchEvent::type):
+        (WebKit::WebTouchEvent::touchPoints):
+        (WebKit::WebTouchEvent::encode):
+        (WebKit::WebTouchEvent::decode):
+        (WebKit::WebTouchEvent::isTouchEventType):
+        * Shared/WebEventConversion.cpp:
+        (WebKit::WebKit2PlatformTouchPoint::WebKit2PlatformTouchPoint):
+        (WebKit::WebKit2PlatformTouchEvent::WebKit2PlatformTouchEvent):
+        (WebKit::platform):
+        * Shared/WebEventConversion.h:
+        * Shared/qt/WebEventFactoryQt.cpp:
+        (WebKit::webEventTypeForEvent):
+        (WebKit::WebEventFactory::createWebTouchEvent):
+        * Shared/qt/WebEventFactoryQt.h:
+        * UIProcess/API/qt/qgraphicswkview.cpp:
+        (QGraphicsWKView::event):
+        (QGraphicsWKView::touchEvent):
+        * UIProcess/API/qt/qgraphicswkview.h:
+        * UIProcess/API/qt/qwkpage.cpp:
+        (QWKPagePrivate::touchEvent):
+        * UIProcess/API/qt/qwkpage_p.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::touchEvent):
+        * UIProcess/WebPageProxy.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::touchEvent):
+        (WebKit::WebPage::didReceiveMessage):
+        * WebProcess/WebPage/WebPage.h:
+
 2010-08-21  Sam Weinig  <sam at webkit.org>
 
         Reviewed by Dan Bernstein.
diff --git a/WebKit2/DerivedSources.pro b/WebKit2/DerivedSources.pro
index 7b39acb..8e36ae5 100644
--- a/WebKit2/DerivedSources.pro
+++ b/WebKit2/DerivedSources.pro
@@ -80,6 +80,8 @@ WEBCORE_HEADERS_FOR_WEBKIT2 += \
     platform/PlatformKeyboardEvent.h \
     platform/PlatformMouseEvent.h \
     platform/PlatformStrategies.h \
+    platform/PlatformTouchPoint.h \
+    platform/PlatformTouchEvent.h \
     platform/PlatformWheelEvent.h \
     platform/PopupMenu.h \
     platform/PopupMenuClient.h \
diff --git a/WebKit2/Shared/CoreIPCSupport/WebPageMessageKinds.h b/WebKit2/Shared/CoreIPCSupport/WebPageMessageKinds.h
index 439273c..810c442 100644
--- a/WebKit2/Shared/CoreIPCSupport/WebPageMessageKinds.h
+++ b/WebKit2/Shared/CoreIPCSupport/WebPageMessageKinds.h
@@ -52,6 +52,9 @@ enum Kind {
     StopLoading,
     TryClose,
     WheelEvent
+#if ENABLE(TOUCH_EVENTS)
+    , TouchEvent
+#endif
 };
 
 }
diff --git a/WebKit2/Shared/WebEvent.h b/WebKit2/Shared/WebEvent.h
index cff7c27..57ef916 100644
--- a/WebKit2/Shared/WebEvent.h
+++ b/WebKit2/Shared/WebEvent.h
@@ -52,6 +52,13 @@ public:
         KeyUp,
         RawKeyDown,
         Char
+#if ENABLE(TOUCH_EVENTS)
+        ,
+        TouchStart,
+        TouchMove,
+        TouchEnd,
+        TouchCancel
+#endif
     };
 
     enum Modifiers {
@@ -327,6 +334,114 @@ private:
     bool m_isSystemKey;
 };
 
+#if ENABLE(TOUCH_EVENTS)
+
+class WebPlatformTouchPoint {
+public:
+    enum TouchPointState {
+        TouchReleased,
+        TouchPressed,
+        TouchMoved,
+        TouchStationary,
+        TouchCancelled
+    };
+
+    WebPlatformTouchPoint()
+    {
+    }
+
+    WebPlatformTouchPoint(unsigned id, TouchPointState state, int screenPosX, int screenPosY, int posX, int posY)
+        : m_id(id)
+        , m_state(state)
+        , m_screenPosX(screenPosX)
+        , m_screenPosY(screenPosY)
+        , m_posX(posX)
+        , m_posY(posY)
+    {
+    }
+
+    unsigned id() const { return m_id; }
+    TouchPointState state() const { return m_state; }
+
+    int screenPosX() const { return m_screenPosX; }
+    int screenPosY() const { return m_screenPosY; }
+    int32_t posX() const { return m_posX; }
+    int32_t posY() const { return m_posY; }
+          
+    void setState(TouchPointState state) { m_state = state; }
+
+    void encode(CoreIPC::ArgumentEncoder* encoder) const
+    {
+        encoder->encodeBytes(reinterpret_cast<const uint8_t*>(this), sizeof(*this));
+    }
+
+    static bool decode(CoreIPC::ArgumentDecoder* decoder, WebPlatformTouchPoint& t)
+    {
+        return decoder->decodeBytes(reinterpret_cast<uint8_t*>(&t), sizeof(t));
+    }
+
+private:
+    unsigned m_id;
+    TouchPointState m_state;
+    int m_screenPosX, m_screenPosY;
+    int32_t m_posX, m_posY;
+
+};
+
+class WebTouchEvent : public WebEvent {
+public:
+
+    WebTouchEvent()
+    {
+    }
+ 
+    WebTouchEvent(WebEvent::Type type, Vector<WebPlatformTouchPoint> touchPoints, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, Modifiers modifiers, double timestamp)
+        : WebEvent(type, modifiers, timestamp)
+        , m_type(type)
+        , m_touchPoints(touchPoints)
+        , m_ctrlKey(ctrlKey)
+        , m_altKey(altKey)
+        , m_shiftKey(shiftKey)
+        , m_metaKey(metaKey)
+    {
+        ASSERT(isTouchEventType(type));
+    }
+
+    const Vector<WebPlatformTouchPoint> touchPoints() const { return m_touchPoints; }
+
+    void encode(CoreIPC::ArgumentEncoder* encoder) const
+    {
+        WebEvent::encode(encoder);
+        encoder->encode(m_touchPoints);
+    }
+
+    static bool decode(CoreIPC::ArgumentDecoder* decoder, WebTouchEvent& t)
+    {
+        if (!WebEvent::decode(decoder, t))
+            return false;
+
+        if (!decoder->decode(t.m_touchPoints))
+             return false;
+
+        return true;
+    }
+  
+private:
+    static bool isTouchEventType(Type type)
+    {
+        return type == TouchStart || type == TouchMove || type == TouchEnd;
+    }
+
+    Type m_type;
+    Vector<WebPlatformTouchPoint> m_touchPoints;
+    bool m_ctrlKey;
+    bool m_altKey;
+    bool m_shiftKey;
+    bool m_metaKey;
+    double m_timestamp;
+};
+#endif
+
 } // namespace WebKit
 
 #endif // WebEvent_h
diff --git a/WebKit2/Shared/WebEventConversion.cpp b/WebKit2/Shared/WebEventConversion.cpp
index e3dd320..a7835a7 100644
--- a/WebKit2/Shared/WebEventConversion.cpp
+++ b/WebKit2/Shared/WebEventConversion.cpp
@@ -151,4 +151,70 @@ WebCore::PlatformKeyboardEvent platform(const WebKeyboardEvent& webEvent)
     return WebKit2PlatformKeyboardEvent(webEvent);
 }
 
+#if ENABLE(TOUCH_EVENTS)
+class WebKit2PlatformTouchPoint : public WebCore::PlatformTouchPoint {
+public:
+    WebKit2PlatformTouchPoint(const WebPlatformTouchPoint& webTouchPoint)
+    {
+        m_id = webTouchPoint.id();
+
+        switch (webTouchPoint.state()) {
+        case WebPlatformTouchPoint::TouchReleased:
+            m_state = PlatformTouchPoint::TouchReleased;
+            break;
+        case WebPlatformTouchPoint::TouchPressed:
+            m_state = PlatformTouchPoint::TouchPressed;
+            break;
+        case WebPlatformTouchPoint::TouchMoved:
+            m_state = PlatformTouchPoint::TouchMoved;
+            break;
+        case WebPlatformTouchPoint::TouchStationary:
+            m_state = PlatformTouchPoint::TouchStationary;
+            break;
+        default:
+            ASSERT_NOT_REACHED();
+        }
+
+        WebCore::IntPoint screen(webTouchPoint.screenPosX(), webTouchPoint.screenPosY());
+        WebCore::IntPoint position(webTouchPoint.posX(), webTouchPoint.posY());
+
+        m_screenPos = screen;
+        m_pos = position;
+    }
+};
+
+class WebKit2PlatformTouchEvent : public WebCore::PlatformTouchEvent {
+public:
+    WebKit2PlatformTouchEvent(const WebTouchEvent& webEvent)
+    {
+        switch (webEvent.type()) {
+        case WebEvent::TouchStart: 
+            m_type = WebCore::TouchStart; 
+            break;
+        case WebEvent::TouchMove: 
+            m_type = WebCore::TouchMove; 
+            break;
+        case WebEvent::TouchEnd: 
+            m_type = WebCore::TouchEnd; 
+            break;
+        default:
+            ASSERT_NOT_REACHED();
+        }
+
+        for (int i = 0; i < webEvent.touchPoints().size(); ++i)
+            m_touchPoints.append(WebKit2PlatformTouchPoint(webEvent.touchPoints().at(i)));
+
+        m_ctrlKey = webEvent.controlKey();
+        m_altKey = webEvent.altKey();
+        m_shiftKey = webEvent.shiftKey();
+        m_metaKey = webEvent.metaKey();
+    }
+};
+
+WebCore::PlatformTouchEvent platform(const WebTouchEvent& webEvent)
+{
+    return WebKit2PlatformTouchEvent(webEvent);
+}
+#endif
+
 } // namespace WebKit
diff --git a/WebKit2/Shared/WebEventConversion.h b/WebKit2/Shared/WebEventConversion.h
index e6de2a7..8fa0813 100644
--- a/WebKit2/Shared/WebEventConversion.h
+++ b/WebKit2/Shared/WebEventConversion.h
@@ -29,17 +29,27 @@
 #include <WebCore/PlatformKeyboardEvent.h>
 #include <WebCore/PlatformMouseEvent.h>
 #include <WebCore/PlatformWheelEvent.h>
+#if ENABLE(TOUCH_EVENTS)
+#include <WebCore/PlatformTouchEvent.h>
+#include <WebCore/PlatformTouchPoint.h>
+#endif
 
 namespace WebKit {
 
 class WebMouseEvent;
 class WebWheelEvent;
 class WebKeyboardEvent;
-
+#if ENABLE(TOUCH_EVENTS)
+class WebTouchEvent;
+class WebTouchPoint;
+#endif
 WebCore::PlatformMouseEvent platform(const WebMouseEvent&);
 WebCore::PlatformWheelEvent platform(const WebWheelEvent&);
 WebCore::PlatformKeyboardEvent platform(const WebKeyboardEvent&);
-
+#if ENABLE(TOUCH_EVENTS)
+WebCore::PlatformTouchEvent platform(const WebTouchEvent&);
+WebCore::PlatformTouchPoint platform(const WebTouchPoint&);
+#endif
 } // namespace WebKit
 
 #endif // WebEventConversion_h
diff --git a/WebKit2/Shared/qt/WebEventFactoryQt.cpp b/WebKit2/Shared/qt/WebEventFactoryQt.cpp
index e1acb46..bdd6a23 100644
--- a/WebKit2/Shared/qt/WebEventFactoryQt.cpp
+++ b/WebKit2/Shared/qt/WebEventFactoryQt.cpp
@@ -25,7 +25,6 @@
  */
 
 #include "WebEventFactoryQt.h"
-
 #include <qgraphicssceneevent.h>
 #include <QApplication>
 #include <QKeyEvent>
@@ -64,6 +63,14 @@ static WebEvent::Type webEventTypeForEvent(QEvent* event)
             return WebEvent::KeyDown;
         case QEvent::KeyRelease:
             return WebEvent::KeyUp;
+#if ENABLE(TOUCH_EVENTS)
+        case QEvent::TouchBegin:
+            return WebEvent::TouchStart;
+        case QEvent::TouchUpdate:
+            return WebEvent::TouchMove;
+        case QEvent::TouchEnd:
+            return WebEvent::TouchEnd;
+#endif
         default:
             // assert
             return WebEvent::MouseMove;
@@ -161,4 +168,49 @@ WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(QKeyEvent* event)
     return WebKeyboardEvent(type, text, unmodifiedText, keyIdentifier, windowsVirtualKeyCode, nativeVirtualKeyCode, isAutoRepeat, isKeypad, isSystemKey, modifiers, timestamp);
 }
 
+#if ENABLE(TOUCH_EVENTS)
+
+WebTouchEvent WebEventFactory::createWebTouchEvent(QTouchEvent* event)
+{
+    WebEvent::Type type  = webEventTypeForEvent(event);
+    WebPlatformTouchPoint::TouchPointState state;
+    unsigned int id;
+    WebEvent::Modifiers modifiers   = modifiersForEvent(event->modifiers());
+    double timestamp                = WTF::currentTime();
+
+    const QList<QTouchEvent::TouchPoint>& points = event->touchPoints();
+    
+    Vector<WebPlatformTouchPoint> m_touchPoints;
+    for (int i = 0; i < points.count(); ++i) {
+        id = static_cast<unsigned>(points.at(i).id());
+        switch (points.at(i).state()) {
+        case Qt::TouchPointReleased: 
+            state = WebPlatformTouchPoint::TouchReleased; 
+            break;
+        case Qt::TouchPointMoved: 
+            state = WebPlatformTouchPoint::TouchMoved; 
+            break;
+        case Qt::TouchPointPressed: 
+            state = WebPlatformTouchPoint::TouchPressed; 
+            break;
+        case Qt::TouchPointStationary: 
+            state = WebPlatformTouchPoint::TouchStationary; 
+            break;
+        }
+
+        m_touchPoints.append(WebPlatformTouchPoint(id, state, points.at(i).screenPos().toPoint().x(),
+            points.at(i).screenPos().toPoint().y(),
+            points.at(i).pos().toPoint().x(),
+            points.at(i).pos().toPoint().y()));
+        }
+
+    bool m_ctrlKey = (event->modifiers() & Qt::ControlModifier);
+    bool m_altKey = (event->modifiers() & Qt::AltModifier);
+    bool m_shiftKey = (event->modifiers() & Qt::ShiftModifier);
+    bool m_metaKey = (event->modifiers() & Qt::MetaModifier);
+
+    return WebTouchEvent(type, m_touchPoints, m_ctrlKey, m_altKey, m_shiftKey, m_metaKey, modifiers, timestamp);
+}
+#endif
+
 } // namespace WebKit
diff --git a/WebKit2/Shared/qt/WebEventFactoryQt.h b/WebKit2/Shared/qt/WebEventFactoryQt.h
index bf9c38b..7864b16 100644
--- a/WebKit2/Shared/qt/WebEventFactoryQt.h
+++ b/WebKit2/Shared/qt/WebEventFactoryQt.h
@@ -29,6 +29,10 @@
 
 #include "WebEvent.h"
 
+#if ENABLE(TOUCH_EVENTS)
+class QTouchEvent;
+#endif
+
 class QGraphicsSceneMouseEvent;
 class QGraphicsSceneWheelEvent;
 class QKeyEvent;
@@ -40,6 +44,9 @@ public:
     static WebMouseEvent createWebMouseEvent(QGraphicsSceneMouseEvent* event, int eventClickCount);
     static WebWheelEvent createWebWheelEvent(QGraphicsSceneWheelEvent* event);
     static WebKeyboardEvent createWebKeyboardEvent(QKeyEvent* event);
+#if ENABLE(TOUCH_EVENTS)
+    static WebTouchEvent createWebTouchEvent(QTouchEvent* event);
+#endif
 };
 
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp b/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp
index c61926b..02580ad 100644
--- a/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp
+++ b/WebKit2/UIProcess/API/qt/qgraphicswkview.cpp
@@ -155,6 +155,13 @@ QVariant QGraphicsWKView::itemChange(GraphicsItemChange change, const QVariant&
 */
 bool QGraphicsWKView::event(QEvent* event)
 {
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+    if (event->type() == QEvent::TouchBegin || event->type() == QEvent::TouchEnd || event->type() == QEvent::TouchUpdate) {
+        touchEvent(static_cast<QTouchEvent*>(event));
+        return true;
+    }
+#endif 
+
     // Here so that it can be reimplemented without breaking ABI.
     return QGraphicsWidget::event(event);
 }
@@ -237,6 +244,13 @@ void QGraphicsWKView::wheelEvent(QGraphicsSceneWheelEvent* ev)
         QGraphicsItem::wheelEvent(ev);
 }
 
+#if ENABLE(TOUCH_EVENTS)
+void QGraphicsWKView::touchEvent(QTouchEvent* ev)
+{
+    page()->d->touchEvent(ev);
+}
+#endif
+
 QGraphicsWKViewPrivate::QGraphicsWKViewPrivate(QGraphicsWKView* view)
     : q(view)
 {
diff --git a/WebKit2/UIProcess/API/qt/qgraphicswkview.h b/WebKit2/UIProcess/API/qt/qgraphicswkview.h
index 375a80f..85b4797 100644
--- a/WebKit2/UIProcess/API/qt/qgraphicswkview.h
+++ b/WebKit2/UIProcess/API/qt/qgraphicswkview.h
@@ -70,6 +70,7 @@ protected:
     virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
     virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent*);
     virtual void wheelEvent(QGraphicsSceneWheelEvent*);
+    virtual void touchEvent(QTouchEvent*);
 
     virtual void hoverMoveEvent(QGraphicsSceneHoverEvent*);
 
diff --git a/WebKit2/UIProcess/API/qt/qwkpage.cpp b/WebKit2/UIProcess/API/qt/qwkpage.cpp
index 5bf3d68..d10de69 100644
--- a/WebKit2/UIProcess/API/qt/qwkpage.cpp
+++ b/WebKit2/UIProcess/API/qt/qwkpage.cpp
@@ -34,6 +34,10 @@
 #include <WebKit2/WKFrame.h>
 #include <WebKit2/WKRetainPtr.h>
 
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+#include <QTouchEvent>
+#endif
+
 using namespace WebKit;
 using namespace WebCore;
 
@@ -201,6 +205,16 @@ void QWKPagePrivate::_q_webActionTriggered(bool checked)
 }
 #endif // QT_NO_ACTION
 
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+
+void QWKPagePrivate::touchEvent(QTouchEvent* event)
+{
+    WebTouchEvent touchEvent = WebEventFactory::createWebTouchEvent(event);
+    page->touchEvent(touchEvent);
+}
+
+#endif
+
 QWKPage::QWKPage(WKPageNamespaceRef namespaceRef)
     : d(new QWKPagePrivate(this, namespaceRef))
 {
diff --git a/WebKit2/UIProcess/API/qt/qwkpage_p.h b/WebKit2/UIProcess/API/qt/qwkpage_p.h
index 903ba1e..98d4efe 100644
--- a/WebKit2/UIProcess/API/qt/qwkpage_p.h
+++ b/WebKit2/UIProcess/API/qt/qwkpage_p.h
@@ -67,6 +67,10 @@ public:
 
     void _q_webActionTriggered(bool checked);
 
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+    void touchEvent(QTouchEvent*);
+#endif
+
     QAction* actions[QWKPage::WebActionCount];
 
     QWKPage* q;
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 2427e0d..f1c7547 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -332,6 +332,15 @@ void WebPageProxy::keyEvent(const WebKeyboardEvent& event)
     process()->send(WebPageMessage::KeyEvent, m_pageID, CoreIPC::In(event));
 }
 
+#if ENABLE(TOUCH_EVENTS)
+void WebPageProxy::touchEvent(const WebTouchEvent& event)
+{
+    if (!isValid())
+        return;
+    process()->send(WebPageMessage::TouchEvent, m_pageID, CoreIPC::In(event)); 
+}
+#endif
+
 void WebPageProxy::receivedPolicyDecision(WebCore::PolicyAction action, WebFrameProxy* frame, uint64_t listenerID)
 {
     if (!isValid())
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 53bd2a7..24f1f23 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -126,6 +126,9 @@ public:
     void mouseEvent(const WebMouseEvent&);
     void wheelEvent(const WebWheelEvent&);
     void keyEvent(const WebKeyboardEvent&);
+#if ENABLE(TOUCH_EVENTS)
+    void touchEvent(const WebTouchEvent&);
+#endif
 
     const WTF::String& pageTitle() const { return m_pageTitle; }
     const WTF::String& toolTip() const { return m_toolTip; }
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 4066b44..584da1b 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -419,6 +419,20 @@ void WebPage::keyEvent(const WebKeyboardEvent& keyboardEvent)
     (void)handled;
 }
 
+#if ENABLE(TOUCH_EVENTS)
+void WebPage::touchEvent(const WebTouchEvent& touchEvent)
+{
+    CurrentEvent currentEvent(touchEvent);
+    WebProcess::shared().connection()->send(WebPageProxyMessage::DidReceiveEvent, m_pageID, CoreIPC::In(static_cast<uint32_t>(touchEvent.type())));
+            
+    if (!m_mainFrame->coreFrame()->view())
+        return;
+
+    PlatformTouchEvent platformTouchEvent = platform(touchEvent);
+    m_mainFrame->coreFrame()->eventHandler()->handleTouchEvent(platformTouchEvent);
+}
+#endif
+
 void WebPage::setActive(bool isActive)
 {
     m_page->focusController()->setActive(isActive);
@@ -588,6 +602,14 @@ void WebPage::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::Messag
             keyEvent(event);
             return;
         }
+#if ENABLE(TOUCH_EVENTS)
+        case WebPageMessage::TouchEvent: {
+            WebTouchEvent event;
+            if (!arguments->decode(event))
+                return;
+            touchEvent(event);
+        }
+#endif
         case WebPageMessage::LoadURL: {
             String url;
             if (!arguments->decode(url))
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index 9d64ec3..b14077a 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -40,6 +40,9 @@
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 #include <wtf/text/WTFString.h>
+#if ENABLE(TOUCH_EVENTS)
+#include <WebCore/PlatformTouchEvent.h>
+#endif
 
 namespace CoreIPC {
     class ArgumentDecoder;
@@ -61,6 +64,9 @@ class WebFrame;
 class WebKeyboardEvent;
 class WebMouseEvent;
 class WebWheelEvent;
+#if ENABLE(TOUCH_EVENTS)
+class WebTouchEvent;
+#endif
 struct WebPreferencesStore;
 
 class WebPage : public APIObject {
@@ -152,6 +158,9 @@ private:
     void mouseEvent(const WebMouseEvent&);
     void wheelEvent(const WebWheelEvent&);
     void keyEvent(const WebKeyboardEvent&);
+#if ENABLE(TOUCH_EVENTS)
+    void touchEvent(const WebTouchEvent&);
+#endif
     void runJavaScriptInMainFrame(const WTF::String&, uint64_t callbackID);
     void getRenderTreeExternalRepresentation(uint64_t callbackID);
     void preferencesDidChange(const WebPreferencesStore&);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list