Title: [174817] trunk/Source
Revision
174817
Author
[email protected]
Date
2014-10-17 03:04:37 -0700 (Fri, 17 Oct 2014)

Log Message

[GTK] Move touch events handling from Platform to WebKit2
https://bugs.webkit.org/show_bug.cgi?id=137735

Reviewed by Sergio Villar Senin.

Source/WebCore:

Remove GtkTouchContextHelper.

* PlatformGTK.cmake:
* platform/gtk/GtkTouchContextHelper.cpp: Removed.
* platform/gtk/GtkTouchContextHelper.h: Removed.

Source/WebKit2:

GtkTouchContextHelper was only used by WebKitWebViewBase, since
it's the only one that can create touch events. The code has been
simplified by processing the events in the view, and the native
touch events are now created with the native event and touch points.

* Shared/NativeWebTouchEvent.h:
(WebKit::NativeWebTouchEvent::touchContext): Deleted.
* Shared/gtk/NativeWebTouchEventGtk.cpp:
(WebKit::NativeWebTouchEvent::NativeWebTouchEvent): Pass touch
points instead of touch context to WebEventFactory::createWebTouchEvent().
* Shared/gtk/WebEventFactory.cpp:
(WebKit::WebEventFactory::createWebTouchEvent): Create the
WebTouchEvent for the given native event and points.
(WebKit::touchPhaseFromEvents): Deleted.
(WebKit::appendTouchEvent): Deleted.
* Shared/gtk/WebEventFactory.h:
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(appendTouchEvent): Helper function to create a
WebPlatformTouchPoint for the given native event and add it to the
list of touch points.
(webkitWebViewBaseGetTouchPointForEvent): Build the touch point
list for the event.
(webkitWebViewBaseTouchEvent): Process the touch event.
(webkitWebViewBaseDragDataReceived): Deleted.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (174816 => 174817)


--- trunk/Source/WebCore/ChangeLog	2014-10-17 10:00:09 UTC (rev 174816)
+++ trunk/Source/WebCore/ChangeLog	2014-10-17 10:04:37 UTC (rev 174817)
@@ -1,3 +1,16 @@
+2014-10-17  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Move touch events handling from Platform to WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=137735
+
+        Reviewed by Sergio Villar Senin.
+
+        Remove GtkTouchContextHelper.
+
+        * PlatformGTK.cmake:
+        * platform/gtk/GtkTouchContextHelper.cpp: Removed.
+        * platform/gtk/GtkTouchContextHelper.h: Removed.
+
 2014-10-17  Gyuyoung Kim  <[email protected]>
 
         Remove unused function in WorkerThreadableLoader.h 

Modified: trunk/Source/WebCore/PlatformGTK.cmake (174816 => 174817)


--- trunk/Source/WebCore/PlatformGTK.cmake	2014-10-17 10:00:09 UTC (rev 174816)
+++ trunk/Source/WebCore/PlatformGTK.cmake	2014-10-17 10:04:37 UTC (rev 174817)
@@ -225,7 +225,6 @@
     platform/gtk/GtkClickCounter.cpp
     platform/gtk/GtkDragAndDropHelper.cpp
     platform/gtk/GtkInputMethodFilter.cpp
-    platform/gtk/GtkTouchContextHelper.cpp
     platform/gtk/GtkUtilities.cpp
     platform/gtk/GtkVersioning.c
     platform/gtk/KeyBindingTranslator.cpp

Deleted: trunk/Source/WebCore/platform/gtk/GtkTouchContextHelper.cpp (174816 => 174817)


