From dbbf81998cc7142f27dafeb417549e371ec3de2e Mon Sep 17 00:00:00 2001 From: hyun lee Date: Thu, 20 Jun 2013 19:23:48 +0900 Subject: [PATCH] Modify _GestureState class Change-Id: I15f6b72c10ee439400f5b61d384fdf20f486a9b6 Signed-off-by: hyun lee --- src/controls/FWebCtrl_GestureState.cpp | 54 +++++++++++++++++++++------------- src/controls/FWebCtrl_GestureState.h | 2 ++ 2 files changed, 35 insertions(+), 21 deletions(-) mode change 100755 => 100644 src/controls/FWebCtrl_GestureState.cpp mode change 100755 => 100644 src/controls/FWebCtrl_GestureState.h diff --git a/src/controls/FWebCtrl_GestureState.cpp b/src/controls/FWebCtrl_GestureState.cpp old mode 100755 new mode 100644 index ccf94aa..15a5442 --- a/src/controls/FWebCtrl_GestureState.cpp +++ b/src/controls/FWebCtrl_GestureState.cpp @@ -66,6 +66,7 @@ _TapGestureState::_TapGestureState(_Web* pWeb) : __pWebCore(pWeb) , __longPressed(false) , __doubleTapped(false) + , __pressedPosition(0.0f, 0.0f) { } @@ -107,7 +108,8 @@ _TapGestureState::OnTouchPressed(const _Control& source, const _TouchInfo& touch const Ewk_View_Smart_Data* pSmartData = static_cast(evas_object_smart_data_get( __pWebCore->GetWebNativeNode())); SysAssertf(pSmartData, "Failed to get webkit smart data."); - Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(touchInfo.GetCurrentPosition()))); + __pressedPosition = touchInfo.GetCurrentPosition(); + Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(__pressedPosition))); Ewk_Event_Gesture gestureEvent; @@ -147,37 +149,47 @@ _TapGestureState::OnTouchReleased(const _Control& source, const _TouchInfo& touc SysAssertf(pSmartData, "Failed to get webkit smart data."); Ewk_Event_Gesture gestureEvent; - Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(touchInfo.GetCurrentPosition()))); - if (__longPressed) + if (__pWebCore->Contains(__pressedPosition)) { - Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(__pWebCore->GetWebNativeNode(), absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL); - SysTryReturn(NID_WEB_CTRL, pEwkHitTest, true, E_SYSTEM, "Failed to get hit test."); - - String tagName(ewk_hit_test_tag_name_get(pEwkHitTest)); + Point absPoint(_CoordinateSystemUtils::ConvertToInteger(__pWebCore->GetAbsoluteCoordinate(__pressedPosition))); - if (tagName.Equals(L"INPUT", false) || tagName.Equals(L"TEXTAREA", false)) + if (__longPressed) { - Eina_Rectangle leftHandle; - Eina_Rectangle rightHandle; + Ewk_Hit_Test* pEwkHitTest = ewk_view_hit_test_new(__pWebCore->GetWebNativeNode(), absPoint.x, absPoint.y, EWK_HIT_TEST_MODE_ALL); + SysTryReturn(NID_WEB_CTRL, pEwkHitTest, true, E_SYSTEM, "Failed to get hit test."); - ewk_view_text_selection_range_get(__pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle); - if ((rightHandle.x == 0) && (rightHandle.y == 0)) + String tagName(ewk_hit_test_tag_name_get(pEwkHitTest)); + + Eina_Hash* pAttrHash = ewk_hit_test_attribute_hash_get(pEwkHitTest); + char* pValue = reinterpret_cast< char* >(eina_hash_find(pAttrHash, "contenteditable")); + if (tagName.Equals(L"INPUT", false) || tagName.Equals(L"TEXTAREA", false) || pValue) { - SetGestureEvent(gestureEvent, EWK_GESTURE_LONG_PRESS, absPoint, Point(0, 0), 0.0, 1); - pSmartData->api->gesture_end(const_cast(pSmartData), &gestureEvent); + Eina_Rectangle leftHandle; + Eina_Rectangle rightHandle; + + ewk_view_text_selection_range_get(__pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle); + if (((rightHandle.x + rightHandle.w) == 0) && ((rightHandle.y + rightHandle.h) == 0)) + { + SetGestureEvent(gestureEvent, EWK_GESTURE_LONG_PRESS, absPoint, Point(0, 0), 0.0, 1); + pSmartData->api->gesture_end(const_cast(pSmartData), &gestureEvent); + } } } - } - else if (__doubleTapped) - { - SetGestureEvent(gestureEvent, EWK_GESTURE_TAP, absPoint, Point(0, 0), 0.0, 2); - pSmartData->api->gesture_end(const_cast(pSmartData), &gestureEvent); + else if (__doubleTapped) + { + SetGestureEvent(gestureEvent, EWK_GESTURE_TAP, absPoint, Point(0, 0), 0.0, 2); + pSmartData->api->gesture_end(const_cast(pSmartData), &gestureEvent); + } + else + { + SetGestureEvent(gestureEvent, EWK_GESTURE_TAP, absPoint, Point(0, 0), 0.0, 1); + pSmartData->api->gesture_end(const_cast(pSmartData), &gestureEvent); + } } else { - SetGestureEvent(gestureEvent, EWK_GESTURE_TAP, absPoint, Point(0, 0), 0.0, 1); - pSmartData->api->gesture_end(const_cast(pSmartData), &gestureEvent); + OnTouchCanceled(source, touchInfo); } return true; diff --git a/src/controls/FWebCtrl_GestureState.h b/src/controls/FWebCtrl_GestureState.h old mode 100755 new mode 100644 index 9ca76f3..9c77f24 --- a/src/controls/FWebCtrl_GestureState.h +++ b/src/controls/FWebCtrl_GestureState.h @@ -72,6 +72,8 @@ private: bool __longPressed; bool __doubleTapped; + + Tizen::Graphics::FloatPoint __pressedPosition; }; -- 2.7.4