Diff
Modified: trunk/Source/WebKit2/ChangeLog (128852 => 128853)
--- trunk/Source/WebKit2/ChangeLog 2012-09-18 06:34:55 UTC (rev 128852)
+++ trunk/Source/WebKit2/ChangeLog 2012-09-18 06:45:09 UTC (rev 128853)
@@ -1,3 +1,28 @@
+2012-09-17 Eunmi Lee <[email protected]>
+
+ [EFL][WK2] Add NativeWebTouchEvent and handle the Touch event.
+ https://bugs.webkit.org/show_bug.cgi?id=90662
+
+ Reviewed by Gyuyoung Kim.
+
+ Implement codes to handle touch event for WebKit2 EFL port.
+ Additionally, types and structure for touch event are defined because
+ they are not in the Evas.
+
+ * PlatformEfl.cmake:
+ * Shared/NativeWebTouchEvent.h:
+ (NativeWebTouchEvent):
+ * Shared/efl/NativeWebTouchEventEfl.cpp: Added.
+ (WebKit):
+ (WebKit::NativeWebTouchEvent::NativeWebTouchEvent):
+ * Shared/efl/WebEventFactory.cpp:
+ (WebKit):
+ (WebKit::typeForTouchEvent):
+ (WebKit::WebEventFactory::createWebTouchEvent):
+ * Shared/efl/WebEventFactory.h:
+ (WebEventFactory):
+ * UIProcess/API/efl/ewk_touch.h: Added.
+
2012-09-17 Csaba Osztrogonác <[email protected]>
Unreviewed, rolling out r128826 and r128813.
Modified: trunk/Source/WebKit2/PlatformEfl.cmake (128852 => 128853)
--- trunk/Source/WebKit2/PlatformEfl.cmake 2012-09-18 06:34:55 UTC (rev 128852)
+++ trunk/Source/WebKit2/PlatformEfl.cmake 2012-09-18 06:45:09 UTC (rev 128853)
@@ -17,6 +17,7 @@
Shared/efl/NativeWebKeyboardEventEfl.cpp
Shared/efl/NativeWebWheelEventEfl.cpp
Shared/efl/NativeWebMouseEventEfl.cpp
+ Shared/efl/NativeWebTouchEventEfl.cpp
Shared/efl/ProcessExecutablePathEfl.cpp
Shared/efl/WebEventFactory.cpp
Modified: trunk/Source/WebKit2/Shared/NativeWebTouchEvent.h (128852 => 128853)
--- trunk/Source/WebKit2/Shared/NativeWebTouchEvent.h 2012-09-18 06:34:55 UTC (rev 128852)
+++ trunk/Source/WebKit2/Shared/NativeWebTouchEvent.h 2012-09-18 06:45:09 UTC (rev 128853)
@@ -30,6 +30,9 @@
#if PLATFORM(QT)
#include <QTouchEvent>
+#elif PLATFORM(EFL)
+#include "ewk_touch.h"
+#include <Evas.h>
#endif
namespace WebKit {
@@ -38,6 +41,8 @@
public:
#if PLATFORM(QT)
explicit NativeWebTouchEvent(const QTouchEvent*, const QTransform& fromItemTransform);
+#elif PLATFORM(EFL)
+ NativeWebTouchEvent(Ewk_Touch_Event_Type, const Eina_List*, const Evas_Modifier*, const Evas_Point*, double timestamp);
#endif
#if PLATFORM(QT)
Copied: trunk/Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp (from rev 128852, trunk/Source/WebKit2/Shared/NativeWebTouchEvent.h) (0 => 128853)
--- trunk/Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp (rev 0)
+++ trunk/Source/WebKit2/Shared/efl/NativeWebTouchEventEfl.cpp 2012-09-18 06:45:09 UTC (rev 128853)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * 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 "NativeWebTouchEvent.h"
+
+#include "WebEventFactory.h"
+
+#if ENABLE(TOUCH_EVENTS)
+
+namespace WebKit {
+
+NativeWebTouchEvent::NativeWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const Evas_Point* position, double timestamp)
+ : WebTouchEvent(WebEventFactory::createWebTouchEvent(type, points, modifiers, position, timestamp))
+{
+}
+
+} // namespace WebKit
+
+#endif
Modified: trunk/Source/WebKit2/Shared/efl/WebEventFactory.cpp (128852 => 128853)
--- trunk/Source/WebKit2/Shared/efl/WebEventFactory.cpp 2012-09-18 06:34:55 UTC (rev 128852)
+++ trunk/Source/WebKit2/Shared/efl/WebEventFactory.cpp 2012-09-18 06:45:09 UTC (rev 128853)
@@ -192,4 +192,56 @@
event->timestamp);
}
+#if ENABLE(TOUCH_EVENTS)
+static inline WebEvent::Type typeForTouchEvent(Ewk_Touch_Event_Type type)
+{
+ if (type == EWK_TOUCH_START)
+ return WebEvent::TouchStart;
+ if (type == EWK_TOUCH_MOVE)
+ return WebEvent::TouchMove;
+ if (type == EWK_TOUCH_END)
+ return WebEvent::TouchEnd;
+ if (type == EWK_TOUCH_CANCEL)
+ return WebEvent::TouchCancel;
+
+ return WebEvent::NoType;
+}
+
+WebTouchEvent WebEventFactory::createWebTouchEvent(Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers, const Evas_Point* position, double timestamp)
+{
+ Vector<WebPlatformTouchPoint> touchPoints;
+ WebPlatformTouchPoint::TouchPointState state;
+ const Eina_List* list;
+ void* item;
+ EINA_LIST_FOREACH(points, list, item) {
+ Ewk_Touch_Point* point = static_cast<Ewk_Touch_Point*>(item);
+
+ switch (point->state) {
+ case EVAS_TOUCH_POINT_UP:
+ state = WebPlatformTouchPoint::TouchReleased;
+ break;
+ case EVAS_TOUCH_POINT_MOVE:
+ state = WebPlatformTouchPoint::TouchMoved;
+ break;
+ case EVAS_TOUCH_POINT_DOWN:
+ state = WebPlatformTouchPoint::TouchPressed;
+ break;
+ case EVAS_TOUCH_POINT_STILL:
+ state = WebPlatformTouchPoint::TouchStationary;
+ break;
+ case EVAS_TOUCH_POINT_CANCEL:
+ state = WebPlatformTouchPoint::TouchCancelled;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+
+ touchPoints.append(WebPlatformTouchPoint(point->id, state, IntPoint(point->x, point->y), IntPoint(point->x - position->x, point->y - position->y)));
+ }
+
+ return WebTouchEvent(typeForTouchEvent(type), touchPoints, modifiersForEvent(modifiers), timestamp);
+}
+#endif
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/Shared/efl/WebEventFactory.h (128852 => 128853)
--- trunk/Source/WebKit2/Shared/efl/WebEventFactory.h 2012-09-18 06:34:55 UTC (rev 128852)
+++ trunk/Source/WebKit2/Shared/efl/WebEventFactory.h 2012-09-18 06:45:09 UTC (rev 128853)
@@ -27,6 +27,7 @@
#define WebEventFactory_h
#include "WebEvent.h"
+#include "ewk_touch.h"
#include <Evas.h>
namespace WebKit {
@@ -39,6 +40,9 @@
static WebWheelEvent createWebWheelEvent(const Evas_Event_Mouse_Wheel*, const Evas_Point*);
static WebKeyboardEvent createWebKeyboardEvent(const Evas_Event_Key_Down*);
static WebKeyboardEvent createWebKeyboardEvent(const Evas_Event_Key_Up*);
+#if ENABLE(TOUCH_EVENTS)
+ static WebTouchEvent createWebTouchEvent(Ewk_Touch_Event_Type, const Eina_List*, const Evas_Modifier*, const Evas_Point*, double timestamp);
+#endif
};
} // namespace WebKit
Copied: trunk/Source/WebKit2/UIProcess/API/efl/ewk_touch.h (from rev 128852, trunk/Source/WebKit2/Shared/NativeWebTouchEvent.h) (0 => 128853)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_touch.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_touch.h 2012-09-18 06:45:09 UTC (rev 128853)
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * 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 ewk_touch_h
+#define ewk_touch_h
+
+#include <Evas.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/// Represents types of touch event.
+typedef enum {
+ EWK_TOUCH_START,
+ EWK_TOUCH_MOVE,
+ EWK_TOUCH_END,
+ EWK_TOUCH_CANCEL
+} Ewk_Touch_Event_Type;
+
+/// Creates a type name for _Ewk_Touch_Point.
+typedef struct _Ewk_Touch_Point Ewk_Touch_Point;
+
+/// Represents a touch point.
+struct _Ewk_Touch_Point {
+ int id; /**< identifier of the touch event */
+ int x; /**< the horizontal position of the touch event */
+ int y; /**< the vertical position of the touch event */
+ Evas_Touch_Point_State state; /**< state of the touch event */
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // ewk_touch_h