[M108 Migration] Implement ewk_settings_use_system_font_set API 78/287178/9
authorBakka Uday Kiran <b.kiran@samsung.com>
Sun, 22 Jan 2023 17:54:02 +0000 (23:24 +0530)
committerBot Blink <blinkbot@samsung.com>
Mon, 23 Jan 2023 11:28:15 +0000 (11:28 +0000)
Added needed to support to control the font setting for browser.

Reference: https://review.tizen.org/gerrit/c/277844

Change-Id: I051d586183dadfa928f97415dfb246e4b32b361a
Signed-off-by: Bakka Uday Kiran <b.kiran@samsung.com>
third_party/blink/renderer/platform/fonts/font_cache.h [changed mode: 0644->0755]
third_party/blink/renderer/platform/fonts/skia/font_cache_skia.cc
tizen_src/ewk/efl_integration/eweb_view.cc
tizen_src/ewk/efl_integration/public/ewk_settings.cc

old mode 100644 (file)
new mode 100755 (executable)
index af9f3af..1d64d43
@@ -290,6 +290,11 @@ class PLATFORM_EXPORT FontCache final {
   FontCache& operator=(const FontCache&) = delete;
   ~FontCache();
 
+#if BUILDFLAG(IS_EFL)
+  void SetFontFamilyTizenBrowser() { tizen_browser_font_family = true; }
+  bool IsFontFamilyTizenBrowser() const { return tizen_browser_font_family; }
+#endif
+
  private:
   // BCP47 list used when requesting fallback font for a character.
   // inlineCapacity is set to 4: the array vector not need to hold more than 4
@@ -404,6 +409,10 @@ class PLATFORM_EXPORT FontCache final {
   void PurgePlatformFontDataCache();
   void PurgeFallbackListShaperCache();
 
+#if BUILDFLAG(IS_EFL)
+  bool tizen_browser_font_family = false;
+#endif
+
   friend class SimpleFontData;  // For fontDataFromFontPlatformData
   friend class FontFallbackList;
   friend class FontPlatformDataCache;
index 9a458ca..3bcff7b 100644 (file)
@@ -53,6 +53,9 @@
 #include "third_party/skia/include/core/SkFontMgr.h"
 #include "third_party/skia/include/core/SkStream.h"
 #include "third_party/skia/include/core/SkTypeface.h"
+#if BUILDFLAG(IS_TIZEN)
+#include "tizen_src/chromium_impl/tizen/system_info.h"
+#endif
 
 namespace blink {
 
@@ -226,6 +229,14 @@ sk_sp<SkTypeface> FontCache::CreateTypeface(
   }
 #endif  // BUILDFLAG(IS_ANDROID)
 
+#if BUILDFLAG(IS_TIZEN)
+  if (IsMobileProfile() && Get().IsFontFamilyTizenBrowser())
+    name = "SamsungOneUI";
+  else if (!name.length() || (DeprecatedEqualIgnoringCase(
+                                 String(name.data()), "standardFontFamily")))
+    name = "Tizen";
+#endif
+
 #if BUILDFLAG(IS_WIN)
   // TODO(vmpstr): Deal with paint typeface here.
   if (sideloaded_fonts_) {
index 015f775..a9f9686 100644 (file)
@@ -2057,9 +2057,15 @@ bool EWebView::RestoreFromSessionData(const char* data, unsigned length) {
 void EWebView::SetBrowserFont() {
 #if !defined(EWK_BRINGUP)  // FIXME: m94 bringup
   RenderViewHost* render_view_host = web_contents_->GetRenderViewHost();
-  if (render_view_host)
-    render_view_host->Send(
-        new EwkViewMsg_SetBrowserFont(render_view_host->GetRoutingID()));
+  if (render_view_host) {
+    IPC::Message* message =
+        new EwkViewMsg_SetBrowserFont(render_view_host->GetRoutingID());
+
+    if (render_view_host->IsRenderViewLive())
+      render_view_host->Send(message);
+    else
+      delayed_messages_.push_back(message);
+  }
 #endif
 }
 
index 8ce40cd..1a8b3e8 100644 (file)
@@ -865,8 +865,17 @@ Eina_Bool ewk_settings_legacy_font_size_enabled_get(Ewk_Settings* settings)
 
 Eina_Bool ewk_settings_use_system_font_set(Ewk_Settings* settings, Eina_Bool use)
 {
-  LOG_EWK_API_MOCKUP();
-  return false;
+  if (IsMobileProfile()) {
+    EWebView* impl = EWebView::FromEvasObject(settings->getEvasObject());
+    if (impl) {
+      if (use)
+        impl->UseSettingsFont();
+      else
+        impl->SetBrowserFont();
+      return EINA_TRUE;
+    }
+  }
+  return EINA_FALSE;
 }
 
 Eina_Bool ewk_settings_use_system_font_get(Ewk_Settings* settings)