From 267e1d125a7f142262d5ce660cf7ccc3c892e70b Mon Sep 17 00:00:00 2001 From: Joone Hur Date: Thu, 9 Jan 2014 11:53:21 -0800 Subject: [PATCH] Refactoring mouse and touch events support. Touch events are delivered to webapps inconsistently so we need to press UI elements several times to make them work. This patch disables GESTURE_EVENT and TIZEN_LINK_MAGNIFIER for IVI, which may improve touch event responsiveness. In addition, it allows mouse and touch events to be generated simultaneously. This patch includes the following commit again that was reverted. https://review.tizen.org/gerrit/#/c/13438/ This patch fixes TIVI-1941, TIVI-2380, and TIVI-2082. Change-Id: I32b32021f675a566206ad563b9fba4ec799b2344 --- Source/WTF/wtf/Platform.h | 3 +- Source/WebCore/page/EventHandler.cpp | 4 +- Source/WebCore/page/EventHandler.h | 3 +- Source/WebKit2/UIProcess/API/efl/ewk_view.cpp | 8 ++-- .../UIProcess/API/efl/tizen/GestureRecognizer.cpp | 47 ---------------------- Source/WebKit2/UIProcess/WebPageProxy.cpp | 5 +++ Source/cmake/OptionsTizen.cmake | 4 +- 7 files changed, 19 insertions(+), 55 deletions(-) diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h index dbac24b..3f4395f5 100644 --- a/Source/WTF/wtf/Platform.h +++ b/Source/WTF/wtf/Platform.h @@ -329,9 +329,11 @@ #if ENABLE(TIZEN_DESKTOP_BROWSING) #define ENABLE_TIZEN_MULTIPLE_SELECT 0 #define ENABLE_TIZEN_LINK_EFFECT 0 +#define ENABLE_TIZEN_LINK_MAGNIFIER 0 #else #define ENABLE_TIZEN_MULTIPLE_SELECT 1 /*Santosh Mahto (santosh.ma@samsung.com) : enable the feature of handling select element multple selection */ #define ENABLE_TIZEN_LINK_EFFECT 1 /* Sanghyup Lee(sh53.lee@samsung.com) To beep when click link*/ +#define ENABLE_TIZEN_LINK_MAGNIFIER 1 /* Sangyong Park(sy302.park@samsung.com) : feature for link magnifier */ #endif #define ENABLE_TIZEN_WEBKIT2_POPUP_INTERNAL 1 /* Ryuan Choi(ryuan.choi@samsung.com) : popup implementation for WK2/tizen internal */ @@ -345,7 +347,6 @@ #define ENABLE_TIZEN_DOM_TIMER_MIN_INTERVAL_SET 1 /* Gyuyoung Kim(gyuyoung.kim@samsung.com) : Set minimum interval for DOMTimer */ #define ENABLE_TIZEN_ON_LOADING_REQUESTED 1 /*Sungman Kim(ssungmai.kim@samsung.com) : Callback call for signal navigation_policy,decision,requested with navigation type*/ #define ENABLE_TIZEN_CACHE_CONTROL 1 /*Sungman Kim(ssungmai.kim@samsung.com) : Control cache enable or disable mode*/ -#define ENABLE_TIZEN_LINK_MAGNIFIER 1 /* Sangyong Park(sy302.park@samsung.com) : feature for link magnifier */ /* This patch should be removed if multiple UIProcess can exist concurrently. This will be removed when libsoup can handle multiple process file concurrency problem. */ diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp index 3079c6a..1f50f3d 100755 --- a/Source/WebCore/page/EventHandler.cpp +++ b/Source/WebCore/page/EventHandler.cpp @@ -2627,14 +2627,12 @@ bool EventHandler::handleGestureTap(const PlatformGestureEvent& gestureEvent) #endif bool defaultPrevented = false; -#if !ENABLE(TIZEN_DESKTOP_BROWSING) PlatformMouseEvent fakeMouseMove(adjustedPoint, gestureEvent.globalPosition(), NoButton, PlatformEvent::MouseMoved, /* clickCount */ 0, gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey(), gestureEvent.timestamp()); PlatformMouseEvent fakeMouseDown(adjustedPoint, gestureEvent.globalPosition(), LeftButton, PlatformEvent::MousePressed, /* clickCount */ 1, gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey(), gestureEvent.timestamp()); PlatformMouseEvent fakeMouseUp(adjustedPoint, gestureEvent.globalPosition(), LeftButton, PlatformEvent::MouseReleased, /* clickCount */ 1, gestureEvent.shiftKey(), gestureEvent.ctrlKey(), gestureEvent.altKey(), gestureEvent.metaKey(), gestureEvent.timestamp()); mouseMoved(fakeMouseMove); defaultPrevented |= handleMousePressEvent(fakeMouseDown); defaultPrevented |= handleMouseReleaseEvent(fakeMouseUp); -#endif return defaultPrevented; } @@ -2699,6 +2697,7 @@ bool EventHandler::bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, co return findBestZoomableArea(targetNode, targetArea, touchCenter, touchRect, *nodeList.get()); } +#if ENABLE(GESTURE_EVENTS) bool EventHandler::adjustGesturePosition(const PlatformGestureEvent& gestureEvent, IntPoint& adjustedPoint) { Node* targetNode = 0; @@ -2716,6 +2715,7 @@ bool EventHandler::adjustGesturePosition(const PlatformGestureEvent& gestureEven return targetNode; } #endif +#endif #if ENABLE(CONTEXT_MENUS) bool EventHandler::sendContextMenuEvent(const PlatformMouseEvent& event) diff --git a/Source/WebCore/page/EventHandler.h b/Source/WebCore/page/EventHandler.h index 6380aaa..317803d 100644 --- a/Source/WebCore/page/EventHandler.h +++ b/Source/WebCore/page/EventHandler.h @@ -176,9 +176,10 @@ public: bool bestClickableNodeForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntPoint& targetPoint, Node*& targetNode); bool bestContextMenuNodeForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntPoint& targetPoint, Node*& targetNode); bool bestZoomableAreaForTouchPoint(const IntPoint& touchCenter, const IntSize& touchRadius, IntRect& targetArea, Node*& targetNode); - +#if ENABLE(GESTURE_EVENTS) bool adjustGesturePosition(const PlatformGestureEvent&, IntPoint& adjustedPoint); #endif +#endif #if ENABLE(CONTEXT_MENUS) bool sendContextMenuEvent(const PlatformMouseEvent&); diff --git a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp index e77416f..5bcc246 100644 --- a/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp +++ b/Source/WebKit2/UIProcess/API/efl/ewk_view.cpp @@ -848,7 +848,12 @@ static void _ewk_view_smart_add(Evas_Object* ewkView) evas_object_image_content_hint_set(smartData->image, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); #endif +#if ENABLE(TIZEN_DESKTOP_BROWSING) + ewk_view_mouse_events_enabled_set(ewkView, true); +#else ewk_view_mouse_events_enabled_set(ewkView, false); +#endif + ewk_view_touch_events_enabled_set(ewkView, true); // FIXME: This code should be removed if side effect occur. @@ -4098,9 +4103,6 @@ void ewk_view_touch_event_handler_result_set(Evas_Object* ewkView, WebKit::WebEv impl->focusRing->hide(); #endif // #if ENABLE(TIZEN_WEBKIT2_FOCUS_RING) - if (impl->mouseEventsEnabled()) - return; - #if ENABLE(TIZEN_WEBKIT2_TEXT_SELECTION) if (wasHandled && impl->pageClient->isTextSelectionMode()) { if (type == WebEvent::TouchStart) diff --git a/Source/WebKit2/UIProcess/API/efl/tizen/GestureRecognizer.cpp b/Source/WebKit2/UIProcess/API/efl/tizen/GestureRecognizer.cpp index 5a255bb..ea22907 100644 --- a/Source/WebKit2/UIProcess/API/efl/tizen/GestureRecognizer.cpp +++ b/Source/WebKit2/UIProcess/API/efl/tizen/GestureRecognizer.cpp @@ -26,10 +26,6 @@ #include "config.h" #include "GestureRecognizer.h" -#if ENABLE(TIZEN_DESKTOP_BROWSING) -#include "NativeWebMouseEvent.h" -#endif - #include #include @@ -90,11 +86,6 @@ GestureRecognizer::~GestureRecognizer() evas_object_del(m_gestureObject); evas_object_event_callback_del(m_viewWidget, EVAS_CALLBACK_MOUSE_UP, onMouseUp); - -#if ENABLE(TIZEN_DESKTOP_BROWSING) - evas_object_event_callback_del(m_viewWidget, EVAS_CALLBACK_MOUSE_MOVE, onMouseMove); - evas_object_event_callback_del(m_viewWidget, EVAS_CALLBACK_MOUSE_DOWN, onMouseDown); -#endif } void GestureRecognizer::initializeCallbacks() @@ -121,11 +112,6 @@ void GestureRecognizer::initializeCallbacks() // add evas callbacks. evas_object_event_callback_add(m_viewWidget, EVAS_CALLBACK_MOUSE_UP, onMouseUp, this); - -#if ENABLE(TIZEN_DESKTOP_BROWSING) - evas_object_event_callback_add(m_viewWidget, EVAS_CALLBACK_MOUSE_MOVE, onMouseMove, this); - evas_object_event_callback_add(m_viewWidget, EVAS_CALLBACK_MOUSE_DOWN, onMouseDown, this); -#endif } Evas_Event_Flags GestureRecognizer::onTapStart(void* data, void* eventInfo) @@ -208,40 +194,7 @@ void GestureRecognizer::onMouseUp(void* data, Evas*, Evas_Object* ewkView, void* { Evas_Event_Mouse_Up* event = static_cast(eventInfo); static_cast(data)->processScheduledTap(event->canvas.x, event->canvas.y, event->timestamp); - -#if ENABLE(TIZEN_DESKTOP_BROWSING) - Ewk_View_Smart_Data* smartData = 0; - smartData = (Ewk_View_Smart_Data*)evas_object_smart_data_get(ewkView); - EwkViewImpl* impl = smartData->priv; - - impl->page()->handleMouseEvent(NativeWebMouseEvent(event, impl->transformFromScene(), impl->transformToScreen())); -#endif -} - -#if ENABLE(TIZEN_DESKTOP_BROWSING) -void GestureRecognizer::onMouseDown(void* data, Evas*, Evas_Object* ewkView, void* eventInfo) -{ - Evas_Event_Mouse_Down* event = static_cast(eventInfo); - - Ewk_View_Smart_Data* smartData = 0; - smartData = (Ewk_View_Smart_Data*)evas_object_smart_data_get(ewkView); - EwkViewImpl* impl = smartData->priv; - - impl->page()->handleMouseEvent(NativeWebMouseEvent(event, impl->transformFromScene(), impl->transformToScreen())); - -} - -void GestureRecognizer::onMouseMove(void* data, Evas*, Evas_Object* ewkView, void* eventInfo) -{ - Evas_Event_Mouse_Move* event = static_cast(eventInfo); - - Ewk_View_Smart_Data* smartData = 0; - smartData = (Ewk_View_Smart_Data*)evas_object_smart_data_get(ewkView); - EwkViewImpl* impl = smartData->priv; - - impl->page()->handleMouseEvent(NativeWebMouseEvent(event, impl->transformFromScene(), impl->transformToScreen())); } -#endif void GestureRecognizer::startTap(Elm_Gesture_Taps_Info* event) { diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp index 959cf9f..14940cf 100755 --- a/Source/WebKit2/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp @@ -1305,6 +1305,7 @@ void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent& event) #else if (m_needTouchEvents && !m_isPageSuspended) { #endif + #if OS(TIZEN) // Do not send the TouchMove event if last TouchMove is not processed yet. // TouchMove event will be sent too many times without below codes, @@ -1314,6 +1315,7 @@ void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent& event) && m_touchEventQueue.last().forwardedEvent.type() == event.type()) return; #endif + m_touchEventQueue.append(event); process()->responsivenessTimer()->start(); if (m_shouldSendEventsSynchronously) { @@ -3733,6 +3735,9 @@ void WebPageProxy::didReceiveEvent(uint32_t opaqueType, bool handled) break; case WebEvent::MouseDown: +#if ENABLE(TIZEN_ISF_PORT) + evas_object_focus_set(viewWidget(), true); +#endif case WebEvent::MouseUp: case WebEvent::Wheel: case WebEvent::KeyDown: diff --git a/Source/cmake/OptionsTizen.cmake b/Source/cmake/OptionsTizen.cmake index 84ad8ef..a4c50da 100644 --- a/Source/cmake/OptionsTizen.cmake +++ b/Source/cmake/OptionsTizen.cmake @@ -258,7 +258,9 @@ FIND_PACKAGE(UIGadget REQUIRED) FIND_PACKAGE(VConf REQUIRED) FIND_PACKAGE(feedback REQUIRED) -ADD_DEFINITIONS(-DENABLE_GESTURE_EVENTS=1) +IF (NOT ENABLE_TIZEN_DESKTOP_BROWSING) + ADD_DEFINITIONS(-DENABLE_GESTURE_EVENTS=1) +ENDIF() ADD_DEFINITIONS(-DWTF_USE_EGL=1) ADD_DEFINITIONS(-DWTF_USE_OPENGL_ES_2=1) -- 2.7.4