OnWebPageBlockSelected will be called just after orientation
authorSeongjun Yim <se201.yim@samsung.com>
Thu, 9 May 2013 01:31:59 +0000 (10:31 +0900)
committerSeongjun Yim <se201.yim@samsung.com>
Thu, 9 May 2013 06:46:17 +0000 (15:46 +0900)
Change-Id: I1ee1e67bfddb640469c85c4e24134749e84c2a58
Signed-off-by: Seongjun Yim <se201.yim@samsung.com>
src/controls/FWebCtrl_WebImpl.cpp
src/controls/FWebCtrl_WebImpl.h

index 8749bdf..7f5221f 100755 (executable)
@@ -1502,8 +1502,7 @@ void
 OnWebPageBlockSelected(void* pUserData, Evas_Object* pView, void* pEventInfo)
 {
        _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
-       Ewk_Text_Style* pStyle = reinterpret_cast< Ewk_Text_Style* >(pEventInfo);
-       SysAssertf(pImpl && pStyle, "Failed to request");
+       SysAssertf(pImpl, "Failed to request");
 
        if (pImpl->GetUiEventListener())
        {
@@ -1522,6 +1521,22 @@ OnWebPageBlockSelected(void* pUserData, Evas_Object* pView, void* pEventInfo)
 }
 
 
+void
+OnWebPageBlockSelectedByOrientation(void* pUserData, Evas_Object* pView, void* pEventInfo)
+{
+       _WebImpl* pImpl = reinterpret_cast< _WebImpl* >(pUserData);
+       SysAssertf(pImpl, "Failed to request");
+
+       if (!pImpl->IsOrientationChanged())
+       {
+               return;
+       }
+
+       pImpl->SetOrientationChanged(false);
+       OnWebPageBlockSelected(pUserData, pView, pEventInfo);
+}
+
+
 Eina_Bool
 OnSelectUploadFile(Evas_Object* pView, Eina_Bool multipleFile, Eina_List* pAcceptTypes, const char* pCapture, void* pUserData)
 {
@@ -2006,6 +2021,7 @@ _WebImpl::_WebImpl(Web* pWeb, Tizen::Ui::_Control* pCore)
        , __isRedirectRequested(false)
        , __isCertificateRequested(false)
        , __isCertificateConfirmed(false)
+       , __isOrientationChanged(false)
        , __keypadBounds(0, 0, 0, 0)
        , __pWebCore(null)
        , __pUserLoadingListener(null)
@@ -3391,6 +3407,7 @@ _WebImpl::SetEventListenerCallback(void) const
                evas_object_smart_callback_add(pWebNativeNode, "icon,received", OnFaviconReceived, this);
 
                evas_object_smart_callback_add(pWebNativeNode, "text,style,state", OnWebPageBlockSelected, this);
+               evas_object_smart_callback_add(pWebNativeNode, "frame,rendered", OnWebPageBlockSelectedByOrientation, this);
 
                ewk_view_open_panel_callback_set(pWebNativeNode, OnSelectUploadFile, const_cast< _WebImpl* >(this));
                Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
@@ -3468,6 +3485,7 @@ _WebImpl::RemoveEventListenerCallback(void) const
                evas_object_smart_callback_del(pWebNativeNode, "icon,received", OnFaviconReceived);
 
                evas_object_smart_callback_del(pWebNativeNode, "text,style,state", OnWebPageBlockSelected);
+               evas_object_smart_callback_del(pWebNativeNode, "frame,rendered", OnWebPageBlockSelectedByOrientation);
 
                ewk_view_open_panel_callback_set(null, null, null);
                Ewk_Context* pContext = ewk_view_context_get(pWebNativeNode);
@@ -3532,6 +3550,7 @@ void
 _WebImpl::ReleaseBlock(void)
 {
        ewk_view_command_execute(__pWebCore->GetWebNativeNode(), "Unselect", 0);
+//     ewk_view_text_selection_range_clear(__pWebCore->GetWebNativeNode());
 }
 
 
@@ -3712,6 +3731,20 @@ _WebImpl::IsCertificateConfirmed(void) const
 }
 
 
+void
+_WebImpl::SetOrientationChanged(bool arg)
+{
+       __isOrientationChanged = arg;
+}
+
+
+bool
+_WebImpl::IsOrientationChanged(void) const
+{
+       return __isOrientationChanged;
+}
+
+
 result
 _WebImpl::LaunchAppControl(const IEventArg& arg)
 {
@@ -4480,6 +4513,8 @@ _WebImpl::OnChangeLayout(_ControlOrientation orientation)
        {
                __pColorPicker->ChangeLayout(orientation);
        }
+
+       __isOrientationChanged = true;
 }
 
 
index 61a1981..a5e86b9 100755 (executable)
@@ -312,6 +312,9 @@ public:
        bool IsCertificateRequested(void) const;
        bool IsCertificateConfirmed(void) const;
 
+       void SetOrientationChanged(bool arg);
+       bool IsOrientationChanged(void) const;
+
        result VibrationRequested(uint64_t duration);
        void VibrationCanceled(void);
 
@@ -413,6 +416,7 @@ private:
        bool __isRedirectRequested;
        bool __isCertificateRequested;
        bool __isCertificateConfirmed;
+       bool __isOrientationChanged;
        Tizen::Graphics::Rectangle __keypadBounds;
 
        _Web* __pWebCore;