Title: [93140] trunk/Source/WebCore
Revision
93140
Author
[email protected]
Date
2011-08-16 12:18:11 -0700 (Tue, 16 Aug 2011)

Log Message

Abandoned Memory: Temporary CSS Fonts May Never Be Purged
https://bugs.webkit.org/show_bug.cgi?id=66153

Reviewed by Dan Bernstein.

While a remote CSS font face is loading we fallback to a
temporary font. We don't want to retain the fallback font
because noone takes ownership of the temporary font. This
patch adds a way to get an uncached fallback font, which
plumbs the ShouldRetain enum through the different platform
implementations of getLastResortFallbackFont.

No new tests, no functional change.

* css/CSSFontFaceSource.cpp:
(WebCore::CSSFontFaceSource::getFontData):
* platform/graphics/FontCache.cpp:
(WebCore::FontCache::getNonRetainedLastResortFallbackFont):
* platform/graphics/FontCache.h:
* platform/graphics/chromium/FontCacheChromiumWin.cpp:
(WebCore::fontDataFromDescriptionAndLogFont):
(WebCore::GetLastResortFallbackFontProcData::GetLastResortFallbackFontProcData):
(WebCore::getLastResortFallbackFontProc):
(WebCore::FontCache::getLastResortFallbackFont):
* platform/graphics/chromium/FontCacheLinux.cpp:
(WebCore::FontCache::getLastResortFallbackFont):
* platform/graphics/freetype/FontCacheFreeType.cpp:
(WebCore::FontCache::getLastResortFallbackFont):
* platform/graphics/haiku/FontCacheHaiku.cpp:
(WebCore::FontCache::getLastResortFallbackFont):
* platform/graphics/mac/FontCacheMac.mm:
(WebCore::FontCache::getLastResortFallbackFont):
* platform/graphics/pango/FontCachePango.cpp:
(WebCore::FontCache::getLastResortFallbackFont):
* platform/graphics/qt/FontCacheQt.cpp:
(WebCore::FontCache::getLastResortFallbackFont):
* platform/graphics/win/FontCacheWin.cpp:
(WebCore::fontDataFromDescriptionAndLogFont):
(WebCore::FontCache::getLastResortFallbackFont):
* platform/graphics/wince/FontCacheWinCE.cpp:
* platform/graphics/wx/FontCacheWx.cpp:
(WebCore::FontCache::getLastResortFallbackFont):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (93139 => 93140)


--- trunk/Source/WebCore/ChangeLog	2011-08-16 19:12:42 UTC (rev 93139)
+++ trunk/Source/WebCore/ChangeLog	2011-08-16 19:18:11 UTC (rev 93140)
@@ -1,3 +1,48 @@
+2011-08-16  Joseph Pecoraro  <[email protected]>
+
+        Abandoned Memory: Temporary CSS Fonts May Never Be Purged
+        https://bugs.webkit.org/show_bug.cgi?id=66153
+
+        Reviewed by Dan Bernstein.
+
+        While a remote CSS font face is loading we fallback to a
+        temporary font. We don't want to retain the fallback font
+        because noone takes ownership of the temporary font. This
+        patch adds a way to get an uncached fallback font, which
+        plumbs the ShouldRetain enum through the different platform
+        implementations of getLastResortFallbackFont.
+
+        No new tests, no functional change.
+
+        * css/CSSFontFaceSource.cpp:
+        (WebCore::CSSFontFaceSource::getFontData):
+        * platform/graphics/FontCache.cpp:
+        (WebCore::FontCache::getNonRetainedLastResortFallbackFont):
+        * platform/graphics/FontCache.h:
+        * platform/graphics/chromium/FontCacheChromiumWin.cpp:
+        (WebCore::fontDataFromDescriptionAndLogFont):
+        (WebCore::GetLastResortFallbackFontProcData::GetLastResortFallbackFontProcData):
+        (WebCore::getLastResortFallbackFontProc):
+        (WebCore::FontCache::getLastResortFallbackFont):
+        * platform/graphics/chromium/FontCacheLinux.cpp:
+        (WebCore::FontCache::getLastResortFallbackFont):
+        * platform/graphics/freetype/FontCacheFreeType.cpp:
+        (WebCore::FontCache::getLastResortFallbackFont):
+        * platform/graphics/haiku/FontCacheHaiku.cpp:
+        (WebCore::FontCache::getLastResortFallbackFont):
+        * platform/graphics/mac/FontCacheMac.mm:
+        (WebCore::FontCache::getLastResortFallbackFont):
+        * platform/graphics/pango/FontCachePango.cpp:
+        (WebCore::FontCache::getLastResortFallbackFont):
+        * platform/graphics/qt/FontCacheQt.cpp:
+        (WebCore::FontCache::getLastResortFallbackFont):
+        * platform/graphics/win/FontCacheWin.cpp:
+        (WebCore::fontDataFromDescriptionAndLogFont):
+        (WebCore::FontCache::getLastResortFallbackFont):
+        * platform/graphics/wince/FontCacheWinCE.cpp:
+        * platform/graphics/wx/FontCacheWx.cpp:
+        (WebCore::FontCache::getLastResortFallbackFont):
+
 2011-08-16  Alexei Svitkine  <[email protected]>
 
         Chromium Mac: Rubber banding gutter drawing

