Title: [153048] trunk/Source/WebKit2
Revision
153048
Author
[email protected]
Date
2013-07-23 05:35:48 -0700 (Tue, 23 Jul 2013)

Log Message

[EFL][WK2] Add doneWithTouchEvent callback to the WKViewClient.
https://bugs.webkit.org/show_bug.cgi?id=110085

Patch by Eunmi Lee <[email protected]> on 2013-07-23
Reviewed by Kenneth Rohde Christiansen.

Add doneWithTouchEvent callback to the WKViewClient in order to get the
result of touch events in the EwkView. The result will be used to
recognize gestures in the Bug 102643.

APIs to get values from WKTouchEventRef and WKTouchPointRef are added
because WKTypeRef is opaque to the applications.

* UIProcess/API/C/CoordinatedGraphics/WKView.h:
* UIProcess/API/C/efl/WKAPICastEfl.h:
(WebKit::toAPI):
* UIProcess/API/C/efl/WKEventEfl.cpp:
(WKTouchEventGetType):
(WKTouchEventGetTouchPoints):
(WKTouchEventGetModifiers):
(WKTouchEventGetTimestamp):
(WKTouchPointGetID):
(WKTouchPointGetState):
(WKTouchPointGetScreenPosition):
(WKTouchPointGetPosition):
(WKTouchPointGetRadius):
(WKTouchPointGetRotationAngle):
(WKTouchPointGetForceFactor):
* UIProcess/API/C/efl/WKEventEfl.h:
* UIProcess/API/efl/EwkView.cpp:
(EwkView::doneWithTouchEvent):
* UIProcess/API/efl/EwkView.h:
* UIProcess/CoordinatedGraphics/WebView.cpp:
(WebKit::WebView::doneWithTouchEvent):
* UIProcess/CoordinatedGraphics/WebViewClient.cpp:
(WebKit::WebViewClient::doneWithTouchEvent):
* UIProcess/CoordinatedGraphics/WebViewClient.h:
* UIProcess/efl/ViewClientEfl.cpp:
(WebKit::ViewClientEfl::doneWithTouchEvent):
(WebKit::ViewClientEfl::ViewClientEfl):
* UIProcess/efl/ViewClientEfl.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (153047 => 153048)


--- trunk/Source/WebKit2/ChangeLog	2013-07-23 12:24:40 UTC (rev 153047)
+++ trunk/Source/WebKit2/ChangeLog	2013-07-23 12:35:48 UTC (rev 153048)
@@ -1,3 +1,46 @@
+2013-07-23  Eunmi Lee  <[email protected]>
+
+        [EFL][WK2] Add doneWithTouchEvent callback to the WKViewClient.
+        https://bugs.webkit.org/show_bug.cgi?id=110085
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Add doneWithTouchEvent callback to the WKViewClient in order to get the
+        result of touch events in the EwkView. The result will be used to
+        recognize gestures in the Bug 102643.
+
+        APIs to get values from WKTouchEventRef and WKTouchPointRef are added
+        because WKTypeRef is opaque to the applications.
+
+        * UIProcess/API/C/CoordinatedGraphics/WKView.h:
+        * UIProcess/API/C/efl/WKAPICastEfl.h:
+        (WebKit::toAPI):
+        * UIProcess/API/C/efl/WKEventEfl.cpp:
+        (WKTouchEventGetType):
+        (WKTouchEventGetTouchPoints):
+        (WKTouchEventGetModifiers):
+        (WKTouchEventGetTimestamp):
+        (WKTouchPointGetID):
+        (WKTouchPointGetState):
+        (WKTouchPointGetScreenPosition):
+        (WKTouchPointGetPosition):
+        (WKTouchPointGetRadius):
+        (WKTouchPointGetRotationAngle):
+        (WKTouchPointGetForceFactor):
+        * UIProcess/API/C/efl/WKEventEfl.h:
+        * UIProcess/API/efl/EwkView.cpp:
+        (EwkView::doneWithTouchEvent):
+        * UIProcess/API/efl/EwkView.h:
+        * UIProcess/CoordinatedGraphics/WebView.cpp:
+        (WebKit::WebView::doneWithTouchEvent):
+        * UIProcess/CoordinatedGraphics/WebViewClient.cpp:
+        (WebKit::WebViewClient::doneWithTouchEvent):
+        * UIProcess/CoordinatedGraphics/WebViewClient.h:
+        * UIProcess/efl/ViewClientEfl.cpp:
+        (WebKit::ViewClientEfl::doneWithTouchEvent):
+        (WebKit::ViewClientEfl::ViewClientEfl):
+        * UIProcess/efl/ViewClientEfl.h:
+
 2013-07-22  Alexey Proskuryakov  <[email protected]>
 
         Frequent MESSAGE_CHECK failures in WebPageProxy::didReceiveEvent

