Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 3 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 // Otherwise, prefer the one closer to the desired weight. | 126 // Otherwise, prefer the one closer to the desired weight. |
| 127 return candidateWeightDeltaMagnitude < chosenWeightDeltaMagnitude; | 127 return candidateWeightDeltaMagnitude < chosenWeightDeltaMagnitude; |
| 128 } | 128 } |
| 129 | 129 |
| 130 // Family name is somewhat of a misnomer here. We first attempt to find an exac t match | 130 // Family name is somewhat of a misnomer here. We first attempt to find an exac t match |
| 131 // comparing the desiredFamily to the PostScript name of the installed fonts. I f that fails | 131 // comparing the desiredFamily to the PostScript name of the installed fonts. I f that fails |
| 132 // we then do a search based on the family names of the installed fonts. | 132 // we then do a search based on the family names of the installed fonts. |
| 133 NSFont* MatchNSFontFamily(NSString* desiredFamily, NSFontTraitMask desiredTraits , FontWeight desiredWeight, float size) | 133 NSFont* MatchNSFontFamily(NSString* desiredFamily, NSFontTraitMask desiredTraits , FontWeight desiredWeight, float size) |
| 134 { | 134 { |
| 135 if ([desiredFamily isEqualToString:@"BlinkMacSystemFont"]) { | 135 if ([desiredFamily isEqualToString:@"BlinkMacSystemFont"]) { |
| 136 // On OSX 10.11, returning the default system font causes rendering | |
| 137 // problems. In the short term, return nil, which is what would be | |
| 138 // returned if "BlinkMacSystemFont" was never introduced. | |
| 139 // TODO(erikchen): Fix the rendering problems. | |
| 140 // http://crbug.com/521034. | |
| 141 if (IsOSElCapitan()) { | |
| 142 return nil; | |
| 143 } | |
| 144 | |
| 145 // On OSX 10.9, the default system font depends on the SDK version. When | 136 // On OSX 10.9, the default system font depends on the SDK version. When |
| 146 // compiled against the OSX 10.10 SDK, the font is .LucidaGrandeUI. When | 137 // compiled against the OSX 10.10 SDK, the font is .LucidaGrandeUI. When |
| 147 // compiled against the OSX 10.6 SDK, the font is Lucida Grande. Layout | 138 // compiled against the OSX 10.6 SDK, the font is Lucida Grande. Layout |
| 148 // tests don't support different expectations based on the SDK version, | 139 // tests don't support different expectations based on the SDK version, |
| 149 // so force layout tests to use "Lucida Grande". Once the 10.10 SDK | 140 // so force layout tests to use "Lucida Grande". Once the 10.10 SDK |
| 150 // switch is made, this should be changed to return .LucidaGrandeUI and | 141 // switch is made, this should be changed to return .LucidaGrandeUI and |
| 151 // the Layout Expectations should be updated. http://crbug.com/515836. | 142 // the Layout Expectations should be updated. http://crbug.com/515836. |
|
Nico
2015/09/22 21:37:51
since you're currently switching all the webkit bo
erikchen
2015/09/23 00:28:18
I'm not particularly keen on updating all of the 1
Nico
2015/09/23 00:31:25
Sure.
| |
| 152 if (LayoutTestSupport::isRunningLayoutTest() && IsOSMavericks()) { | 143 if (LayoutTestSupport::isRunningLayoutTest() && IsOSMavericks()) { |
| 153 if (desiredWeight >= blink::FontWeightBold) | 144 if (desiredWeight >= blink::FontWeightBold) |
| 154 return [NSFont fontWithName:@"Lucida Grande Bold" size:size]; | 145 return [NSFont fontWithName:@"Lucida Grande Bold" size:size]; |
| 155 else | 146 else |
| 156 return [NSFont fontWithName:@"Lucida Grande" size:size]; | 147 return [NSFont fontWithName:@"Lucida Grande" size:size]; |
| 157 } | 148 } |
| 158 | 149 |
| 159 NSFont* font = nil; | 150 NSFont* font = nil; |
| 160 if (IsOSMavericksOrEarlier()) { | 151 if (IsOSMavericksOrEarlier()) { |
| 161 // On older OSX versions, only bold and regular are available. | 152 // On older OSX versions, only bold and regular are available. |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 295 6, // FontWeight500 | 286 6, // FontWeight500 |
| 296 8, // FontWeight600 | 287 8, // FontWeight600 |
| 297 9, // FontWeight700 | 288 9, // FontWeight700 |
| 298 10, // FontWeight800 | 289 10, // FontWeight800 |
| 299 12, // FontWeight900 | 290 12, // FontWeight900 |
| 300 }; | 291 }; |
| 301 return appKitFontWeights[fontWeight]; | 292 return appKitFontWeights[fontWeight]; |
| 302 } | 293 } |
| 303 | 294 |
| 304 } // namespace blink | 295 } // namespace blink |
| OLD | NEW |