Diff
Modified: trunk/Source/WebKit2/ChangeLog (129195 => 129196)
--- trunk/Source/WebKit2/ChangeLog 2012-09-21 06:20:57 UTC (rev 129195)
+++ trunk/Source/WebKit2/ChangeLog 2012-09-21 06:23:33 UTC (rev 129196)
@@ -1,3 +1,23 @@
+2012-09-20 Eunmi Lee <[email protected]>
+
+ [EFL][WK2] Add API to feed touch event.
+ https://bugs.webkit.org/show_bug.cgi?id=96903
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ The applications will use this API to feed touch event to the view
+ when they want to generate touch event from their own event processor.
+ WTR also will use this API to generate touch event with multiple touch
+ points for passing test cases of touch event in the WebKit2/EFL.
+
+ * PlatformEfl.cmake:
+ * UIProcess/API/efl/EWebKit2.h:
+ * UIProcess/API/efl/ewk_view.cpp:
+ (ewk_view_feed_touch_event):
+ * UIProcess/API/efl/ewk_view.h:
+ * UIProcess/API/efl/tests/test_ewk2_view.cpp:
+ (TEST_F):
+
2012-09-20 Patrick Gansterer <[email protected]>
Add String::numberToStringFixedWidth()
Modified: trunk/Source/WebKit2/PlatformEfl.cmake (129195 => 129196)
--- trunk/Source/WebKit2/PlatformEfl.cmake 2012-09-21 06:20:57 UTC (rev 129195)
+++ trunk/Source/WebKit2/PlatformEfl.cmake 2012-09-21 06:23:33 UTC (rev 129196)
@@ -223,6 +223,7 @@
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_navigation_policy_decision.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_popup_menu_item.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_settings.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_touch.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_url_request.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_url_response.h"
"${CMAKE_CURRENT_SOURCE_DIR}/UIProcess/API/efl/ewk_url_scheme_request.h"
Modified: trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h (129195 => 129196)
--- trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h 2012-09-21 06:20:57 UTC (rev 129195)
+++ trunk/Source/WebKit2/UIProcess/API/efl/EWebKit2.h 2012-09-21 06:23:33 UTC (rev 129196)
@@ -40,6 +40,7 @@
#include "ewk_navigation_policy_decision.h"
#include "ewk_popup_menu_item.h"
#include "ewk_settings.h"
+#include "ewk_touch.h"
#include "ewk_url_request.h"
#include "ewk_url_response.h"
#include "ewk_url_scheme_request.h"
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp (129195 => 129196)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp 2012-09-21 06:20:57 UTC (rev 129195)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp 2012-09-21 06:23:33 UTC (rev 129196)
@@ -1762,3 +1762,19 @@
return false;
#endif
}
+
+Eina_Bool ewk_view_feed_touch_event(Evas_Object* ewkView, Ewk_Touch_Event_Type type, const Eina_List* points, const Evas_Modifier* modifiers)
+{
+#if ENABLE(TOUCH_EVENTS)
+ EINA_SAFETY_ON_NULL_RETURN_VAL(points, false);
+ EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
+ EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
+
+ Evas_Point position = { smartData->view.x, smartData->view.y };
+ priv->pageProxy->handleTouchEvent(NativeWebTouchEvent(type, points, modifiers, &position, ecore_time_get()));
+
+ return true;
+#else
+ return false;
+#endif
+}
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h (129195 => 129196)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h 2012-09-21 06:20:57 UTC (rev 129195)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_view.h 2012-09-21 06:23:33 UTC (rev 129196)
@@ -75,6 +75,7 @@
#include "ewk_download_job.h"
#include "ewk_intent.h"
#include "ewk_settings.h"
+#include "ewk_touch.h"
#include "ewk_url_request.h"
#include "ewk_url_response.h"
#include "ewk_web_error.h"
@@ -692,6 +693,21 @@
*/
EAPI Eina_Bool ewk_view_color_picker_color_set(Evas_Object *o, int r, int g, int b, int a);
+/**
+ * Feeds the touch event to the view.
+ *
+ * @param o view object to feed touch event
+ * @param type the type of touch event
+ * @param points a list of points (Ewk_Touch_Point) to process
+ * @param modifiers an Evas_Modifier handle to the list of modifier keys
+ * registered in the Evas. Users can get the Evas_Modifier from the Evas
+ * using evas_key_modifier_get() and can set each modifier key using
+ * evas_key_modifier_on() and evas_key_modifier_off()
+ *
+ * @return @c EINA_TRUE on success or @c EINA_FALSE on failure
+ */
+EAPI Eina_Bool ewk_view_feed_touch_event(Evas_Object *o, Ewk_Touch_Event_Type type, const Eina_List *points, const Evas_Modifier *modifiers);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp (129195 => 129196)
--- trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp 2012-09-21 06:20:57 UTC (rev 129195)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp 2012-09-21 06:23:33 UTC (rev 129196)
@@ -25,6 +25,7 @@
#include <EWebKit2.h>
#include <Ecore.h>
#include <Eina.h>
+#include <Evas.h>
#include <gtest/gtest.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
@@ -721,4 +722,30 @@
ASSERT_TRUE(context);
ASSERT_EQ(context, ewk_view_context_get(webView()));
}
+
+TEST_F(EWK2UnitTestBase, ewk_view_feed_touch_event)
+{
+ Eina_List* points = 0;
+ Ewk_Touch_Point point1 = { 0, 0, 0, EVAS_TOUCH_POINT_DOWN };
+ Ewk_Touch_Point point2 = { 1, 0, 0, EVAS_TOUCH_POINT_DOWN };
+ points = eina_list_append(points, &point1);
+ points = eina_list_append(points, &point2);
+ ASSERT_TRUE(ewk_view_feed_touch_event(webView(), EWK_TOUCH_START, points, evas_key_modifier_get(evas_object_evas_get(webView()))));
+
+ point1.state = EVAS_TOUCH_POINT_STILL;
+ point2.x = 100;
+ point2.y = 100;
+ point2.state = EVAS_TOUCH_POINT_MOVE;
+ ASSERT_TRUE(ewk_view_feed_touch_event(webView(), EWK_TOUCH_MOVE, points, evas_key_modifier_get(evas_object_evas_get(webView()))));
+
+ point2.state = EVAS_TOUCH_POINT_UP;
+ ASSERT_TRUE(ewk_view_feed_touch_event(webView(), EWK_TOUCH_END, points, evas_key_modifier_get(evas_object_evas_get(webView()))));
+ points = eina_list_remove(points, &point2);
+
+ point1.state = EVAS_TOUCH_POINT_CANCEL;
+ ASSERT_TRUE(ewk_view_feed_touch_event(webView(), EWK_TOUCH_CANCEL, points, evas_key_modifier_get(evas_object_evas_get(webView()))));
+ points = eina_list_remove(points, &point1);
+
+ eina_list_free(points);
+}
#endif // ENABLE(INPUT_TYPE_COLOR)