Title: [113132] trunk/Source/WebCore
- Revision
- 113132
- Author
- [email protected]
- Date
- 2012-04-03 20:15:33 -0700 (Tue, 03 Apr 2012)
Log Message
[Chromium] Out-of-process font loading garbles text
https://bugs.webkit.org/show_bug.cgi?id=83002
Reviewed by Kent Tamura.
Initialize m_CTFont by using m_cgFont in FontPlatformData when we use
out-of-process font loading.
No new tests. This problem only occurs when the user uses a third party
font management software like Font Explorer so it is difficult to add
tests.
* platform/graphics/chromium/CrossProcessFontLoading.mm:
(WebCore):
(WebCore::FontPlatformData::loadFont): If font loading fails, set null to outNSFont so that the FontPlatformData won't be used.
* platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::FontPlatformData::ctFont): Modified to return the appropriate NSFont object when the font from the browser process.
* platform/graphics/mac/FontCacheMac.mm:
(WebCore::FontCache::createFontPlatformData): Returns null when the generated FontPlatformData object doesn't have NSFont object.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (113131 => 113132)
--- trunk/Source/WebCore/ChangeLog 2012-04-04 02:56:30 UTC (rev 113131)
+++ trunk/Source/WebCore/ChangeLog 2012-04-04 03:15:33 UTC (rev 113132)
@@ -1,3 +1,25 @@
+2012-04-03 Kenichi Ishibashi <[email protected]>
+
+ [Chromium] Out-of-process font loading garbles text
+ https://bugs.webkit.org/show_bug.cgi?id=83002
+
+ Reviewed by Kent Tamura.
+
+ Initialize m_CTFont by using m_cgFont in FontPlatformData when we use
+ out-of-process font loading.
+
+ No new tests. This problem only occurs when the user uses a third party
+ font management software like Font Explorer so it is difficult to add
+ tests.
+
+ * platform/graphics/chromium/CrossProcessFontLoading.mm:
+ (WebCore):
+ (WebCore::FontPlatformData::loadFont): If font loading fails, set null to outNSFont so that the FontPlatformData won't be used.
+ * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
+ (WebCore::FontPlatformData::ctFont): Modified to return the appropriate NSFont object when the font from the browser process.
+ * platform/graphics/mac/FontCacheMac.mm:
+ (WebCore::FontCache::createFontPlatformData): Returns null when the generated FontPlatformData object doesn't have NSFont object.
+
2012-04-03 Hironori Bono <[email protected]>
Prevent spellchecking text pasted to an element having spellchecking disabled
Modified: trunk/Source/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm (113131 => 113132)
--- trunk/Source/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm 2012-04-04 02:56:30 UTC (rev 113131)
+++ trunk/Source/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm 2012-04-04 03:15:33 UTC (rev 113132)
@@ -190,8 +190,7 @@
// Parameters:
// * nsFont - The font we wish to load.
// * fontSize - point size of the font we wish to load.
-// * outNSFont - The font that was actually loaded, may be different from nsFont
-// if a fallback font was used.
+// * outNSFont - The font that was actually loaded or null if loading failed.
// * cgFont - on output this contains the CGFontRef corresponding to the NSFont
// that was picked in the end. The caller is responsible for calling
// CFRelease() on this parameter when done with it.
@@ -204,7 +203,7 @@
// Release old CGFontRef since it points at the LastResort font which we don't want.
CFRelease(cgFont);
cgFont = 0;
-
+
// Font loading was blocked by the Sandbox.
m_inMemoryFont = loadFontFromBrowserProcess(outNSFont);
if (m_inMemoryFont) {
@@ -214,10 +213,8 @@
// are consistent.
CFRetain(cgFont);
} else {
- // If we still can't load the font, then return Times,
- // rather than the LastResort font.
- outNSFont = [NSFont fontWithName:@"Times" size:fontSize];
- cgFont = CTFontCopyGraphicsFont(toCTFontRef(outNSFont), 0);
+ // If we still can't load the font, set |outNSFont| to null so that FontPlatformData won't be used.
+ outNSFont = 0;
}
}
}
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm (113131 => 113132)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm 2012-04-04 02:56:30 UTC (rev 113131)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm 2012-04-04 03:15:33 UTC (rev 113132)
@@ -261,6 +261,13 @@
if (m_CTFont)
return m_CTFont.get();
+#if PLATFORM(CHROMIUM)
+ if (m_inMemoryFont) {
+ m_CTFont.adoptCF(CTFontCreateWithGraphicsFont(m_inMemoryFont->cgFont(), m_size, 0, canSetCascadeListForCustomFont() ? cascadeToLastResortFontDescriptor() : 0));
+ return m_CTFont.get();
+ }
+#endif
+
m_CTFont = toCTFontRef(m_font);
if (m_CTFont) {
CTFontDescriptorRef fontDescriptor;
Modified: trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm (113131 => 113132)
--- trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm 2012-04-04 02:56:30 UTC (rev 113131)
+++ trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm 2012-04-04 03:15:33 UTC (rev 113132)
@@ -230,7 +230,12 @@
bool syntheticBold = isAppKitFontWeightBold(weight) && !isAppKitFontWeightBold(actualWeight);
bool syntheticOblique = (traits & NSFontItalicTrait) && !(actualTraits & NSFontItalicTrait);
- return new FontPlatformData(platformFont, size, fontDescription.usePrinterFont(), syntheticBold, syntheticOblique, fontDescription.orientation(), fontDescription.textOrientation(), fontDescription.widthVariant());
+ // FontPlatformData::font() can be null for the case of Chromium out-of-process font loading.
+ // In that case, we don't want to use the platformData.
+ OwnPtr<FontPlatformData> platformData = adoptPtr(new FontPlatformData(platformFont, size, fontDescription.usePrinterFont(), syntheticBold, syntheticOblique, fontDescription.orientation(), fontDescription.textOrientation(), fontDescription.widthVariant()));
+ if (!platformData->font())
+ return 0;
+ return platformData.leakPtr();
}
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes