Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1101)

Unified Diff: third_party/WebKit/Source/platform/fonts/FontCache.cpp

Issue 2692803005: Avoid checking family name in getLastResortFallbackFont() on Windows (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 5eddfddc66b58cf86267e23da94bef5adbed27b2..b3b3f17dcde0ec767ea87032108cb73d0b6b2243 100644
--- a/third_party/WebKit/Source/platform/fonts/FontCache.cpp
+++ b/third_party/WebKit/Source/platform/fonts/FontCache.cpp
@@ -110,14 +110,14 @@ FontPlatformData* FontCache::systemFontPlatformData(
DCHECK(!family.isEmpty() && family != FontFamilyNames::system_ui);
#endif
return getFontPlatformData(fontDescription, FontFaceCreationParams(family),
- true);
+ AlternateFontName::NoAlternate);
}
#endif
FontPlatformData* FontCache::getFontPlatformData(
const FontDescription& fontDescription,
const FontFaceCreationParams& creationParams,
- bool checkingAlternateName) {
+ AlternateFontName alternateFontName) {
if (!gFontPlatformDataCache) {
gFontPlatformDataCache = new FontPlatformDataCache;
platformInit();
@@ -158,18 +158,20 @@ FontPlatformData* FontCache::getFontPlatformData(
auto addResult = sizedFonts->insert(roundedSize, nullptr);
std::unique_ptr<FontPlatformData>* found = &addResult.storedValue->value;
if (addResult.isNewEntry) {
- if (wasEmpty)
- *found = createFontPlatformData(fontDescription, creationParams, size);
- else if (anotherSize)
+ if (wasEmpty) {
+ *found = createFontPlatformData(fontDescription, creationParams, size,
+ alternateFontName);
+ } else if (anotherSize) {
*found = scaleFontPlatformData(*anotherSize, fontDescription,
creationParams, size);
+ }
}
result = found->get();
foundResult = result || !addResult.isNewEntry;
}
- if (!foundResult && !checkingAlternateName &&
+ if (!foundResult && alternateFontName != AlternateFontName::NoAlternate &&
creationParams.creationType() == CreateFontByFamily) {
// We were unable to find a font. We have a small set of fonts that we alias
// to other names, e.g., Arial/Helvetica, Courier/Courier New, etc. Try
@@ -178,8 +180,8 @@ FontPlatformData* FontCache::getFontPlatformData(
alternateFamilyName(creationParams.family());
if (!alternateName.isEmpty()) {
FontFaceCreationParams createByAlternateFamily(alternateName);
- result =
- getFontPlatformData(fontDescription, createByAlternateFamily, true);
+ result = getFontPlatformData(fontDescription, createByAlternateFamily,
+ AlternateFontName::NoAlternate);
}
if (result) {
// Cache the result under the old name.
@@ -265,12 +267,12 @@ static FontDataCache* gFontDataCache = 0;
PassRefPtr<SimpleFontData> FontCache::getFontData(
const FontDescription& fontDescription,
const AtomicString& family,
- bool checkingAlternateName,
+ AlternateFontName alternameFontName,
ShouldRetain shouldRetain) {
if (FontPlatformData* platformData = getFontPlatformData(
fontDescription, FontFaceCreationParams(
adjustFamilyNameToAvoidUnsupportedFonts(family)),
- checkingAlternateName)) {
+ alternameFontName)) {
return fontDataFromFontPlatformData(
platformData, shouldRetain, fontDescription.subpixelAscentDescent());
}
@@ -295,11 +297,10 @@ PassRefPtr<SimpleFontData> FontCache::fontDataFromFontPlatformData(
bool FontCache::isPlatformFontAvailable(const FontDescription& fontDescription,
const AtomicString& family) {
- bool checkingAlternateName = true;
return getFontPlatformData(
fontDescription,
FontFaceCreationParams(adjustFamilyNameToAvoidUnsupportedFonts(family)),
- checkingAlternateName);
+ AlternateFontName::NoAlternate);
}
String FontCache::firstAvailableOrFirst(const String& families) {
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/FontCache.h ('k') | third_party/WebKit/Source/platform/fonts/mac/FontCacheMac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698