Modified: trunk/Source/WebCore/css/CSSFontFaceSource.cpp (93139 => 93140)


--- trunk/Source/WebCore/css/CSSFontFaceSource.cpp	2011-08-16 19:12:42 UTC (rev 93139)
+++ trunk/Source/WebCore/css/CSSFontFaceSource.cpp	2011-08-16 19:18:11 UTC (rev 93140)
@@ -185,7 +185,7 @@
         if (!m_loadStartTimer.isActive())
             m_loadStartTimer.startOneShot(0);
 
-        SimpleFontData* tempData = fontCache()->getLastResortFallbackFont(fontDescription);
+        SimpleFontData* tempData = fontCache()->getNonRetainedLastResortFallbackFont(fontDescription);
         fontData = adoptPtr(new SimpleFontData(tempData->platformData(), true, true));
     }
 

Modified: trunk/Source/WebCore/platform/graphics/FontCache.cpp (93139 => 93140)


--- trunk/Source/WebCore/platform/graphics/FontCache.cpp	2011-08-16 19:12:42 UTC (rev 93139)
+++ trunk/Source/WebCore/platform/graphics/FontCache.cpp	2011-08-16 19:18:11 UTC (rev 93140)
@@ -310,6 +310,11 @@
     return result.get()->second.first;
 }
 
+SimpleFontData* FontCache::getNonRetainedLastResortFallbackFont(const FontDescription& fontDescription)
+{
+    return getLastResortFallbackFont(fontDescription, DoNotRetain);
+}
+
 void FontCache::releaseFontData(const SimpleFontData* fontData)
 {
     ASSERT(gFontDataCache);

Modified: trunk/Source/WebCore/platform/graphics/FontCache.h (93139 => 93140)


--- trunk/Source/WebCore/platform/graphics/FontCache.h	2011-08-16 19:12:42 UTC (rev 93139)
+++ trunk/Source/WebCore/platform/graphics/FontCache.h	2011-08-16 19:18:11 UTC (rev 93140)
@@ -84,7 +84,8 @@
     void getTraitsInFamily(const AtomicString&, Vector<unsigned>&);
 
     SimpleFontData* getCachedFontData(const FontDescription&, const AtomicString&, bool checkingAlternateName = false, ShouldRetain = Retain);
-    SimpleFontData* getLastResortFallbackFont(const FontDescription&);
+    SimpleFontData* getLastResortFallbackFont(const FontDescription&, ShouldRetain = Retain);
+    SimpleFontData* getNonRetainedLastResortFallbackFont(const FontDescription&);
 
     void addClient(FontSelector*);
     void removeClient(FontSelector*);

Modified: trunk/Source/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp (93139 => 93140)


--- trunk/Source/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp	2011-08-16 19:12:42 UTC (rev 93139)
+++ trunk/Source/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp	2011-08-16 19:18:11 UTC (rev 93140)
@@ -325,9 +325,9 @@
 }
 
 // Tries the given font and save it |outFontFamilyName| if it succeeds.