--- trunk/Source/WebCore/platform/gtk/GtkTouchContextHelper.cpp	2014-10-17 10:00:09 UTC (rev 174816)
+++ trunk/Source/WebCore/platform/gtk/GtkTouchContextHelper.cpp	2014-10-17 10:04:37 UTC (rev 174817)
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2013 Carlos Garnacho <[email protected]>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "GtkTouchContextHelper.h"
-
-#include <gtk/gtk.h>
-
-namespace WebCore {
-
-bool GtkTouchContextHelper::handleEvent(GdkEvent* touchEvent)
-{
-#ifndef GTK_API_VERSION_2
-    uint32_t sequence = GPOINTER_TO_UINT(gdk_event_get_event_sequence(touchEvent));
-
-    switch (touchEvent->type) {
-    case GDK_TOUCH_BEGIN: {
-        ASSERT(!m_touchEvents.contains(sequence));
-        GUniquePtr<GdkEvent> event(gdk_event_copy(touchEvent));
-        m_touchEvents.add(sequence, WTF::move(event));
-        break;
-    }
-    case GDK_TOUCH_UPDATE: {
-        auto it = m_touchEvents.find(sequence);
-        ASSERT(it != m_touchEvents.end());
-        it->value.reset(gdk_event_copy(touchEvent));
-        break;
-    }
-    case GDK_TOUCH_END:
-        ASSERT(m_touchEvents.contains(sequence));
-        m_touchEvents.remove(sequence);
-        break;
-    default:
-        return false;
-    }
-#else
-    UNUSED_PARAM(touchEvent);
-#endif // GTK_API_VERSION_2
-
-    return true;
-}
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/platform/gtk/GtkTouchContextHelper.h (174816 => 174817)


--- trunk/Source/WebCore/platform/gtk/GtkTouchContextHelper.h	2014-10-17 10:00:09 UTC (rev 174816)
+++ trunk/Source/WebCore/platform/gtk/GtkTouchContextHelper.h	2014-10-17 10:04:37 UTC (rev 174817)
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2013 Carlos Garnacho <[email protected]>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef GtkTouchContextHelper_h
-#define GtkTouchContextHelper_h
-
-#include "GUniquePtrGtk.h"
-#include <wtf/HashMap.h>
-#include <wtf/Noncopyable.h>
-
-namespace WebCore {
-
-typedef HashMap<uint32_t, GUniquePtr<GdkEvent>> TouchEventsMap;
-
-class GtkTouchContextHelper {
-    WTF_MAKE_NONCOPYABLE(GtkTouchContextHelper);
-public:
-    GtkTouchContextHelper() { };
-    bool handleEvent(GdkEvent*);
-    const TouchEventsMap& touchEvents() const { return m_touchEvents; };
-
-private:
-    TouchEventsMap m_touchEvents;
-};
-
-} // namespace WebCore
-
-#endif

Modified: trunk/Source/WebKit2/ChangeLog (174816 => 174817)


--- trunk/Source/WebKit2/ChangeLog	2014-10-17 10:00:09 UTC (rev 174816)
+++ trunk/Source/WebKit2/ChangeLog	2014-10-17 10:04:37 UTC (rev 174817)
@@ -1,3 +1,35 @@
+2014-10-17  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Move touch events handling from Platform to WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=137735
+
+        Reviewed by Sergio Villar Senin.
+
+        GtkTouchContextHelper was only used by WebKitWebViewBase, since
+        it's the only one that can create touch events. The code has been
+        simplified by processing the events in the view, and the native
+        touch events are now created with the native event and touch points.
+
+        * Shared/NativeWebTouchEvent.h:
+        (WebKit::NativeWebTouchEvent::touchContext): Deleted.
+        * Shared/gtk/NativeWebTouchEventGtk.cpp:
+        (WebKit::NativeWebTouchEvent::NativeWebTouchEvent): Pass touch
+        points instead of touch context to WebEventFactory::createWebTouchEvent().
+        * Shared/gtk/WebEventFactory.cpp:
+        (WebKit::WebEventFactory::createWebTouchEvent): Create the
+        WebTouchEvent for the given native event and points.
+        (WebKit::touchPhaseFromEvents): Deleted.
+        (WebKit::appendTouchEvent): Deleted.
+        * Shared/gtk/WebEventFactory.h:
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (appendTouchEvent): Helper function to create a
+        WebPlatformTouchPoint for the given native event and add it to the
+        list of touch points.
+        (webkitWebViewBaseGetTouchPointForEvent): Build the touch point
+        list for the event.
+        (webkitWebViewBaseTouchEvent): Process the touch event.
+        (webkitWebViewBaseDragDataReceived): Deleted.
+
 2014-10-16  Pascal Jacquemart  <[email protected]>
 
         Removing CUSTOM_PROTOCOLS guard

Modified: trunk/Source/WebKit2/Shared/NativeWebTouchEvent.h (174816 => 174817)


--- trunk/Source/WebKit2/Shared/NativeWebTouchEvent.h	2014-10-17 10:00:09 UTC (rev 174816)
+++ trunk/Source/WebKit2/Shared/NativeWebTouchEvent.h	2014-10-17 10:04:37 UTC (rev 174817)
@@ -34,7 +34,6 @@
 struct _UIWebTouchEvent;
 #elif PLATFORM(GTK)
 #include <WebCore/GUniquePtrGtk.h>
-#include <WebCore/GtkTouchContextHelper.h>
 #elif PLATFORM(EFL)
 #include "EwkTouchEvent.h"
 #include <WebCore/AffineTransform.h>
@@ -49,9 +48,8 @@
     explicit NativeWebTouchEvent(const _UIWebTouchEvent*);
 #elif PLATFORM(GTK)
     NativeWebTouchEvent(const NativeWebTouchEvent&);
-    NativeWebTouchEvent(GdkEvent*, WebCore::GtkTouchContextHelper&);
+    NativeWebTouchEvent(GdkEvent*, const Vector<WebPlatformTouchPoint>&);
     const GdkEvent* nativeEvent() const { return m_nativeEvent.get(); }
-    const WebCore::GtkTouchContextHelper& touchContext() const { return m_touchContext; }
 #elif PLATFORM(EFL)
     NativeWebTouchEvent(EwkTouchEvent*, const WebCore::AffineTransform&);
     const EwkTouchEvent* nativeEvent() const { return m_nativeEvent.get(); }
@@ -60,7 +58,6 @@
 private:
 #if PLATFORM(GTK)
     GUniquePtr<GdkEvent> m_nativeEvent;
-    const WebCore::GtkTouchContextHelper& m_touchContext;
 #elif PLATFORM(EFL)
     RefPtr<EwkTouchEvent> m_nativeEvent;
 #endif

Modified: trunk/Source/WebKit2/Shared/gtk/NativeWebTouchEventGtk.cpp (174816 => 174817)


--- trunk/Source/WebKit2/Shared/gtk/NativeWebTouchEventGtk.cpp	2014-10-17 10:00:09 UTC (rev 174816)
+++ trunk/Source/WebKit2/Shared/gtk/NativeWebTouchEventGtk.cpp	2014-10-17 10:04:37 UTC (rev 174817)
@@ -31,17 +31,15 @@
 
 namespace WebKit {
 
-NativeWebTouchEvent::NativeWebTouchEvent(GdkEvent* event, WebCore::GtkTouchContextHelper& context)
-    : WebTouchEvent(WebEventFactory::createWebTouchEvent(event, context))
+NativeWebTouchEvent::NativeWebTouchEvent(GdkEvent* event, const Vector<WebPlatformTouchPoint>& touchPoints)
+    : WebTouchEvent(WebEventFactory::createWebTouchEvent(event, touchPoints))
     , m_nativeEvent(gdk_event_copy(event))
-    , m_touchContext(context)
 {
 }
 
 NativeWebTouchEvent::NativeWebTouchEvent(const NativeWebTouchEvent& event)
-    : WebTouchEvent(WebEventFactory::createWebTouchEvent(event.nativeEvent(), event.touchContext()))
+    : WebTouchEvent(WebEventFactory::createWebTouchEvent(event.nativeEvent(), event.touchPoints()))
     , m_nativeEvent(gdk_event_copy(event.nativeEvent()))
-    , m_touchContext(event.touchContext())
 {
 }
 

Modified: trunk/Source/WebKit2/Shared/gtk/WebEventFactory.cpp (174816 => 174817)


--- trunk/Source/WebKit2/Shared/gtk/WebEventFactory.cpp	2014-10-17 10:00:09 UTC (rev 174816)
+++ trunk/Source/WebKit2/Shared/gtk/WebEventFactory.cpp	2014-10-17 10:04:37 UTC (rev 174817)
@@ -204,46 +204,10 @@
                             gdk_event_get_time(event));
 }
 
