Invalidate FontCache in certain cases.
authorSeungSeop Park <sns.park@samsung.com>
Fri, 7 Feb 2014 06:46:01 +0000 (15:46 +0900)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
When the system font changes, we need to be able to clear the font cache
so that the new font is properly loaded. This patch adds an API for that,
which is in turn exposed by the EFL API.

Change-Id: Icc2464076d5d89b3849f82c389c7e14a55cedb23
Signed-off-by: Tomasz Olszak <t.olszak@samsung.com>
Conflicts:
src/third_party/WebKit/Source/platform/fonts/FontCache.h
src/third_party/WebKit/Source/web/WebFontCache.cpp
src/third_party/WebKit/public/web/WebFontCache.h

tizen_src/impl/renderer/render_process_observer_efl.cc
tizen_src/impl/renderer/render_view_observer_efl.cc

index 1b9669d..eff09e0 100644 (file)
@@ -3,15 +3,17 @@
 #include "base/allocator/allocator_extension.h"
 #include "content/public/renderer/render_thread.h"
 #include "third_party/WebKit/public/web/WebCache.h"
-#include "third_party/WebKit/public/web/WebCrossOriginPreflightResultCache.h"
-#include "third_party/WebKit/public/web/WebFontCache.h"
 #include "third_party/sqlite/sqlite3.h"
 #include "v8/include/v8.h"
 #include "renderer/content_renderer_client_efl.h"
 
+// XXX:  config.h needs to be included before internal blink headers.
+// XXX2: It'd be great if we did not include internal blibk headers.
+#include "third_party/WebKit/Source/config.h"
+#include "third_party/WebKit/Source/platform/fonts/FontCache.h"
+
+
 using blink::WebCache;
-using blink::WebFontCache;
-using blink::WebCrossOriginPreflightResultCache;
 using content::RenderThread;
 
 bool RenderProcessObserverEfl::OnControlMessageReceived(const IPC::Message& message)
@@ -69,9 +71,7 @@ void RenderProcessObserverEfl::OnPurgeMemory()
   // freed).
   OnClearCache();
   // Clear the font/glyph cache.
-  WebFontCache::clear();
-  // Clear the Cross-Origin Preflight cache.
-  blink::WebCrossOriginPreflightResultCache::clear();
+  WebCore::FontCache::fontCache()->invalidate();
   // TODO(pk): currently web process not linking sqlite. when used this should enable
   // Release all freeable memory from the SQLite process-global page cache (a
   // low-level object which backs the Connection-specific page caches).
index d4a0e61..64003d2 100644 (file)
 #include "third_party/WebKit/public/web/WebDocument.h"
 #include "third_party/WebKit/public/web/WebElement.h"
 #include "third_party/WebKit/public/web/WebFrame.h"
-#include "third_party/WebKit/public/web/WebFontCache.h"
 #include "third_party/WebKit/public/web/WebFrame.h"
 #include "third_party/WebKit/public/web/WebHitTestResult.h"
 #include "third_party/WebKit/public/web/WebPageSerializer.h"
 #include "third_party/WebKit/public/web/WebView.h"
 #include "third_party/WebKit/public/web/WebNodeList.h"
 
+// XXX: config.h needs to be included before internal blink headers.
+//      It'd be great if we did not include not internal blibk headers.
+#include "third_party/WebKit/Source/config.h"
+#include "third_party/WebKit/Source/platform/fonts/FontCache.h"
+
 namespace {
 
 bool GetGRBAValuesFromString(const std::string& input, int* r, int* g, int* b, int* a)
@@ -64,11 +68,11 @@ void PopulateEwkHitTestData(const blink::WebHitTestResult& web_hit_test, Ewk_Hit
 
   int context = EWK_HIT_TEST_RESULT_CONTEXT_DOCUMENT;
   if (!web_hit_test.absoluteLinkURL().isEmpty())
-    context |= EWK_HIT_TEST_RESULT_CONTEXT_LINK;
+    context |= TW_HIT_TEST_RESULT_CONTEXT_LINK;
   if (!web_hit_test.absoluteImageURL().isEmpty())
-    context |= EWK_HIT_TEST_RESULT_CONTEXT_IMAGE;
+    context |= TW_HIT_TEST_RESULT_CONTEXT_IMAGE;
   if (!web_hit_test.absoluteMediaURL().isEmpty())
-    context |= EWK_HIT_TEST_RESULT_CONTEXT_MEDIA;;
+    context |= TW_HIT_TEST_RESULT_CONTEXT_MEDIA;;
   if (web_hit_test.isSelected())
     context |= EWK_HIT_TEST_RESULT_CONTEXT_SELECTION;
   if (web_hit_test.isContentEditable())
@@ -179,8 +183,7 @@ void RenderViewObserverEfl::OnSetScroll(int x, int y)
 
 void RenderViewObserverEfl::OnUseSettingsFont()
 {
-  if (!blink::WebFontCache::clearIfContainsTizenSystemFont())
-    return;
+  WebCore::FontCache::fontCache()->invalidate();
 
   blink::WebView* view = render_view()->GetWebView();
   if (view)