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

Side by Side Diff: Source/WebCore/platform/graphics/chromium/CrossProcessFontLoading.mm

Issue 10072004: Merge 113132 - [Chromium] Out-of-process font loading garbles text (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1025/
Patch Set: Created 8 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of the internal font implementation. 2 * This file is part of the internal font implementation.
3 * 3 *
4 * Copyright (c) 2010 Google Inc. All rights reserved. 4 * Copyright (c) 2010 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // parameter. If loading is blocked by the sandbox, the font may be loaded 183 // parameter. If loading is blocked by the sandbox, the font may be loaded
184 // cross-process. 184 // cross-process.
185 // If sandbox loading also fails, a fallback font is loaded. 185 // If sandbox loading also fails, a fallback font is loaded.
186 // 186 //
187 // Considerations: 187 // Considerations:
188 // * cgFont must be CFRelease()ed by the caller when done. 188 // * cgFont must be CFRelease()ed by the caller when done.
189 // 189 //
190 // Parameters: 190 // Parameters:
191 // * nsFont - The font we wish to load. 191 // * nsFont - The font we wish to load.
192 // * fontSize - point size of the font we wish to load. 192 // * fontSize - point size of the font we wish to load.
193 // * outNSFont - The font that was actually loaded, may be different from nsFont 193 // * outNSFont - The font that was actually loaded or null if loading failed.
194 // if a fallback font was used.
195 // * cgFont - on output this contains the CGFontRef corresponding to the NSFont 194 // * cgFont - on output this contains the CGFontRef corresponding to the NSFont
196 // that was picked in the end. The caller is responsible for calling 195 // that was picked in the end. The caller is responsible for calling
197 // CFRelease() on this parameter when done with it. 196 // CFRelease() on this parameter when done with it.
198 // * fontID - on output, the ID corresponding to nsFont. 197 // * fontID - on output, the ID corresponding to nsFont.
199 void FontPlatformData::loadFont(NSFont* nsFont, float fontSize, NSFont*& outNSFo nt, CGFontRef& cgFont) 198 void FontPlatformData::loadFont(NSFont* nsFont, float fontSize, NSFont*& outNSFo nt, CGFontRef& cgFont)
200 { 199 {
201 outNSFont = nsFont; 200 outNSFont = nsFont;
202 cgFont = CTFontCopyGraphicsFont(toCTFontRef(outNSFont), 0); 201 cgFont = CTFontCopyGraphicsFont(toCTFontRef(outNSFont), 0);
203 if (OutOfProcessFontLoadingEnabled() && outNSFont && cgFont && isLastResortF ont(cgFont)) { 202 if (OutOfProcessFontLoadingEnabled() && outNSFont && cgFont && isLastResortF ont(cgFont)) {
204 // Release old CGFontRef since it points at the LastResort font which we don't want. 203 // Release old CGFontRef since it points at the LastResort font which we don't want.
205 CFRelease(cgFont); 204 CFRelease(cgFont);
206 cgFont = 0; 205 cgFont = 0;
207 206
208 // Font loading was blocked by the Sandbox. 207 // Font loading was blocked by the Sandbox.
209 m_inMemoryFont = loadFontFromBrowserProcess(outNSFont); 208 m_inMemoryFont = loadFontFromBrowserProcess(outNSFont);
210 if (m_inMemoryFont) { 209 if (m_inMemoryFont) {
211 cgFont = m_inMemoryFont->cgFont(); 210 cgFont = m_inMemoryFont->cgFont();
212 211
213 // Need to add an extra retain so output semantics of this function 212 // Need to add an extra retain so output semantics of this function
214 // are consistent. 213 // are consistent.
215 CFRetain(cgFont); 214 CFRetain(cgFont);
216 } else { 215 } else {
217 // If we still can't load the font, then return Times, 216 // If we still can't load the font, set |outNSFont| to null so that FontPlatformData won't be used.
218 // rather than the LastResort font. 217 outNSFont = 0;
219 outNSFont = [NSFont fontWithName:@"Times" size:fontSize];
220 cgFont = CTFontCopyGraphicsFont(toCTFontRef(outNSFont), 0);
221 } 218 }
222 } 219 }
223 } 220 }
224 221
225 } // namespace WebCore 222 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698