Fix for focus issue
[framework/osp/web.git] / src / controls / FWebCtrl_WebImpl.cpp
index 2b78f55..8a90585 100755 (executable)
@@ -1759,11 +1759,6 @@ OnWindowObjectFocusGained(void* pUserData, Evas_Object* pWin, void* pEvent_info)
 
                if (pImpl->IsWinFocusLost() == true)
                {
-                       if (pImpl->IsKeypadOpened() == true)
-                       {
-                               evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
-                       }
-
                        Ewk_Settings* pSettings = ewk_view_settings_get(pWebCore->GetWebNativeNode());
                        SysAssertf(pSettings, "Failed to get settings instance.");
 
@@ -1773,6 +1768,10 @@ OnWindowObjectFocusGained(void* pUserData, Evas_Object* pWin, void* pEvent_info)
 
                                evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
                        }
+                       else if (pImpl->IsKeypadOpened() == true)
+                       {
+                               evas_object_focus_set(pWebCore->GetWebNativeNode(), EINA_TRUE);
+                       }
                }
        }
 
@@ -1799,11 +1798,17 @@ OnWebNativeNodeFocusLost(void* pUserData, Evas* pCanvas, Evas_Object* pView, voi
        _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
        SysAssertf(pImpl, "Failed to request");
 
-       if (pImpl->IsWinFocusLost() == true)
-       {
-               _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
-               SysAssertf(pWebCore, "Failed to get Web core object");
+       _Web* pWebCore = dynamic_cast< _Web* >(&(pImpl->GetCore()));
+       SysAssertf(pWebCore, "Failed to get Web core object");
+
+       Eina_Rectangle leftHandle;
+       Eina_Rectangle rightHandle;
 
+       EINA_RECTANGLE_SET(&leftHandle, 0, 0, 0, 0);
+       EINA_RECTANGLE_SET(&rightHandle, 0, 0, 0, 0);
+
+       if (pImpl->IsWinFocusLost() == true && ewk_view_text_selection_range_get(pWebCore->GetWebNativeNode(), &leftHandle, &rightHandle))
+       {
                Ewk_Settings* pSettings = ewk_view_settings_get(pWebCore->GetWebNativeNode());
                SysAssertf(pSettings, "Failed to get settings instance.");