[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 17:54:01 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit c31e55017fb071ae1735d945278ff2a23abd9c85
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Dec 2 09:54:24 2010 +0000
2010-12-02 Hironori Bono <hbono at chromium.org>
Reviewed by Darin Fisher.
[Chromium] Fix possible crashes in FontFallbackFont::determinePitch().
https://bugs.webkit.org/show_bug.cgi?id=25770
When all of "Arial", "Courier New", and "Times New Roman" fonts are corrupted,
FontCache::getLastResortFallbackFont() returns 0 and it causes this crash. To
avoid this crash, this change falls back to system fonts (Windows ensures they
are sane) as Win Safari does. Unfortunately, I don't have any ideas how I can
write a layout test for this issue because this crash happens on a PC some of
its system fonts are corrupted.
* platform/graphics/chromium/FontCacheChromiumWin.cpp:
(WebCore::fontDataFromDescriptionAndLogFont):
(WebCore::FontCache::getLastResortFallbackFont):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73116 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a5d2ec0..6598331 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-12-02 Hironori Bono <hbono at chromium.org>
+
+ Reviewed by Darin Fisher.
+
+ [Chromium] Fix possible crashes in FontFallbackFont::determinePitch().
+ https://bugs.webkit.org/show_bug.cgi?id=25770
+
+ When all of "Arial", "Courier New", and "Times New Roman" fonts are corrupted,
+ FontCache::getLastResortFallbackFont() returns 0 and it causes this crash. To
+ avoid this crash, this change falls back to system fonts (Windows ensures they
+ are sane) as Win Safari does. Unfortunately, I don't have any ideas how I can
+ write a layout test for this issue because this crash happens on a PC some of
+ its system fonts are corrupted.
+
+ * platform/graphics/chromium/FontCacheChromiumWin.cpp:
+ (WebCore::fontDataFromDescriptionAndLogFont):
+ (WebCore::FontCache::getLastResortFallbackFont):
+
2010-12-02 Dimitri Glazkov <dglazkov at chromium.org>
Reviewed by Kent Tamura.
diff --git a/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp b/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp
index 347a3fb..2ee30cc 100644
--- a/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp
+++ b/WebCore/platform/graphics/chromium/FontCacheChromiumWin.cpp
@@ -421,6 +421,15 @@ SimpleFontData* FontCache::getSimilarFontPlatformData(const Font& font)
return 0;
}
+// 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)
+{
+ SimpleFontData* fontData = fontCache->getCachedFontData(fontDescription, font.lfFaceName);
+ if (fontData)
+ memcpy(outFontFamilyName, font.lfFaceName, sizeof(font.lfFaceName));
+ return fontData;
+}
+
SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& description)
{
FontDescription::GenericFamilyType generic = description.genericFamily();
@@ -438,7 +447,43 @@ SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& desc
else if (generic == FontDescription::MonospaceFamily)
fontStr = courierStr;
- return getCachedFontData(description, fontStr);
+ SimpleFontData* simpleFont = getCachedFontData(description, fontStr);
+ if (simpleFont)
+ return simpleFont;
+
+ // Fall back to system fonts as Win Safari does because this function must
+ // return a valid font. Once we find a valid system font, we save its name
+ // 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);
+
+ // 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))
+ return simpleFont;
+ }
+
+ // Fall back to Non-client metrics fonts.
+ NONCLIENTMETRICS nonClientMetrics = {0};
+ nonClientMetrics.cbSize = sizeof(nonClientMetrics);
+ if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(nonClientMetrics), &nonClientMetrics, 0)) {
+ if (simpleFont = fontDataFromDescriptionAndLogFont(this, description, nonClientMetrics.lfMessageFont, fallbackFontName))
+ return simpleFont;
+ if (simpleFont = fontDataFromDescriptionAndLogFont(this, description, nonClientMetrics.lfMenuFont, fallbackFontName))
+ return simpleFont;
+ if (simpleFont = fontDataFromDescriptionAndLogFont(this, description, nonClientMetrics.lfStatusFont, fallbackFontName))
+ return simpleFont;
+ if (simpleFont = fontDataFromDescriptionAndLogFont(this, description, nonClientMetrics.lfCaptionFont, fallbackFontName))
+ return simpleFont;
+ if (simpleFont = fontDataFromDescriptionAndLogFont(this, description, nonClientMetrics.lfSmCaptionFont, fallbackFontName))
+ return simpleFont;
+ }
+
+ ASSERT_NOT_REACHED();
+ return 0;
}
static LONG toGDIFontWeight(FontWeight fontWeight)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list