-#ifndef GTK_API_VERSION_2
-static WebPlatformTouchPoint::TouchPointState touchPhaseFromEvents(const GdkEvent* current, const GdkEvent* event)
+WebTouchEvent WebEventFactory::createWebTouchEvent(const GdkEvent* event, const Vector<WebPlatformTouchPoint>& touchPoints)
 {
-    if (gdk_event_get_event_sequence(current) != gdk_event_get_event_sequence(event))
-        return WebPlatformTouchPoint::TouchStationary;
-
-    switch (current->type) {
-    case GDK_TOUCH_UPDATE:
-        return WebPlatformTouchPoint::TouchMoved;
-    case GDK_TOUCH_BEGIN:
-        return WebPlatformTouchPoint::TouchPressed;
-    case GDK_TOUCH_END:
-        return WebPlatformTouchPoint::TouchReleased;
-    default:
-        return WebPlatformTouchPoint::TouchStationary;
-    }
-}
-
-static void appendTouchEvent(Vector<WebPlatformTouchPoint>& touchPointList, const GdkEvent* event, WebPlatformTouchPoint::TouchPointState state)
-{
-    uint32_t identifier = GPOINTER_TO_UINT(gdk_event_get_event_sequence(event));
-
-    gdouble x, y;
-    gdk_event_get_coords(event, &x, &y);
-
-    gdouble xRoot, yRoot;
-    gdk_event_get_root_coords(event, &xRoot, &yRoot);
-
-    WebPlatformTouchPoint touchPoint(identifier, state, IntPoint(xRoot, yRoot), IntPoint(x, y));
-    touchPointList.uncheckedAppend(touchPoint);
-}
-#endif // GTK_API_VERSION_2
-
-WebTouchEvent WebEventFactory::createWebTouchEvent(const GdkEvent* event, const WebCore::GtkTouchContextHelper& touchContext)
-{
 #ifndef GTK_API_VERSION_2
     WebEvent::Type type = WebEvent::NoType;
-    const auto& touchEvents = touchContext.touchEvents();
-    int numEvents = touchEvents.size();
-
     switch (event->type) {
     case GDK_TOUCH_BEGIN:
         type = WebEvent::TouchStart;
@@ -253,23 +217,12 @@
         break;
     case GDK_TOUCH_END:
         type = WebEvent::TouchEnd;
-        ++numEvents;
         break;
     default:
         ASSERT_NOT_REACHED();
     }
 
-    Vector<WebPlatformTouchPoint> touchPointList;
-    touchPointList.reserveInitialCapacity(numEvents);
-
-    for (auto it = touchEvents.begin(); it != touchEvents.end(); ++it)
-        appendTouchEvent(touchPointList, it->value.get(), touchPhaseFromEvents(it->value.get(), event));
-
-    // Touch was already removed from the GtkTouchContextHelper, add it here.
-    if (event->type == GDK_TOUCH_END)
-        appendTouchEvent(touchPointList, event, WebPlatformTouchPoint::TouchReleased);
-
-    return WebTouchEvent(type, touchPointList, modifiersForEvent(event), gdk_event_get_time(event));
+    return WebTouchEvent(type, touchPoints, modifiersForEvent(event), gdk_event_get_time(event));
 #else
     return WebTouchEvent();
 #endif // GTK_API_VERSION_2

Modified: trunk/Source/WebKit2/Shared/gtk/WebEventFactory.h (174816 => 174817)


--- trunk/Source/WebKit2/Shared/gtk/WebEventFactory.h	2014-10-17 10:00:09 UTC (rev 174816)
+++ trunk/Source/WebKit2/Shared/gtk/WebEventFactory.h	2014-10-17 10:04:37 UTC (rev 174817)
@@ -29,7 +29,6 @@
 
 #include "WebEvent.h"
 #include <WebCore/CompositionResults.h>
-#include <WebCore/GtkTouchContextHelper.h>
 
 typedef union _GdkEvent GdkEvent;
 
@@ -40,7 +39,7 @@
     static WebMouseEvent createWebMouseEvent(const GdkEvent*, int);
     static WebWheelEvent createWebWheelEvent(const GdkEvent*);
     static WebKeyboardEvent createWebKeyboardEvent(const GdkEvent*, const WebCore::CompositionResults&);
-    static WebTouchEvent createWebTouchEvent(const GdkEvent*, const WebCore::GtkTouchContextHelper&);
+    static WebTouchEvent createWebTouchEvent(const GdkEvent*, const Vector<WebPlatformTouchPoint>&);
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (174816 => 174817)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp	2014-10-17 10:00:09 UTC (rev 174816)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp	2014-10-17 10:04:37 UTC (rev 174817)
@@ -55,7 +55,6 @@
 #include <WebCore/GUniquePtrGtk.h>
 #include <WebCore/GtkClickCounter.h>
 #include <WebCore/GtkDragAndDropHelper.h>
-#include <WebCore/GtkTouchContextHelper.h>
 #include <WebCore/GtkUtilities.h>
 #include <WebCore/GtkVersioning.h>
 #include <WebCore/NotImplemented.h>
@@ -88,6 +87,7 @@
 using namespace WebCore;
 
 typedef HashMap<GtkWidget*, IntRect> WebKitWebViewChildrenMap;
+typedef HashMap<uint32_t, GUniquePtr<GdkEvent>> TouchEventsMap;
 
 #if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
 void redirectedWindowDamagedCallback(void* data);
@@ -117,7 +117,7 @@
     GUniquePtr<GdkEvent> contextMenuEvent;
     WebContextMenuProxyGtk* activeContextMenuProxy;
     WebViewBaseInputMethodFilter inputMethodFilter;
-    GtkTouchContextHelper touchContext;
+    TouchEventsMap touchEvents;
 
     GtkWindow* toplevelOnScreenWindow;
 #if !GTK_CHECK_VERSION(3, 13, 4)
@@ -741,6 +741,48 @@
     return TRUE;
 }
 