Modified: trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h (153047 => 153048)


--- trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h	2013-07-23 12:24:40 UTC (rev 153047)
+++ trunk/Source/WebKit2/UIProcess/API/C/CoordinatedGraphics/WKView.h	2013-07-23 12:35:48 UTC (rev 153048)
@@ -24,6 +24,10 @@
 #include <WebKit2/WKBase.h>
 #include <WebKit2/WKGeometry.h>
 
+#ifndef __cplusplus
+#include <stdbool.h>
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -37,6 +41,7 @@
 typedef void (*WKViewPageDidChangeViewportAttributesCallback)(WKViewRef view, WKViewportAttributesRef, const void* clientInfo);
 typedef void (*WKViewPageDidChangeTooltipCallback)(WKViewRef view, WKStringRef newTooltip, const void* clientInfo);
 typedef void (*WKViewDidFindZoomableAreaCallback)(WKViewRef view, WKPoint point, WKRect area, const void* clientInfo);
+typedef void (*WKViewDoneWithTouchEventCallback)(WKViewRef view, WKTouchEventRef touchEvent, bool wasEventHandled, const void* clientInfo);
 
 struct WKViewClient {
     int                                              version;
@@ -53,6 +58,7 @@
     WKViewPageDidChangeViewportAttributesCallback    didChangeViewportAttributes;
     WKViewPageDidChangeTooltipCallback               didChangeTooltip;
     WKViewDidFindZoomableAreaCallback                didFindZoomableArea;
+    WKViewDoneWithTouchEventCallback                 doneWithTouchEvent;
 };
 typedef struct WKViewClient WKViewClient;
 

Modified: trunk/Source/WebKit2/UIProcess/API/C/efl/WKAPICastEfl.h (153047 => 153048)


--- trunk/Source/WebKit2/UIProcess/API/C/efl/WKAPICastEfl.h	2013-07-23 12:24:40 UTC (rev 153047)
+++ trunk/Source/WebKit2/UIProcess/API/C/efl/WKAPICastEfl.h	2013-07-23 12:35:48 UTC (rev 153048)
@@ -27,6 +27,11 @@
 #include <WebCore/TextDirection.h>
 #include <WebKit2/WKPopupItem.h>
 
+#if ENABLE(TOUCH_EVENTS)
+#include "WebEvent.h"
+#include <WebKit2/WKEventEfl.h>
+#endif
+
 namespace WebKit {
 
 class WebView;
@@ -62,6 +67,43 @@
     return wkDirection;
 }
 
+#if ENABLE(TOUCH_EVENTS)
+inline WKEventType toAPI(WebEvent::Type type)
+{
+    switch (type) {
+    case WebEvent::TouchStart:
+        return kWKEventTypeTouchStart;
+    case WebEvent::TouchMove:
+        return kWKEventTypeTouchMove;
+    case WebEvent::TouchEnd:
+        return kWKEventTypeTouchEnd;
+    case WebEvent::TouchCancel:
+        return kWKEventTypeTouchCancel;
+    default:
+        return kWKEventTypeNoType;
+    }
 }
 
+inline WKTouchPointState toAPI(WebPlatformTouchPoint::TouchPointState state)
+{
+    switch (state) {
+    case WebPlatformTouchPoint::TouchReleased:
+        return kWKTouchPointStateTouchReleased;
+    case WebPlatformTouchPoint::TouchPressed:
+        return kWKTouchPointStateTouchPressed;
+    case WebPlatformTouchPoint::TouchMoved:
+        return kWKTouchPointStateTouchMoved;
+    case WebPlatformTouchPoint::TouchStationary:
+        return kWKTouchPointStateTouchStationary;
+    case WebPlatformTouchPoint::TouchCancelled:
+        return kWKTouchPointStateTouchCancelled;
+    }
+
+    ASSERT_NOT_REACHED();
+    return kWKTouchPointStateTouchCancelled;
+}
+#endif
+
+}
+
 #endif // WKAPICastEfl_h

Modified: trunk/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.cpp (153047 => 153048)


--- trunk/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.cpp	2013-07-23 12:24:40 UTC (rev 153047)
+++ trunk/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.cpp	2013-07-23 12:35:48 UTC (rev 153048)
@@ -62,3 +62,113 @@
     return 0;
 #endif
 }
+
+WKEventType WKTouchEventGetType(WKTouchEventRef event)
+{
+#if ENABLE(TOUCH_EVENTS)
+    return toImpl(event)->eventType();
+#else
+    UNUSED_PARAM(event);
+    return kWKEventTypeNoType;
+#endif
+}
+
+WKArrayRef WKTouchEventGetTouchPoints(WKTouchEventRef event)
+{
+#if ENABLE(TOUCH_EVENTS)
+    return toImpl(event)->touchPoints();
+#else
+    UNUSED_PARAM(event);
+    return 0;
+#endif
+}
+
+WKEventModifiers WKTouchEventGetModifiers(WKTouchEventRef event)
+{
+#if ENABLE(TOUCH_EVENTS)
+    return toImpl(event)->modifiers();
+#else
+    UNUSED_PARAM(event);
+    return 0;
+#endif
+}
+
+double WKTouchEventGetTimestamp(WKTouchEventRef event)
+{
+#if ENABLE(TOUCH_EVENTS)
+    return toImpl(event)->timestamp();
+#else
+    UNUSED_PARAM(event);
+    return 0;
+#endif
+}
+
+uint32_t WKTouchPointGetID(WKTouchPointRef point)
+{
+#if ENABLE(TOUCH_EVENTS)
+    return toImpl(point)->id();
+#else
+    UNUSED_PARAM(point);
+    return 0;
+#endif
+}
+
+WKTouchPointState WKTouchPointGetState(WKTouchPointRef point)
+{
+#if ENABLE(TOUCH_EVENTS)
+    return toImpl(point)->state();
+#else
+    UNUSED_PARAM(point);
+    return kWKTouchPointStateTouchCancelled;
+#endif
+}
+
+WKPoint WKTouchPointGetScreenPosition(WKTouchPointRef point)
+{
+#if ENABLE(TOUCH_EVENTS)
+    return toImpl(point)->screenPosition();
+#else
+    UNUSED_PARAM(point);
+    return WKPointMake(0, 0);
+#endif
+}
+
+WKPoint WKTouchPointGetPosition(WKTouchPointRef point)
+{
+#if ENABLE(TOUCH_EVENTS)
+    return toImpl(point)->position();
+#else
+    UNUSED_PARAM(point);
+    return WKPointMake(0, 0);
+#endif
+}
+
+WKSize WKTouchPointGetRadius(WKTouchPointRef point)
+{
+#if ENABLE(TOUCH_EVENTS)
+    return toImpl(point)->radius();
+#else
+    UNUSED_PARAM(point);
+    return WKSizeMake(0, 0);
+#endif
+}
+
+float WKTouchPointGetRotationAngle(WKTouchPointRef point)
+{
+#if ENABLE(TOUCH_EVENTS)
+    return toImpl(point)->rotationAngle();
+#else
+    UNUSED_PARAM(point);
+    return 0;
+#endif
+}
+
+float WKTouchPointGetForceFactor(WKTouchPointRef point)
+{
+#if ENABLE(TOUCH_EVENTS)
+    return toImpl(point)->forceFactor();
+#else
+    UNUSED_PARAM(point);
+    return 0;
+#endif
+}

Modified: trunk/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.h (153047 => 153048)


