summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/GlyphPageTreeNode.cpp
diff options
context:
space:
mode:
authorRussell Brenner <russellbrenner@google.com>2012-03-01 17:32:32 -0800
committerRussell Brenner <russellbrenner@google.com>2012-03-14 12:53:32 -0700
commit852a85ba96877ec81137d97c77bce0afb3634968 (patch)
tree9c7d33c9e9968b0b1eb6b5e4a84dad1ca79e247e /Source/WebCore/platform/graphics/GlyphPageTreeNode.cpp
parentd487c56b47c747d3e331ee1892e4c0473363afd2 (diff)
downloadexternal_webkit-852a85ba96877ec81137d97c77bce0afb3634968.zip
external_webkit-852a85ba96877ec81137d97c77bce0afb3634968.tar.gz
external_webkit-852a85ba96877ec81137d97c77bce0afb3634968.tar.bz2
Refresh fonts when system locale is changed
When content is cleared, check for locale change and flush internal font caches, if necessary. Bug: 5873170 Change-Id: Ifba52e6e827444b41d08f1ca08c3b6f2c9d87462
Diffstat (limited to 'Source/WebCore/platform/graphics/GlyphPageTreeNode.cpp')
-rw-r--r--Source/WebCore/platform/graphics/GlyphPageTreeNode.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/Source/WebCore/platform/graphics/GlyphPageTreeNode.cpp b/Source/WebCore/platform/graphics/GlyphPageTreeNode.cpp
index 951cf56..126b3b4 100644
--- a/Source/WebCore/platform/graphics/GlyphPageTreeNode.cpp
+++ b/Source/WebCore/platform/graphics/GlyphPageTreeNode.cpp
@@ -47,12 +47,19 @@ GlyphPageTreeNode* GlyphPageTreeNode::pageZeroRoot = 0;
GlyphPageTreeNode* GlyphPageTreeNode::getRoot(unsigned pageNumber)
{
+#if !PLATFORM(ANDROID)
static bool initialized;
if (!initialized) {
initialized = true;
roots = new HashMap<int, GlyphPageTreeNode*>;
pageZeroRoot = new GlyphPageTreeNode;
}
+#else
+ if (!roots)
+ roots = new HashMap<int, GlyphPageTreeNode*>;
+ if (!pageZeroRoot)
+ pageZeroRoot = new GlyphPageTreeNode;
+#endif
GlyphPageTreeNode* node = pageNumber ? roots->get(pageNumber) : pageZeroRoot;
if (!node) {
@@ -68,6 +75,29 @@ GlyphPageTreeNode* GlyphPageTreeNode::getRoot(unsigned pageNumber)
return node;
}
+#if PLATFORM(ANDROID)
+void GlyphPageTreeNode::resetRoots()
+{
+ if (roots) {
+ HashMap<int, GlyphPageTreeNode*>::iterator end = roots->end();
+ for (HashMap<int, GlyphPageTreeNode*>::iterator it = roots->begin(); it != end; ++it)
+ it->second->resetChildren();
+ }
+ if (pageZeroRoot) {
+ pageZeroRoot->resetChildren();
+ }
+}
+
+void GlyphPageTreeNode::resetChildren()
+{
+ HashMap<const FontData*, GlyphPageTreeNode*>::const_iterator end = m_children.end();
+ for (HashMap<const FontData*, GlyphPageTreeNode*>::const_iterator it = m_children.begin(); it != end; ++it) {
+ pruneTreeFontData(static_cast<const SimpleFontData*>(it->first));
+ pruneTreeCustomFontData(it->first);
+ }
+}
+#endif
+
size_t GlyphPageTreeNode::treeGlyphPageCount()
{
size_t count = 0;
@@ -347,7 +377,11 @@ GlyphPageTreeNode* GlyphPageTreeNode::getChild(const FontData* fontData, unsigne
void GlyphPageTreeNode::pruneCustomFontData(const FontData* fontData)
{
+#if !PLATFORM(ANDROID)
if (!fontData || !m_customFontCount)
+#else
+ if (!fontData || !m_customFontCount || fontData == (SimpleFontData*)-1)
+#endif
return;
// Prune any branch that contains this FontData.
@@ -371,7 +405,11 @@ void GlyphPageTreeNode::pruneCustomFontData(const FontData* fontData)
void GlyphPageTreeNode::pruneFontData(const SimpleFontData* fontData, unsigned level)
{
ASSERT(fontData);
+#if !PLATFORM(ANDROID)
if (!fontData)
+#else
+ if (!fontData || fontData == (SimpleFontData*)-1)
+#endif
return;
// Prune any branch that contains this FontData.