+static void appendTouchEvent(Vector<WebPlatformTouchPoint>& touchPoints, const GdkEvent* event, WebPlatformTouchPoint::TouchPointState state)
+{
+    gdouble x, y;
+    gdk_event_get_coords(event, &x, &y);
+
+    gdouble xRoot, yRoot;
+    gdk_event_get_root_coords(event, &xRoot, &yRoot);
+
+    uint32_t identifier = GPOINTER_TO_UINT(gdk_event_get_event_sequence(event));
+    touchPoints.uncheckedAppend(WebPlatformTouchPoint(identifier, state, IntPoint(xRoot, yRoot), IntPoint(x, y)));
+}
+
+static inline WebPlatformTouchPoint::TouchPointState touchPointStateForEvents(const GdkEvent* current, const GdkEvent* event)
+{
+    if (gdk_event_get_event_sequence(current) != gdk_event_get_event_sequence(event))
+        return WebPlatformTouchPoint::TouchStationary;
+
+    switch (current->type) {
+    case GDK_TOUCH_UPDATE:
+        return WebPlatformTouchPoint::TouchMoved;
+    case GDK_TOUCH_BEGIN:
+        return WebPlatformTouchPoint::TouchPressed;
+    case GDK_TOUCH_END:
+        return WebPlatformTouchPoint::TouchReleased;
+    default:
+        return WebPlatformTouchPoint::TouchStationary;
+    }
+}
+
+static void webkitWebViewBaseGetTouchPointsForEvent(WebKitWebViewBase* webViewBase, GdkEvent* event, Vector<WebPlatformTouchPoint>& touchPoints)
+{
+    WebKitWebViewBasePrivate* priv = webViewBase->priv;
+    touchPoints.reserveInitialCapacity(event->type == GDK_TOUCH_END ? priv->touchEvents.size() + 1 : priv->touchEvents.size());
+
+    for (const auto& it : priv->touchEvents)
+        appendTouchEvent(touchPoints, it.value.get(), touchPointStateForEvents(it.value.get(), event));
+
+    // Touch was already removed from the TouchEventsMap, add it here.
+    if (event->type == GDK_TOUCH_END)
+        appendTouchEvent(touchPoints, event, WebPlatformTouchPoint::TouchReleased);
+}
+
 static gboolean webkitWebViewBaseTouchEvent(GtkWidget* widget, GdkEventTouch* event)
 {
     WebKitWebViewBasePrivate* priv = WEBKIT_WEB_VIEW_BASE(widget)->priv;
@@ -748,9 +790,34 @@
     if (priv->authenticationDialog)
         return TRUE;
 
-    priv->touchContext.handleEvent(reinterpret_cast<GdkEvent*>(event));
-    priv->pageProxy->handleTouchEvent(NativeWebTouchEvent(reinterpret_cast<GdkEvent*>(event), priv->touchContext));
+    GdkEvent* touchEvent = reinterpret_cast<GdkEvent*>(event);
+    uint32_t sequence = GPOINTER_TO_UINT(gdk_event_get_event_sequence(touchEvent));
 
+    switch (touchEvent->type) {
+    case GDK_TOUCH_BEGIN: {
+        ASSERT(!priv->touchEvents.contains(sequence));
+        GUniquePtr<GdkEvent> event(gdk_event_copy(touchEvent));
+        priv->touchEvents.add(sequence, WTF::move(event));
+        break;
+    }
+    case GDK_TOUCH_UPDATE: {
+        auto it = priv->touchEvents.find(sequence);
+        ASSERT(it != priv->touchEvents.end());
+        it->value.reset(gdk_event_copy(touchEvent));
+        break;
+    }
+    case GDK_TOUCH_END:
+        ASSERT(priv->touchEvents.contains(sequence));
+        priv->touchEvents.remove(sequence);
+        break;
+    default:
+        break;
+    }
+
+    Vector<WebPlatformTouchPoint> touchPoints;
+    webkitWebViewBaseGetTouchPointsForEvent(WEBKIT_WEB_VIEW_BASE(widget), touchEvent, touchPoints);
+    priv->pageProxy->handleTouchEvent(NativeWebTouchEvent(reinterpret_cast<GdkEvent*>(event), touchPoints));
+
     return TRUE;
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to