-static SimpleFontData* fontDataFromDescriptionAndLogFont(FontCache* fontCache, const FontDescription& fontDescription, const LOGFONT& font, wchar_t* outFontFamilyName)
+static SimpleFontData* fontDataFromDescriptionAndLogFont(FontCache* fontCache, const FontDescription& fontDescription, ShouldRetain shouldRetain, const LOGFONT& font, wchar_t* outFontFamilyName)
 {
-    SimpleFontData* fontData = fontCache->getCachedFontData(fontDescription, font.lfFaceName);
+    SimpleFontData* fontData = fontCache->getCachedFontData(fontDescription, font.lfFaceName, false, shouldRetain);
     if (fontData)
         memcpy(outFontFamilyName, font.lfFaceName, sizeof(font.lfFaceName));
     return fontData;
@@ -400,9 +400,10 @@
 }
 
 struct GetLastResortFallbackFontProcData {
-    GetLastResortFallbackFontProcData(FontCache* fontCache, const FontDescription* fontDescription, wchar_t* fontName)
+    GetLastResortFallbackFontProcData(FontCache* fontCache, const FontDescription* fontDescription, ShouldRetain shouldRetain, wchar_t* fontName)
         : m_fontCache(fontCache)
         , m_fontDescription(fontDescription)
+        , m_shouldRetain(shouldRetain)
         , m_fontName(fontName)
         , m_fontData(0)
     {
@@ -410,6 +411,7 @@
 
     FontCache* m_fontCache;
     const FontDescription* m_fontDescription;
+    ShouldRetain m_shouldRetain;
     wchar_t* m_fontName;
     SimpleFontData* m_fontData;
 };
@@ -417,7 +419,7 @@
 static int CALLBACK getLastResortFallbackFontProc(const LOGFONT* logFont, const TEXTMETRIC* metrics, DWORD fontType, LPARAM lParam)
 {
     GetLastResortFallbackFontProcData* procData = reinterpret_cast<GetLastResortFallbackFontProcData*>(lParam);
-    procData->m_fontData = fontDataFromDescriptionAndLogFont(procData->m_fontCache, *procData->m_fontDescription, *logFont, procData->m_fontName);
+    procData->m_fontData = fontDataFromDescriptionAndLogFont(procData->m_fontCache, *procData->m_fontDescription, procData->m_shouldRetain, *logFont, procData->m_fontName);
     return !procData->m_fontData;
 }
 
@@ -518,7 +520,7 @@
     return 0;
 }
 
-SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& description)
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& description, ShouldRetain shouldRetain)
 {
     FontDescription::GenericFamilyType generic = description.genericFamily();
 
@@ -535,7 +537,7 @@
     else if (generic == FontDescription::MonospaceFamily)
         fontStr = courierStr;
 
-    SimpleFontData* simpleFont = getCachedFontData(description, fontStr);
+    SimpleFontData* simpleFont = getCachedFontData(description, fontStr, false, shouldRetain);
     if (simpleFont)
         return simpleFont;
 
@@ -544,13 +546,13 @@
     // to a static variable and use it to prevent trying system fonts again.
     static wchar_t fallbackFontName[LF_FACESIZE] = {0};
     if (fallbackFontName[0])
-        return getCachedFontData(description, fallbackFontName);
+        return getCachedFontData(description, fallbackFontName, false, shouldRetain);
 
     // Fall back to the DEFAULT_GUI_FONT if no known Unicode fonts are available.
     if (HFONT defaultGUIFont = static_cast<HFONT>(GetStockObject(DEFAULT_GUI_FONT))) {
         LOGFONT defaultGUILogFont;
         GetObject(defaultGUIFont, sizeof(defaultGUILogFont), &defaultGUILogFont);
-        if (simpleFont = fontDataFromDescriptionAndLogFont(this, description, defaultGUILogFont, fallbackFontName))
+        if (simpleFont = fontDataFromDescriptionAndLogFont(this, description, shouldRetain, defaultGUILogFont, fallbackFontName))
             return simpleFont;
     }
 
@@ -558,15 +560,15 @@
     NONCLIENTMETRICS nonClientMetrics = {0};
     nonClientMetrics.cbSize = sizeof(nonClientMetrics);
     if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(nonClientMetrics), &nonClientMetrics, 0)) {
-        if (simpleFont = fontDataFromDescriptionAndLogFont(this, description, nonClientMetrics.lfMessageFont, fallbackFontName))
+        if (simpleFont = fontDataFromDescriptionAndLogFont(this, description, shouldRetain, nonClientMetrics.lfMessageFont, fallbackFontName))
             return simpleFont;
-        if (simpleFont = fontDataFromDescriptionAndLogFont(this, description, nonClientMetrics.lfMenuFont, fallbackFontName))
+        if (simpleFont = fontDataFromDescriptionAndLogFont(this, description, shouldRetain, nonClientMetrics.lfMenuFont, fallbackFontName))
             return simpleFont;
-        if (simpleFont = fontDataFromDescriptionAndLogFont(this, description, nonClientMetrics.lfStatusFont, fallbackFontName))
+        if (simpleFont = fontDataFromDescriptionAndLogFont(this, description, shouldRetain, nonClientMetrics.lfStatusFont, fallbackFontName))
             return simpleFont;
-        if (simpleFont = fontDataFromDescriptionAndLogFont(this, description, nonClientMetrics.lfCaptionFont, fallbackFontName))
+        if (simpleFont = fontDataFromDescriptionAndLogFont(this, description, shouldRetain, nonClientMetrics.lfCaptionFont, fallbackFontName))
             return simpleFont;
-        if (simpleFont = fontDataFromDescriptionAndLogFont(this, description, nonClientMetrics.lfSmCaptionFont, fallbackFontName))
+        if (simpleFont = fontDataFromDescriptionAndLogFont(this, description, shouldRetain, nonClientMetrics.lfSmCaptionFont, fallbackFontName))
             return simpleFont;
     }
 
@@ -577,7 +579,7 @@
     // returned by this EnumFontFamilies() call.
     HDC dc = GetDC(0);
     if (dc) {
-        GetLastResortFallbackFontProcData procData(this, &description, fallbackFontName);
+        GetLastResortFallbackFontProcData procData(this, &description, shouldRetain, fallbackFontName);
         EnumFontFamilies(dc, 0, getLastResortFallbackFontProc, reinterpret_cast<LPARAM>(&procData));
         ReleaseDC(0, dc);
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/FontCacheLinux.cpp (93139 => 93140)


--- trunk/Source/WebCore/platform/graphics/chromium/FontCacheLinux.cpp	2011-08-16 19:12:42 UTC (rev 93139)
+++ trunk/Source/WebCore/platform/graphics/chromium/FontCacheLinux.cpp	2011-08-16 19:18:11 UTC (rev 93140)
@@ -72,7 +72,7 @@
     return 0;
 }
 
-SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& description)
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& description, ShouldRetain shouldRetain)
 {
     static const AtomicString sansStr("Sans");
     static const AtomicString serifStr("Serif");
@@ -93,7 +93,7 @@
     }
 
     ASSERT(fontPlatformData);
