apply font setting
authorSeongjun Yim <se201.yim@samsung.com>
Tue, 17 Sep 2013 10:37:02 +0000 (19:37 +0900)
committerSeongjun Yim <se201.yim@samsung.com>
Tue, 17 Sep 2013 10:42:23 +0000 (19:42 +0900)
Change-Id: Ib2bb086a04fa4215fe9ede7c6ae7c4c01088bb9e
Signed-off-by: Seongjun Yim <se201.yim@samsung.com>
src/controls/FWebCtrl_EflWebkit.cpp
src/controls/FWebCtrl_WebImpl.cpp
src/controls/inc/FWebCtrl_WebImpl.h

index a5755b6..611a321 100755 (executable)
@@ -73,6 +73,10 @@ extern const wchar_t CUSTOM_CONTENT_TABLE_NAME[] = L"customContent";
 extern const wchar_t CERTIFICATE_TABLE_NAME[] = L"certificate";
 
 
+static const wchar_t ICON_DB_DIRECTORY_PATH[] = L"data/.webkit/iconDatabase/";
+static const wchar_t ICON_DB_FILE_NAME[] = L"icon.db";
+
+
 static const int CUSTOM_DB_TABLE_COUNT= 4;
 
 
@@ -167,6 +171,12 @@ _EflWebkit::SetWebConfiguration(void) const
 
        ewk_context_certificate_file_set(pContext, pcertPath.get());
 
+       String iconPath(App::App::GetInstance()->GetAppRootPath() + ICON_DB_DIRECTORY_PATH + ICON_DB_FILE_NAME);
+       std::unique_ptr<char[]> pIconPath(_StringConverter::CopyToCharArrayN(iconPath));
+       SysTryReturn(NID_WEB_CTRL, pIconPath.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+
+       ewk_context_icon_database_path_set(pContext, pIconPath.get());
+
        r = CreateResourceDirectory();
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
index 73f8320..f3492e8 100755 (executable)
@@ -73,6 +73,7 @@
 #include <FGrp_Screen.h>
 #include <FIo_DatabaseImpl.h>
 #include <FIo_NormalFile.h>
+#include <FSys_SettingInfoImpl.h>
 #include <FSys_SystemResource.h>
 #include <FSys_VibratorImpl.h>
 #include <FUi_Control.h>
@@ -158,7 +159,7 @@ AddHttpAttributeData(const Eina_Hash* pHash, const void* pKey, void* pValue, voi
        std::unique_ptr<String> pAttrValue(new (std::nothrow) String(reinterpret_cast< char* >(pValue)));
        SysTryReturn(NID_WEB_CTRL, pAttrKey.get() && pAttrValue.get(), EINA_FALSE, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.", GetErrorMessage(E_OUT_OF_MEMORY));
 
-       SysLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", pAttrKey->GetPointer(), pAttrValue->GetPointer());
+       SysSecureLog(NID_WEB_CTRL, "The current value of key is %ls, value is %ls", pAttrKey->GetPointer(), pAttrValue->GetPointer());
 
        r = reinterpret_cast< HashMap* >(pUserData)->Add(*pAttrKey, *pAttrValue);
        SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, EINA_FALSE, r, "[%s] Propagating.", GetErrorMessage(r));
@@ -2433,7 +2434,7 @@ _WebImpl::LoadUrl(const String& url, const HttpHeader& header)
 {
        std::unique_ptr<char[]> pUrl(_StringConverter::CopyToCharArrayN(url));
        SysTryReturn(NID_WEB_CTRL, pUrl.get(), GetLastResult(), GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
-       
+
        Eina_Hash* pHttpHeader = ConvertToSlpHeaderN(header);
 
        ewk_view_url_request_set(__pWebCore->GetWebNativeNode(), pUrl.get(), EWK_HTTP_METHOD_GET, pHttpHeader, null);
@@ -4887,6 +4888,8 @@ _WebImpl::OnPreAttachedToMainTree(void)
                r = InitializeSetting();
                SysTryReturn(NID_WEB_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
+               SettingInfo::AddSettingEventListener(*this);
+
                _WebManager* pWebManager = _WebManager::GetInstance();
                pWebManager->AddWeb(reinterpret_cast< int >(this));
        }
@@ -4911,8 +4914,30 @@ _WebImpl::OnDetachingFromMainTree(void)
 
 
 void
+_WebImpl::OnSettingChanged(String& key)
+{
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
+       if (key == L"http://tizen.org/setting/font.type")
+       {
+               ewk_view_use_settings_font(pWebview);
+       }
+}
+
+
+void
 _WebImpl::OnChangeLayout(_ControlRotation rotation)
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
        int degree = 0;
 
        switch (rotation)
@@ -4932,7 +4957,7 @@ _WebImpl::OnChangeLayout(_ControlRotation rotation)
                default:
                        SysAssert(false);
        }
-       ewk_view_orientation_send(__pWebCore->GetWebNativeNode(), degree);
+       ewk_view_orientation_send(pWebview, degree);
 }
 
 
@@ -4971,16 +4996,22 @@ _WebImpl::OnChangeLayout(_ControlOrientation orientation)
 void
 _WebImpl::OnAncestorVisibleStateChanged(const _Control& control)
 {
+       Evas_Object* pWebview = __pWebCore->GetWebNativeNode();
+       if (!pWebview)
+       {
+               return;
+       }
+
        _WebManager* pWebManager = _WebManager::GetInstance();
        if (IsVisible() == true)
        {
                pWebManager->SetActiveWeb(this);
-               ewk_view_page_visibility_state_set(__pWebCore->GetWebNativeNode(), EWK_PAGE_VISIBILITY_STATE_VISIBLE, false);
+               ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_VISIBLE, false);
        }
        else
        {
                pWebManager->RemoveActiveWeb(this);
-               ewk_view_page_visibility_state_set(__pWebCore->GetWebNativeNode(), EWK_PAGE_VISIBILITY_STATE_HIDDEN, false);
+               ewk_view_page_visibility_state_set(pWebview, EWK_PAGE_VISIBILITY_STATE_HIDDEN, false);
        }
 }
 
index b48975b..828cd19 100755 (executable)
@@ -28,6 +28,7 @@
 #include <EWebKit2.h>
 #include <FBaseColArrayList.h>
 #include <FBaseString.h>
+#include <FSysISettingEventListener.h>
 #include <FUiIActionEventListener.h>
 #include <FUiIOrientationEventListener.h>
 #include <FUiITextEventListener.h>
@@ -143,6 +144,7 @@ class _OSP_EXPORT_ _WebImpl
        : public Tizen::Ui::_ContainerImpl
        , public Tizen::Ui::ITextEventListener
        , public Tizen::Web::Controls::_IWebEventListener
+       , public Tizen::System::ISettingEventListener
 {
 public:
        _WebImpl(Web* pWeb, Tizen::Ui::_Control* pCore);
@@ -447,6 +449,8 @@ private:
        result OnHandleWebUiEventF(const Tizen::Base::Runtime::IEventArg& arg);
        result OnHandleTextSearchEvent(const Tizen::Base::Runtime::IEventArg& arg);
 
+       virtual void OnSettingChanged(Tizen::Base::String& key);
+
 private:
        bool __isFooterVisible;
        bool __isKeypadVisible;