--- trunk/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.h	2013-07-23 12:24:40 UTC (rev 153047)
+++ trunk/Source/WebKit2/UIProcess/API/C/efl/WKEventEfl.h	2013-07-23 12:35:48 UTC (rev 153048)
@@ -55,6 +55,19 @@
 WK_EXPORT WKTouchPointRef WKTouchPointCreate(int id, WKPoint position, WKPoint screenPosition, WKTouchPointState, WKSize radius, float rotationAngle, float forceFactor);
 WK_EXPORT WKTouchEventRef WKTouchEventCreate(WKEventType, WKArrayRef, WKEventModifiers, double timestamp);
 
+WK_EXPORT WKEventType WKTouchEventGetType(WKTouchEventRef);
+WK_EXPORT WKArrayRef WKTouchEventGetTouchPoints(WKTouchEventRef);
+WK_EXPORT WKEventModifiers WKTouchEventGetModifiers(WKTouchEventRef);
+WK_EXPORT double WKTouchEventGetTimestamp(WKTouchEventRef);
+
+WK_EXPORT uint32_t WKTouchPointGetID(WKTouchPointRef);
+WK_EXPORT WKTouchPointState WKTouchPointGetState(WKTouchPointRef);
+WK_EXPORT WKPoint WKTouchPointGetScreenPosition(WKTouchPointRef);
+WK_EXPORT WKPoint WKTouchPointGetPosition(WKTouchPointRef);
+WK_EXPORT WKSize WKTouchPointGetRadius(WKTouchPointRef);
+WK_EXPORT float WKTouchPointGetRotationAngle(WKTouchPointRef);
+WK_EXPORT float WKTouchPointGetForceFactor(WKTouchPointRef);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp (153047 => 153048)


--- trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp	2013-07-23 12:24:40 UTC (rev 153047)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkView.cpp	2013-07-23 12:35:48 UTC (rev 153048)
@@ -74,6 +74,7 @@
 #endif
 #include <WebCore/CairoUtilitiesEfl.h>
 #include <WebCore/Cursor.h>
+#include <WebCore/NotImplemented.h>
 #include <WebCore/PlatformContextCairo.h>
 #include <WebKit2/WKImageCairo.h>
 #include <wtf/MathExtras.h>
@@ -791,6 +792,11 @@
         evas_object_event_callback_del(m_evasObject, EVAS_CALLBACK_MULTI_MOVE, handleTouchMove);
     }
 }
+
+void EwkView::doneWithTouchEvent(WKTouchEventRef, bool /* wasEventHandled */)
+{
+    notImplemented();
+}
 #endif
 
 #if USE(ACCELERATED_COMPOSITING)

Modified: trunk/Source/WebKit2/UIProcess/API/efl/EwkView.h (153047 => 153048)


--- trunk/Source/WebKit2/UIProcess/API/efl/EwkView.h	2013-07-23 12:24:40 UTC (rev 153047)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EwkView.h	2013-07-23 12:35:48 UTC (rev 153048)
@@ -146,6 +146,7 @@
     void feedTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers);
     bool touchEventsEnabled() const { return m_touchEventsEnabled; }
     void setTouchEventsEnabled(bool enabled);
+    void doneWithTouchEvent(WKTouchEventRef, bool);
 #endif
 
     void setCursor(const WebCore::Cursor& cursor);

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp (153047 => 153048)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp	2013-07-23 12:24:40 UTC (rev 153047)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebView.cpp	2013-07-23 12:35:48 UTC (rev 153048)
@@ -393,9 +393,9 @@
 }
 
 #if ENABLE(TOUCH_EVENTS)
-void WebView::doneWithTouchEvent(const NativeWebTouchEvent&, bool /*wasEventHandled*/)
+void WebView::doneWithTouchEvent(const NativeWebTouchEvent& event, bool wasEventHandled)
 {
-    notImplemented();
+    m_client.doneWithTouchEvent(this, event, wasEventHandled);
 }
 #endif
 

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebViewClient.cpp (153047 => 153048)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebViewClient.cpp	2013-07-23 12:24:40 UTC (rev 153047)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebViewClient.cpp	2013-07-23 12:35:48 UTC (rev 153048)
@@ -29,11 +29,16 @@
 
 #include "WebViewClient.h"
 
+#include "NotImplemented.h"
 #include "WKAPICast.h"
 #include "WKBase.h"
 #include "WKRetainPtr.h"
 #include "WebViewportAttributes.h"
 