-    return getCachedFontData(fontPlatformData);
+    return getCachedFontData(fontPlatformData, shouldRetain);
 }
 
 void FontCache::getTraitsInFamily(const AtomicString& familyName,

Modified: trunk/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp (93139 => 93140)


--- trunk/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp	2011-08-16 19:12:42 UTC (rev 93139)
+++ trunk/Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp	2011-08-16 19:18:11 UTC (rev 93140)
@@ -105,12 +105,12 @@
     return 0;
 }
 
-SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription, ShouldRetain shouldRetain)
 {
     // We want to return a fallback font here, otherwise the logic preventing FontConfig
     // matches for non-fallback fonts might return 0. See isFallbackFontAllowed.
     static AtomicString timesStr("serif");
-    return getCachedFontData(fontDescription, timesStr);
+    return getCachedFontData(fontDescription, timesStr, false, shouldRetain);
 }
 
 void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector<unsigned>& traitsMasks)

Modified: trunk/Source/WebCore/platform/graphics/haiku/FontCacheHaiku.cpp (93139 => 93140)


--- trunk/Source/WebCore/platform/graphics/haiku/FontCacheHaiku.cpp	2011-08-16 19:12:42 UTC (rev 93139)
+++ trunk/Source/WebCore/platform/graphics/haiku/FontCacheHaiku.cpp	2011-08-16 19:18:11 UTC (rev 93140)
@@ -58,13 +58,13 @@
     return 0;
 }
 
-SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription, ShouldRetain shouldRetain)
 {
     font_family family;
     font_style style;
     be_plain_font->GetFamilyAndStyle(&family, &style);
     AtomicString plainFontFamily(family);
-    return getCachedFontData(fontDescription, plainFontFamily);
+    return getCachedFontData(fontDescription, plainFontFamily, false, shouldRetain);
 }
 
 FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family)

Modified: trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm (93139 => 93140)


--- trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm	2011-08-16 19:12:42 UTC (rev 93139)
+++ trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm	2011-08-16 19:18:11 UTC (rev 93140)
@@ -177,13 +177,13 @@
     return simpleFontData;
 }
 
-SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription, ShouldRetain shouldRetain)
 {
     DEFINE_STATIC_LOCAL(AtomicString, timesStr, ("Times"));
 
     // FIXME: Would be even better to somehow get the user's default font here.  For now we'll pick
     // the default that the user would get without changing any prefs.
-    SimpleFontData* simpleFontData = getCachedFontData(fontDescription, timesStr);
+    SimpleFontData* simpleFontData = getCachedFontData(fontDescription, timesStr, false, shouldRetain);
     if (simpleFontData)
         return simpleFontData;
 
@@ -192,7 +192,7 @@
     // guaranteed to be there, according to Nathan Taylor. This is good enough
     // to avoid a crash at least.
     DEFINE_STATIC_LOCAL(AtomicString, lucidaGrandeStr, ("Lucida Grande"));
-    return getCachedFontData(fontDescription, lucidaGrandeStr);
+    return getCachedFontData(fontDescription, lucidaGrandeStr, false, shouldRetain);
 }
 
 void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector<unsigned>& traitsMasks)

Modified: trunk/Source/WebCore/platform/graphics/pango/FontCachePango.cpp (93139 => 93140)


--- trunk/Source/WebCore/platform/graphics/pango/FontCachePango.cpp	2011-08-16 19:12:42 UTC (rev 93139)
+++ trunk/Source/WebCore/platform/graphics/pango/FontCachePango.cpp	2011-08-16 19:18:11 UTC (rev 93140)
@@ -45,12 +45,12 @@
     return 0;
 }
 
-SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription, ShouldRetain shouldRetain)
 {
     // FIXME: Would be even better to somehow get the user's default font here.
     // For now we'll pick the default that the user would get without changing any prefs.
     static AtomicString timesStr("Times New Roman");
-    return getCachedFontData(fontDescription, timesStr);
+    return getCachedFontData(fontDescription, timesStr, false, shouldRetain);
 }
 
 void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector<unsigned>& traitsMasks)

Modified: trunk/Source/WebCore/platform/graphics/qt/FontCacheQt.cpp (93139 => 93140)


--- trunk/Source/WebCore/platform/graphics/qt/FontCacheQt.cpp	2011-08-16 19:12:42 UTC (rev 93139)
+++ trunk/Source/WebCore/platform/graphics/qt/FontCacheQt.cpp	2011-08-16 19:18:11 UTC (rev 93140)
@@ -94,10 +94,10 @@
     return 0;
 }
 
-SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription, ShouldRetain shouldRetain)
 {
     const AtomicString fallbackFamily = QFont(fontDescription.family().family()).lastResortFamily();
-    return getCachedFontData(new FontPlatformData(fontDescription, fallbackFamily));
+    return getCachedFontData(new FontPlatformData(fontDescription, fallbackFamily), shouldRetain);
 }
 
 void FontCache::getTraitsInFamily(const AtomicString&, Vector<unsigned>&)

Modified: trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp (93139 => 93140)


--- trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp	2011-08-16 19:12:42 UTC (rev 93139)
+++ trunk/Source/WebCore/platform/graphics/win/FontCacheWin.cpp	2011-08-16 19:18:11 UTC (rev 93140)
@@ -301,20 +301,20 @@
     return 0;
 }
 
-static SimpleFontData* fontDataFromDescriptionAndLogFont(FontCache* fontCache, const FontDescription& fontDescription, const LOGFONT& font, AtomicString& outFontFamilyName)
+static SimpleFontData* fontDataFromDescriptionAndLogFont(FontCache* fontCache, const FontDescription& fontDescription, ShouldRetain shouldRetain, const LOGFONT& font, AtomicString& outFontFamilyName)
 {
     AtomicString familyName = String(font.lfFaceName, wcsnlen(font.lfFaceName, LF_FACESIZE));
-    SimpleFontData* fontData = fontCache->getCachedFontData(fontDescription, familyName);
+    SimpleFontData* fontData = fontCache->getCachedFontData(fontDescription, familyName, false, shouldRetain);
     if (fontData)
         outFontFamilyName = familyName;
     return fontData;
 }
 
-SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription, ShouldRetain shouldRetain)
 {
     DEFINE_STATIC_LOCAL(AtomicString, fallbackFontName, ());
     if (!fallbackFontName.isEmpty())
-        return getCachedFontData(fontDescription, fallbackFontName);
+        return getCachedFontData(fontDescription, fallbackFontName, false, shouldRetain);
 
     // FIXME: Would be even better to somehow get the user's default font here.  For now we'll pick
     // the default that the user would get without changing any prefs.
@@ -331,7 +331,7 @@
     };
     SimpleFontData* simpleFont;
     for (size_t i = 0; i < WTF_ARRAY_LENGTH(fallbackFonts); ++i) {
-        if (simpleFont = getCachedFontData(fontDescription, fallbackFonts[i])) {
+        if (simpleFont = getCachedFontData(fontDescription, fallbackFonts[i]), false, shouldRetain) {
             fallbackFontName = fallbackFonts[i];
             return simpleFont;
         }
@@ -341,7 +341,7 @@
     if (HFONT defaultGUIFont = static_cast<HFONT>(GetStockObject(DEFAULT_GUI_FONT))) {
         LOGFONT defaultGUILogFont;
         GetObject(defaultGUIFont, sizeof(defaultGUILogFont), &defaultGUILogFont);
-        if (simpleFont = fontDataFromDescriptionAndLogFont(this, fontDescription, defaultGUILogFont, fallbackFontName))
+        if (simpleFont = fontDataFromDescriptionAndLogFont(this, fontDescription, shouldRetain, defaultGUILogFont, fallbackFontName))
             return simpleFont;
     }
 
@@ -349,15 +349,15 @@
     NONCLIENTMETRICS nonClientMetrics = {0};
     nonClientMetrics.cbSize = sizeof(nonClientMetrics);
     if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(nonClientMetrics), &nonClientMetrics, 0)) {
-        if (simpleFont = fontDataFromDescriptionAndLogFont(this, fontDescription, nonClientMetrics.lfMessageFont, fallbackFontName))
+        if (simpleFont = fontDataFromDescriptionAndLogFont(this, fontDescription, shouldRetain, nonClientMetrics.lfMessageFont, fallbackFontName))
             return simpleFont;
-        if (simpleFont = fontDataFromDescriptionAndLogFont(this, fontDescription, nonClientMetrics.lfMenuFont, fallbackFontName))
+        if (simpleFont = fontDataFromDescriptionAndLogFont(this, fontDescription, shouldRetain, nonClientMetrics.lfMenuFont, fallbackFontName))
             return simpleFont;
-        if (simpleFont = fontDataFromDescriptionAndLogFont(this, fontDescription, nonClientMetrics.lfStatusFont, fallbackFontName))
+        if (simpleFont = fontDataFromDescriptionAndLogFont(this, fontDescription, shouldRetain, nonClientMetrics.lfStatusFont, fallbackFontName))
             return simpleFont;
-        if (simpleFont = fontDataFromDescriptionAndLogFont(this, fontDescription, nonClientMetrics.lfCaptionFont, fallbackFontName))
+        if (simpleFont = fontDataFromDescriptionAndLogFont(this, fontDescription, shouldRetain, nonClientMetrics.lfCaptionFont, fallbackFontName))
             return simpleFont;
-        if (simpleFont = fontDataFromDescriptionAndLogFont(this, fontDescription, nonClientMetrics.lfSmCaptionFont, fallbackFontName))
+        if (simpleFont = fontDataFromDescriptionAndLogFont(this, fontDescription, shouldRetain, nonClientMetrics.lfSmCaptionFont, fallbackFontName))
             return simpleFont;
     }
     

Modified: trunk/Source/WebCore/platform/graphics/wince/FontCacheWinCE.cpp (93139 => 93140)


--- trunk/Source/WebCore/platform/graphics/wince/FontCacheWinCE.cpp	2011-08-16 19:12:42 UTC (rev 93139)
+++ trunk/Source/WebCore/platform/graphics/wince/FontCacheWinCE.cpp	2011-08-16 19:18:11 UTC (rev 93140)
@@ -321,11 +321,11 @@
     return 0;
 }
 
-SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDesc)
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDesc, ShouldRetain shouldRetain)
 {
     // FIXME: Would be even better to somehow get the user's default font here.  For now we'll pick
     // the default that the user would get without changing any prefs.
-    return getCachedFontData(fontDesc, FontPlatformData::defaultFontFamily());
+    return getCachedFontData(fontDesc, FontPlatformData::defaultFontFamily(), false, shouldRetain);
 }
 
 FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontDescription, const AtomicString& family)

Modified: trunk/Source/WebCore/platform/graphics/wx/FontCacheWx.cpp (93139 => 93140)


--- trunk/Source/WebCore/platform/graphics/wx/FontCacheWx.cpp	2011-08-16 19:12:42 UTC (rev 93139)
+++ trunk/Source/WebCore/platform/graphics/wx/FontCacheWx.cpp	2011-08-16 19:18:11 UTC (rev 93140)
@@ -77,7 +77,7 @@
     return simpleFontData;
 }
 
-SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription)
+SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& fontDescription, ShouldRetain shouldRetain)
 {
     // FIXME: Would be even better to somehow get the user's default font here.  For now we'll pick
     // the default that the user would get without changing any prefs.
@@ -87,7 +87,7 @@
 #else
     static AtomicString fallbackName("Times New Roman");
 #endif
-    fallback = getCachedFontData(fontDescription, fallbackName);
+    fallback = getCachedFontData(fontDescription, fallbackName, false, shouldRetain);
     ASSERT(fallback);
     
     return fallback;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to