Index: third_party/WebKit/Source/platform/fonts/FontCache.cpp |
diff --git a/third_party/WebKit/Source/platform/fonts/FontCache.cpp b/third_party/WebKit/Source/platform/fonts/FontCache.cpp |
index 500a8848955c2cc658349e3bc0c815cc5ccddbb4..0b2d2612b392d566e9c73785bd4272a2e37da751 100644 |
--- a/third_party/WebKit/Source/platform/fonts/FontCache.cpp |
+++ b/third_party/WebKit/Source/platform/fonts/FontCache.cpp |
@@ -98,9 +98,20 @@ FontCache* FontCache::fontCache() { |
return &globalFontCache; |
} |
+static bool isSystemFontFamily(const FontFaceCreationParams& creationParams) { |
+#if OS(MACOSX) |
+ return creationParams.creationType() == CreateFontByFamily && |
+ (creationParams.family() == FontFamilyNames::system_ui || |
+ creationParams.family() == FontCache::legacySystemFontFamily()); |
+#else |
+ return creationParams.creationType() == CreateFontByFamily && |
+ creationParams.family() == FontFamilyNames::system_ui; |
+#endif |
+} |
+ |
FontPlatformData* FontCache::getFontPlatformData( |
const FontDescription& fontDescription, |
- const FontFaceCreationParams& creationParams, |
+ const FontFaceCreationParams& originalCreationParams, |
bool checkingAlternateName) { |
if (!gFontPlatformDataCache) { |
gFontPlatformDataCache = new FontPlatformDataCache; |
@@ -108,6 +119,10 @@ FontPlatformData* FontCache::getFontPlatformData( |
} |
float size = fontDescription.effectiveFontSize(); |
+ const FontFaceCreationParams& creationParams = |
+ isSystemFontFamily(originalCreationParams) |
+ ? FontFaceCreationParams(systemFontFamily(size)) |
+ : originalCreationParams; |
unsigned roundedSize = size * FontCacheKey::precisionMultiplier(); |
FontCacheKey key = fontDescription.cacheKey(creationParams); |
@@ -271,6 +286,12 @@ PassRefPtr<SimpleFontData> FontCache::fontDataFromFontPlatformData( |
bool FontCache::isPlatformFontAvailable(const FontDescription& fontDescription, |
const AtomicString& family) { |
+ if (family == FontFamilyNames::system_ui) |
+ return true; |
+#if OS(MACOSX) |
+ if (family == FontCache::legacySystemFontFamily()) |
+ return true; |
+#endif |
bool checkingAlternateName = true; |
return getFontPlatformData( |
fontDescription, |