diff options
author | Feng Qian <> | 2009-04-10 18:11:29 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-04-10 18:11:29 -0700 |
commit | 8f72e70a9fd78eec56623b3a62e68f16b7b27e28 (patch) | |
tree | 181bf9a400c30a1bf34ea6d72560e8d00111d549 /WebCore/platform/graphics/FontCache.cpp | |
parent | 7ed56f225e0ade046e1c2178977f72b2d896f196 (diff) | |
download | external_webkit-8f72e70a9fd78eec56623b3a62e68f16b7b27e28.zip external_webkit-8f72e70a9fd78eec56623b3a62e68f16b7b27e28.tar.gz external_webkit-8f72e70a9fd78eec56623b3a62e68f16b7b27e28.tar.bz2 |
AI 145796: Land the WebKit merge @r42026.
Automated import of CL 145796
Diffstat (limited to 'WebCore/platform/graphics/FontCache.cpp')
-rw-r--r-- | WebCore/platform/graphics/FontCache.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/WebCore/platform/graphics/FontCache.cpp b/WebCore/platform/graphics/FontCache.cpp index 2d219be..130313d 100644 --- a/WebCore/platform/graphics/FontCache.cpp +++ b/WebCore/platform/graphics/FontCache.cpp @@ -139,8 +139,13 @@ static const AtomicString& alternateFamilyName(const AtomicString& familyName) DEFINE_STATIC_LOCAL(AtomicString, courierNew, ("Courier New")); if (equalIgnoringCase(familyName, courier)) return courierNew; +#if !PLATFORM(WIN_OS) + // On Windows, Courier New (truetype font) is always present and + // Courier is a bitmap font. So, we don't want to map Courier New to + // Courier. if (equalIgnoringCase(familyName, courierNew)) return courier; +#endif // Alias Times and Times New Roman. DEFINE_STATIC_LOCAL(AtomicString, times, ("Times")); @@ -158,6 +163,21 @@ static const AtomicString& alternateFamilyName(const AtomicString& familyName) if (equalIgnoringCase(familyName, helvetica)) return arial; +#if PLATFORM(WIN_OS) + // On Windows, bitmap fonts are blocked altogether so that we have to + // alias MS Sans Serif (bitmap font) -> Microsoft Sans Serif (truetype font) + DEFINE_STATIC_LOCAL(AtomicString, msSans, ("MS Sans Serif")); + DEFINE_STATIC_LOCAL(AtomicString, microsoftSans, ("Microsoft Sans Serif")); + if (equalIgnoringCase(familyName, msSans)) + return microsoftSans; + + // Alias MS Serif (bitmap) -> Times New Roman (truetype font). There's no + // 'Microsoft Sans Serif-equivalent' for Serif. + static AtomicString msSerif("MS Serif"); + if (equalIgnoringCase(familyName, msSerif)) + return timesNewRoman; +#endif + return emptyAtom; } @@ -216,7 +236,7 @@ struct FontDataCacheKeyTraits : WTF::GenericHashTraits<FontPlatformData> { static const bool needsDestruction = true; static const FontPlatformData& emptyValue() { - DEFINE_STATIC_LOCAL(FontPlatformData, key, ()); + DEFINE_STATIC_LOCAL(FontPlatformData, key, (0.f, false, false)); return key; } static void constructDeletedValue(FontPlatformData& slot) @@ -304,7 +324,7 @@ void FontCache::purgeInactiveFontData(int count) } Vector<FontPlatformDataCacheKey> keysToRemove; - keysToRemove.reserveCapacity(gFontPlatformDataCache->size()); + keysToRemove.reserveInitialCapacity(gFontPlatformDataCache->size()); FontPlatformDataCache::iterator platformDataEnd = gFontPlatformDataCache->end(); for (FontPlatformDataCache::iterator platformData = gFontPlatformDataCache->begin(); platformData != platformDataEnd; ++platformData) { if (platformData->second && !gFontDataCache->contains(*platformData->second)) @@ -424,7 +444,7 @@ void FontCache::invalidate() Vector<RefPtr<FontSelector> > clients; size_t numClients = gClients->size(); - clients.reserveCapacity(numClients); + clients.reserveInitialCapacity(numClients); HashSet<FontSelector*>::iterator end = gClients->end(); for (HashSet<FontSelector*>::iterator it = gClients->begin(); it != end; ++it) clients.append(*it); |