Fix for webkit event issue
[framework/osp/web.git] / src / controls / FWebCtrl_Web.cpp
index b074756..8c268c8 100755 (executable)
@@ -347,6 +347,7 @@ _Web::_Web(void)
        , __previousTouchedPosition(0.0f, 0.0f)
        , __isFullScreenEntered(false)
        , __isRotated(false)
+       , __touchPressed(false)
 {
        SetBackgroundColor(Color(0, 0, 0, 0));
 }
@@ -719,6 +720,8 @@ _Web::SetEdgeReachedEvent(_WebEdgeType type)
 bool
 _Web::OnTouchPressed(const _Control& source, const _TouchInfo& touchInfo)
 {
+       __touchPressed = true;
+
        if (__pEflWebkit.get())
        {
                __edgeType = WEB_EDGE_NONE;
@@ -919,6 +922,8 @@ _Web::OnTouchMoved(const _Control& source, const _TouchInfo& touchInfo)
 bool
 _Web::OnTouchReleased(const _Control& source, const _TouchInfo& touchInfo)
 {
+       __touchPressed = false;
+
        SetFocused();
 
        if (__pEflWebkit.get())
@@ -1254,7 +1259,7 @@ _Web::SetFocusEnd(bool focus)
 
 
 bool
-_Web::IsFocusEnd(void)
+_Web::IsFocusEnd(void) const
 {
        return __focus;
 }
@@ -1323,4 +1328,38 @@ _Web::OnDrawFocus(void)
 }
 
 
+bool
+_Web::OnFocusLost(const _Control& source)
+{
+       _Control::OnFocusLost(*this);
+
+       if (__touchPressed == true)
+       {
+               _TouchManager* pTouchManager = _TouchManager::GetInstance();
+               SysAssertf(pTouchManager, "Failed to get touch manager.");
+
+               Point absPoint(_CoordinateSystemUtils::ConvertToInteger(pTouchManager->GetPosition(pTouchManager->GetCurrentPointId())));
+
+               Ewk_Touch_Point* pPoint = static_cast< Ewk_Touch_Point* >(calloc(1, sizeof(Ewk_Touch_Point)));
+               pPoint->id = 0;
+               pPoint->x = absPoint.x;
+               pPoint->y = absPoint.y;
+               pPoint->state = EVAS_TOUCH_POINT_CANCEL;
+
+               Eina_List* pPointList = null;
+               pPointList = eina_list_append(pPointList, pPoint);
+
+               ewk_view_feed_touch_event(GetWebNativeNode(), EWK_TOUCH_CANCEL, pPointList, null);
+
+               void* pData = null;
+               EINA_LIST_FREE(pPointList, pData)
+               free(pData);
+
+               __touchPressed = false;
+       }
+
+       return false;
+}
+
+
 }}} // Tizen::Web::Controls