summaryrefslogtreecommitdiffstats
path: root/Source/WebCore
diff options
context:
space:
mode:
authorRussell Brenner <russellbrenner@google.com>2011-11-10 10:26:01 -0800
committerRussell Brenner <russellbrenner@google.com>2011-11-10 10:26:01 -0800
commit9a8b7dbf90de0fbc2d8130085e972f2e5be08269 (patch)
tree300c583d7ef7b09d63712e15e3168f4160bab826 /Source/WebCore
parent18fd4aa8bd0916d80e7f03fff1942ae5bbd2fa7e (diff)
parent5d8f08b924be7ee27891cda15c51ed2b5e20753c (diff)
downloadexternal_webkit-9a8b7dbf90de0fbc2d8130085e972f2e5be08269.zip
external_webkit-9a8b7dbf90de0fbc2d8130085e972f2e5be08269.tar.gz
external_webkit-9a8b7dbf90de0fbc2d8130085e972f2e5be08269.tar.bz2
resolved conflicts for merge of 5d8f08b9 to master
Change-Id: Idc88ff5f613a7c8f771b067f4a01967a32ede276
Diffstat (limited to 'Source/WebCore')
-rw-r--r--Source/WebCore/platform/graphics/android/FontAndroid.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/Source/WebCore/platform/graphics/android/FontAndroid.cpp b/Source/WebCore/platform/graphics/android/FontAndroid.cpp
index 13d276a..d435ad7 100644
--- a/Source/WebCore/platform/graphics/android/FontAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/FontAndroid.cpp
@@ -59,6 +59,9 @@ using namespace android;
namespace WebCore {
+typedef std::pair<int, float> FallbackFontKey;
+typedef HashMap<FallbackFontKey, FontPlatformData*> FallbackHash;
+
static void updateForFont(SkPaint* paint, const SimpleFontData* font) {
font->platformData().setupPaint(paint);
paint->setTextEncoding(SkPaint::kGlyphID_TextEncoding);
@@ -456,7 +459,6 @@ private:
};
static const char* paths[NUM_SCRIPTS];
- static const FontPlatformData* s_fallbackPlatformData[NUM_SCRIPTS];
void setupFontForScriptRun();
const FontPlatformData* setupComplexFont(CustomScript script,
@@ -514,9 +516,6 @@ const char* TextRunWalker::paths[] = {
"/system/fonts/DroidSansThai.ttf"
};
-// Indexed using enum CustomScript
-const FontPlatformData* TextRunWalker::s_fallbackPlatformData[] = {};
-
TextRunWalker::TextRunWalker(const TextRun& run, unsigned startingX, unsigned startingY, const Font* font)
: m_font(font)
, m_startingX(startingX)
@@ -674,17 +673,23 @@ const FontPlatformData* TextRunWalker::setupComplexFont(
CustomScript script,
const FontPlatformData& platformData)
{
- if (!s_fallbackPlatformData[script]) {
+ static FallbackHash fallbackPlatformData;
+
+ FallbackFontKey key(script, platformData.size());
+ FontPlatformData* newPlatformData = 0;
+
+ if (!fallbackPlatformData.contains(key)) {
SkTypeface* typeface = SkTypeface::CreateFromFile(paths[script]);
- s_fallbackPlatformData[script] = new FontPlatformData(platformData, typeface);
+ newPlatformData = new FontPlatformData(platformData, typeface);
SkSafeUnref(typeface);
+ fallbackPlatformData.set(key, newPlatformData);
}
- // If we couldn't allocate a new FontPlatformData, revert to the one passed
- if (!s_fallbackPlatformData[script])
- return &platformData;
+ if (!newPlatformData)
+ newPlatformData = fallbackPlatformData.get(key);
- return s_fallbackPlatformData[script];
+ // If we couldn't allocate a new FontPlatformData, revert to the one passed
+ return newPlatformData ? newPlatformData : &platformData;
}
void TextRunWalker::setupFontForScriptRun()