+#if ENABLE(TOUCH_EVENTS)
+#include "NativeWebTouchEvent.h"
+#endif
+
 using namespace WebCore;
 
 namespace WebKit {
@@ -119,6 +124,23 @@
     m_client.didFindZoomableArea(toAPI(view), toAPI(target), toAPI(area), m_client.clientInfo);
 }
 
+#if ENABLE(TOUCH_EVENTS)
+void WebViewClient::doneWithTouchEvent(WebView* view, const NativeWebTouchEvent& event, bool wasEventHandled)
+{
+#if PLATFORM(EFL)
+    if (!m_client.doneWithTouchEvent)
+        return;
+
+    m_client.doneWithTouchEvent(toAPI(view), toAPI(const_cast<EwkTouchEvent*>(event.nativeEvent())), wasEventHandled, m_client.clientInfo);
+#else
+    notImplemented();
+    UNUSED_PARAM(view);
+    UNUSED_PARAM(event);
+    UNUSED_PARAM(wasEventHandled);
+#endif
+}
+#endif
+
 } // namespace WebKit
 
 #endif // USE(COORDINATED_GRAPHICS)

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebViewClient.h (153047 => 153048)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebViewClient.h	2013-07-23 12:24:40 UTC (rev 153047)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/WebViewClient.h	2013-07-23 12:35:48 UTC (rev 153048)
@@ -43,6 +43,10 @@
 
 class WebView;
 
+#if ENABLE(TOUCH_EVENTS)
+class NativeWebTouchEvent;
+#endif
+
 class WebViewClient: public APIClient<WKViewClient, kWKViewClientCurrentVersion> {
 public:
     void viewNeedsDisplay(WebView*, const WebCore::IntRect&);
@@ -55,6 +59,9 @@
     void didChangeViewportAttributes(WebView*, const WebCore::ViewportAttributes&);
     void didChangeTooltip(WebView*, const String& tooltip);
     void didFindZoomableArea(WebView*, const WebCore::IntPoint&, const WebCore::IntRect&);
+#if ENABLE(TOUCH_EVENTS)
+    void doneWithTouchEvent(WebView*, const NativeWebTouchEvent&, bool);
+#endif
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.cpp (153047 => 153048)


--- trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.cpp	2013-07-23 12:24:40 UTC (rev 153047)
+++ trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.cpp	2013-07-23 12:35:48 UTC (rev 153048)
@@ -159,6 +159,13 @@
     toEwkView(clientInfo)->didFindZoomableArea(point, area);
 }
 
+#if ENABLE(TOUCH_EVENTS)
+void ViewClientEfl::doneWithTouchEvent(WKViewRef, WKTouchEventRef event, bool wasEventHandled, const void* clientInfo)
+{
+    toEwkView(clientInfo)->doneWithTouchEvent(event, wasEventHandled);
+}
+#endif
+
 ViewClientEfl::ViewClientEfl(EwkView* view)
     : m_view(view)
 {
@@ -178,6 +185,9 @@
     viewClient.didCompletePageTransition = didCompletePageTransition;
     viewClient.didChangeViewportAttributes = didChangeViewportAttributes;
     viewClient.didChangeTooltip = didChangeTooltip;
+#if ENABLE(TOUCH_EVENTS)
+    viewClient.doneWithTouchEvent = doneWithTouchEvent;
+#endif
 
     WKViewSetViewClient(m_view->wkView(), &viewClient);
 }

Modified: trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.h (153047 => 153048)


--- trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.h	2013-07-23 12:24:40 UTC (rev 153047)
+++ trunk/Source/WebKit2/UIProcess/efl/ViewClientEfl.h	2013-07-23 12:35:48 UTC (rev 153048)
@@ -57,6 +57,9 @@
     static void didChangeViewportAttributes(WKViewRef, WKViewportAttributesRef, const void* clientInfo);
     static void didChangeTooltip(WKViewRef, WKStringRef, const void* clientInfo);
     static void didFindZoomableArea(WKViewRef, WKPoint, WKRect, const void* clientInfo);
+#if ENABLE(TOUCH_EVENTS)
+    static void doneWithTouchEvent(WKViewRef, WKTouchEventRef, bool, const void* clientInfo);
+#endif
 
     EwkView* m_view;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to