Changeset 176146 in webkit
- Timestamp:
- Nov 14, 2014 4:02:57 PM (9 years ago)
- Location:
- trunk/Source
- Files:
-
- 2 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r176142 r176146 1 2014-11-14 Myles C. Maxfield <mmaxfield@apple.com> 2 3 Get rid of WebFontCache 4 https://bugs.webkit.org/show_bug.cgi?id=134752 5 6 Reviewed by Dave Hyatt. 7 8 No new tests because there is no behavior change. 9 10 * Configurations/WebCore.xcconfig: 11 * PlatformMac.cmake: 12 * WebCore.exp.in: 13 * WebCore.order: 14 * WebCore.xcodeproj/project.pbxproj: 15 * platform/graphics/mac/FontCacheMac.mm: 16 (WebCore::acceptableChoice): 17 (WebCore::betterChoice): 18 (WebCore::toTraitsMask): 19 (WebCore::desiredFamilyToAvailableFamilyDictionary): 20 (WebCore::rememberDesiredFamilyToAvailableFamilyMapping): 21 (WebCore::fontWithFamily): 22 (WebCore::invalidateFontCache): 23 (WebCore::FontCache::getTraitsInFamily): 24 (WebCore::FontCache::createFontPlatformData): 25 * platform/mac/WebFontCache.h: Removed. 26 * platform/mac/WebFontCache.mm: Removed. 27 1 28 2014-11-14 Daniel Bates <dabates@apple.com> 2 29 -
trunk/Source/WebCore/Configurations/WebCore.xcconfig
r173192 r176146 123 123 124 124 EXCLUDED_SOURCE_FILE_NAMES = $(EXCLUDED_SOURCE_FILE_NAMES_$(PLATFORM_NAME)); 125 EXCLUDED_SOURCE_FILE_NAMES_iphoneos = *.tiff *Cursor.png AccessibilityObjectMac.mm AXObjectCacheMac.mm ColorMac.mm Cursor.cpp CursorMac.mm DataTransferMac.mm EditorMac.mm EventHandlerMac.mm EventLoopMac.mm GeolocationServiceMac.mm GraphicsContext3DOpenGLES.cpp IconDatabase.cpp IconMac.mm KillRingMac.mm LocalCurrentGraphicsContext.mm MIMETypeRegistryMac.mm MediaPlayerPrivateQTKit.mm NSScrollerImpDetails.mm NetworkStateNotifierMac.cpp PasteboardMac.mm PlatformEventFactoryMac.mm PlatformMouseEventMac.mm PlatformPasteboardMac.mm PlatformScreenMac.mm PlatformSpeechSynthesizerMac.mm PluginMainThreadScheduler.cpp RunLoopMac.mm SSLKeyGeneratorMac.cpp ScrollViewMac.mm ScrollbarThemeMac.mm SharedTimerMac.mm SoundMac.mm SystemTimeMac.cpp ThemeMac.mm ThreadCheck.mm UserAgentMac.mm WebAccessibilityObjectWrapperMac.mm WebCoreSystemInterface.mm WebCoreView.m Web FontCache.mm WebVideoFullscreenController.mm WebVideoFullscreenHUDWindowController.mm WebWindowAnimation.mm WidgetMac.mm DisplayRefreshMonitorMac.cpp $(EXCLUDED_SOURCE_FILE_NAMES_FOR_TOUCH_EVENTS) $(EXCLUDED_SOURCE_FILE_NAMES_FOR_GESTURE_EVENTS);125 EXCLUDED_SOURCE_FILE_NAMES_iphoneos = *.tiff *Cursor.png AccessibilityObjectMac.mm AXObjectCacheMac.mm ColorMac.mm Cursor.cpp CursorMac.mm DataTransferMac.mm EditorMac.mm EventHandlerMac.mm EventLoopMac.mm GeolocationServiceMac.mm GraphicsContext3DOpenGLES.cpp IconDatabase.cpp IconMac.mm KillRingMac.mm LocalCurrentGraphicsContext.mm MIMETypeRegistryMac.mm MediaPlayerPrivateQTKit.mm NSScrollerImpDetails.mm NetworkStateNotifierMac.cpp PasteboardMac.mm PlatformEventFactoryMac.mm PlatformMouseEventMac.mm PlatformPasteboardMac.mm PlatformScreenMac.mm PlatformSpeechSynthesizerMac.mm PluginMainThreadScheduler.cpp RunLoopMac.mm SSLKeyGeneratorMac.cpp ScrollViewMac.mm ScrollbarThemeMac.mm SharedTimerMac.mm SoundMac.mm SystemTimeMac.cpp ThemeMac.mm ThreadCheck.mm UserAgentMac.mm WebAccessibilityObjectWrapperMac.mm WebCoreSystemInterface.mm WebCoreView.m WebVideoFullscreenController.mm WebVideoFullscreenHUDWindowController.mm WebWindowAnimation.mm WidgetMac.mm DisplayRefreshMonitorMac.cpp $(EXCLUDED_SOURCE_FILE_NAMES_FOR_TOUCH_EVENTS) $(EXCLUDED_SOURCE_FILE_NAMES_FOR_GESTURE_EVENTS); 126 126 EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(EXCLUDED_SOURCE_FILE_NAMES_iphoneos); 127 127 EXCLUDED_SOURCE_FILE_NAMES_macosx = *IOS.h *IOS.cpp *IOS.mm KillRingNone.cpp WAKAppKitStubs.h WAKClipView.h WAKResponder.h WAKScrollView.h WAKView.h WAKViewPrivate.h WAKWindow.h WKContentObservation.h WKGraphics.h WKTypes.h WKUtilities.h WKView.h WKViewPrivate.h WebCoreThread.h WebCoreThreadMessage.h WebCoreThreadRun.h WebCoreThreadSystemInterface.h $(EXCLUDED_SOURCE_FILE_NAMES_FOR_TOUCH_EVENTS) $(EXCLUDED_SOURCE_FILE_NAMES_FOR_GESTURE_EVENTS); -
trunk/Source/WebCore/PlatformMac.cmake
r172616 r176146 148 148 platform/mac/WebCoreSystemInterface.mm 149 149 platform/mac/WebCoreView.m 150 platform/mac/WebFontCache.mm151 150 platform/mac/WebNSAttributedStringExtras.mm 152 151 platform/mac/WebVideoFullscreenController.mm -
trunk/Source/WebCore/WebCore.exp.in
r176137 r176146 2282 2282 .objc_class_name_WebCoreFullScreenWarningView 2283 2283 .objc_class_name_WebCoreFullScreenWindow 2284 .objc_class_name_WebFontCache2285 2284 .objc_class_name_WebWindowFadeAnimation 2286 2285 .objc_class_name_WebWindowScaleAnimation -
trunk/Source/WebCore/WebCore.order
r176112 r176146 4722 4722 __ZN3WTF9HashTableIN7WebCore24FontPlatformDataCacheKeyENS_12KeyValuePairIS2_NS_6OwnPtrINS1_16FontPlatformDataEEEEENS_24KeyValuePairKeyExtractorIS7_EENS1_28FontPlatformDataCacheKeyHashENS_18HashMapValueTraitsINS1_30FontPlatformDataCacheKeyTraitsENS_10HashTraitsIS6_EEEESC_E6rehashEi 4723 4723 __ZN7WebCore9FontCache22createFontPlatformDataERKNS_15FontDescriptionERKN3WTF12AtomicStringE 4724 +[WebFontCache fontWithFamily:traits:weight:size:]4725 +[WebFontCache internalFontWithFamily:traits:weight:size:]4726 4724 __ZNK7WebCore14SimpleFontData9isLoadingEv 4727 4725 __ZNK7WebCore11FontMetrics35hasIdenticalAscentDescentAndLineGapERKS0_ … … 8236 8234 __ZN3WTF17HashMapTranslatorINS_18HashMapValueTraitsINS_10HashTraitsINS_6StringEEENS2_INS_6OwnPtrINS_6VectorINS_6RefPtrIN7WebCore11CSSFontFaceEEELm0ENS_15CrashOnOverflowEEEEEEEEENS_15CaseFoldingHashEE9translateINS_12KeyValuePairIS3_SD_EES3_NS_10PassOwnPtrISC_EEEEvRT_RKT0_RKT1_ 8237 8235 __ZN7WebCore9FontCache17getTraitsInFamilyERKN3WTF12AtomicStringERNS1_6VectorIjLm0ENS1_15CrashOnOverflowEEE 8238 +[WebFontCache getTraits:inFamily:]8239 8236 __ZNK7WebCore12RenderObject14nextInPreOrderEv 8240 8237 __ZNK7WebCore10RenderText16linesBoundingBoxEv … … 20523 20520 _OBJC_CLASS_$_WebCoreFullScreenWindow 20524 20521 _OBJC_METACLASS_$_WebCoreFullScreenWindow 20525 _OBJC_METACLASS_$_WebFontCache20526 _OBJC_CLASS_$_WebFontCache20527 20522 _OBJC_CLASS_$_WebGLLayer 20528 20523 _OBJC_METACLASS_$_WebGLLayer -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r176142 r176146 5202 5202 BC6D44ED0C07F2ED0072D2C9 /* JSHTMLEmbedElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6D44EB0C07F2ED0072D2C9 /* JSHTMLEmbedElement.h */; }; 5203 5203 BC6D6E2609AF943500F59759 /* ScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6D6E2509AF943500F59759 /* ScrollView.h */; settings = {ATTRIBUTES = (Private, ); }; }; 5204 BC6DADEF0A195FDF00E5CD14 /* WebFontCache.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6DADEE0A195FDF00E5CD14 /* WebFontCache.h */; settings = {ATTRIBUTES = (Private, ); }; };5205 BC6DADFA0A19602B00E5CD14 /* WebFontCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC6DADF90A19602B00E5CD14 /* WebFontCache.mm */; };5206 5204 BC74DA371013F3F7007987AD /* RGBColor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC74DA351013F3F7007987AD /* RGBColor.h */; }; 5207 5205 BC74DA381013F3F7007987AD /* RGBColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC74DA361013F3F7007987AD /* RGBColor.cpp */; }; … … 12597 12595 BC6D44EB0C07F2ED0072D2C9 /* JSHTMLEmbedElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLEmbedElement.h; sourceTree = "<group>"; }; 12598 12596 BC6D6E2509AF943500F59759 /* ScrollView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ScrollView.h; sourceTree = "<group>"; }; 12599 BC6DADEE0A195FDF00E5CD14 /* WebFontCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebFontCache.h; sourceTree = "<group>"; };12600 BC6DADF90A19602B00E5CD14 /* WebFontCache.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebFontCache.mm; sourceTree = "<group>"; };12601 12597 BC74DA351013F3F7007987AD /* RGBColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RGBColor.h; sourceTree = "<group>"; }; 12602 12598 BC74DA361013F3F7007987AD /* RGBColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RGBColor.cpp; sourceTree = "<group>"; }; … … 16483 16479 BE855F7F0701E83500239769 /* WebCoreView.h */, 16484 16480 BE8560510701F91100239769 /* WebCoreView.m */, 16485 BC6DADEE0A195FDF00E5CD14 /* WebFontCache.h */,16486 BC6DADF90A19602B00E5CD14 /* WebFontCache.mm */,16487 16481 E1A3162B134BC32D007C9A4F /* WebNSAttributedStringExtras.h */, 16488 16482 E1A3162C134BC32D007C9A4F /* WebNSAttributedStringExtras.mm */, … … 26600 26594 FE0D84E910484348001A179E /* WebEvent.h in Headers */, 26601 26595 225A16B50D5C11E900090295 /* WebEventRegion.h in Headers */, 26602 BC6DADEF0A195FDF00E5CD14 /* WebFontCache.h in Headers */,26603 26596 A7D20F6D107F438B00A80392 /* WebGLActiveInfo.h in Headers */, 26604 26597 49C7B9C91042D32F0009D447 /* WebGLBuffer.h in Headers */, … … 29879 29872 FE0D84EB1048436E001A179E /* WebEvent.mm in Sources */, 29880 29873 225A16B60D5C11E900090295 /* WebEventRegion.mm in Sources */, 29881 BC6DADFA0A19602B00E5CD14 /* WebFontCache.mm in Sources */,29882 29874 49C7B9C81042D32F0009D447 /* WebGLBuffer.cpp in Sources */, 29883 29875 7E66E23316D6EB6C00F7E7FF /* WebGLCompressedTextureATC.cpp in Sources */, -
trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm
r176112 r176146 38 38 #import "FontPlatformData.h" 39 39 #import "NSFontSPI.h" 40 #import "WebCoreNSStringExtras.h" 40 41 #import "WebCoreSystemInterface.h" 41 #import "WebFontCache.h"42 42 #import <AppKit/AppKit.h> 43 43 #import <wtf/MainThread.h> … … 49 49 namespace WebCore { 50 50 51 #define SYNTHESIZED_FONT_TRAITS (NSBoldFontMask | NSItalicFontMask) 52 53 #define IMPORTANT_FONT_TRAITS (0 \ 54 | NSCompressedFontMask \ 55 | NSCondensedFontMask \ 56 | NSExpandedFontMask \ 57 | NSItalicFontMask \ 58 | NSNarrowFontMask \ 59 | NSPosterFontMask \ 60 | NSSmallCapsFontMask \ 61 ) 62 63 static bool acceptableChoice(NSFontTraitMask desiredTraits, NSFontTraitMask candidateTraits) 64 { 65 desiredTraits &= ~SYNTHESIZED_FONT_TRAITS; 66 return (candidateTraits & desiredTraits) == desiredTraits; 67 } 68 69 static bool betterChoice(NSFontTraitMask desiredTraits, int desiredWeight, NSFontTraitMask chosenTraits, int chosenWeight, NSFontTraitMask candidateTraits, int candidateWeight) 70 { 71 if (!acceptableChoice(desiredTraits, candidateTraits)) 72 return false; 73 74 // A list of the traits we care about. 75 // The top item in the list is the worst trait to mismatch; if a font has this 76 // and we didn't ask for it, we'd prefer any other font in the family. 77 const NSFontTraitMask masks[] = { 78 NSPosterFontMask, 79 NSSmallCapsFontMask, 80 NSItalicFontMask, 81 NSCompressedFontMask, 82 NSCondensedFontMask, 83 NSExpandedFontMask, 84 NSNarrowFontMask, 85 0 86 }; 87 88 int i = 0; 89 NSFontTraitMask mask; 90 while ((mask = masks[i++])) { 91 bool desired = desiredTraits & mask; 92 bool chosenHasUnwantedTrait = desired != (chosenTraits & mask); 93 bool candidateHasUnwantedTrait = desired != (candidateTraits & mask); 94 if (!candidateHasUnwantedTrait && chosenHasUnwantedTrait) 95 return true; 96 if (!chosenHasUnwantedTrait && candidateHasUnwantedTrait) 97 return false; 98 } 99 100 int chosenWeightDeltaMagnitude = abs(chosenWeight - desiredWeight); 101 int candidateWeightDeltaMagnitude = abs(candidateWeight - desiredWeight); 102 103 // If both are the same distance from the desired weight, prefer the candidate if it is further from medium. 104 if (chosenWeightDeltaMagnitude == candidateWeightDeltaMagnitude) 105 return abs(candidateWeight - 6) > abs(chosenWeight - 6); 106 107 // Otherwise, prefer the one closer to the desired weight. 108 return candidateWeightDeltaMagnitude < chosenWeightDeltaMagnitude; 109 } 110 111 static inline FontTraitsMask toTraitsMask(NSFontTraitMask appKitTraits, NSInteger appKitWeight) 112 { 113 return static_cast<FontTraitsMask>(((appKitTraits & NSFontItalicTrait) ? FontStyleItalicMask : FontStyleNormalMask) 114 | FontVariantNormalMask 115 | (appKitWeight == 1 ? FontWeight100Mask : 116 appKitWeight == 2 ? FontWeight200Mask : 117 appKitWeight <= 4 ? FontWeight300Mask : 118 appKitWeight == 5 ? FontWeight400Mask : 119 appKitWeight == 6 ? FontWeight500Mask : 120 appKitWeight <= 8 ? FontWeight600Mask : 121 appKitWeight == 9 ? FontWeight700Mask : 122 appKitWeight <= 11 ? FontWeight800Mask : 123 FontWeight900Mask)); 124 } 125 126 // Keep a cache for mapping desired font families to font families actually 127 // available on the system for performance. 128 static NSMutableDictionary* desiredFamilyToAvailableFamilyDictionary() 129 { 130 ASSERT(isMainThread()); 131 static NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init]; 132 return dictionary; 133 } 134 135 static inline void rememberDesiredFamilyToAvailableFamilyMapping(NSString* desiredFamily, NSString* availableFamily) 136 { 137 static const NSUInteger maxCacheSize = 128; 138 NSMutableDictionary *familyMapping = desiredFamilyToAvailableFamilyDictionary(); 139 ASSERT([familyMapping count] <= maxCacheSize); 140 if ([familyMapping count] == maxCacheSize) { 141 for (NSString *key in familyMapping) { 142 [familyMapping removeObjectForKey:key]; 143 break; 144 } 145 } 146 id value = availableFamily ? availableFamily : [NSNull null]; 147 [familyMapping setObject:value forKey:desiredFamily]; 148 } 149 150 // Family name is somewhat of a misnomer here. We first attempt to find an exact match 151 // comparing the desiredFamily to the PostScript name of the installed fonts. If that fails 152 // we then do a search based on the family names of the installed fonts. 153 static NSFont *fontWithFamily(NSString *desiredFamily, NSFontTraitMask desiredTraits, int desiredWeight, float size) 154 { 155 if (stringIsCaseInsensitiveEqualToString(desiredFamily, @"-webkit-system-font") 156 || stringIsCaseInsensitiveEqualToString(desiredFamily, @"-apple-system-font")) { 157 // We ignore italic for system font. 158 return (desiredWeight >= 7) ? [NSFont boldSystemFontOfSize:size] : [NSFont systemFontOfSize:size]; 159 } 160 161 id cachedAvailableFamily = [desiredFamilyToAvailableFamilyDictionary() objectForKey:desiredFamily]; 162 if (cachedAvailableFamily == [NSNull null]) { 163 // We already know this font is not available. 164 return nil; 165 } 166 167 NSFontManager *fontManager = [NSFontManager sharedFontManager]; 168 NSString *availableFamily = cachedAvailableFamily; 169 if (!availableFamily) { 170 // Do a simple case insensitive search for a matching font family. 171 // NSFontManager requires exact name matches. 172 // This addresses the problem of matching arial to Arial, etc., but perhaps not all the issues. 173 for (availableFamily in [fontManager availableFontFamilies]) { 174 if ([desiredFamily caseInsensitiveCompare:availableFamily] == NSOrderedSame) 175 break; 176 } 177 178 if (!availableFamily) { 179 // Match by PostScript name. 180 NSFont *nameMatchedFont = nil; 181 NSFontTraitMask desiredTraitsForNameMatch = desiredTraits | (desiredWeight >= 7 ? NSBoldFontMask : 0); 182 for (NSString *availableFont in [fontManager availableFonts]) { 183 if ([desiredFamily caseInsensitiveCompare:availableFont] == NSOrderedSame) { 184 nameMatchedFont = [NSFont fontWithName:availableFont size:size]; 185 186 // Special case Osaka-Mono. According to <rdar://problem/3999467>, we need to 187 // treat Osaka-Mono as fixed pitch. 188 if ([desiredFamily caseInsensitiveCompare:@"Osaka-Mono"] == NSOrderedSame && !desiredTraitsForNameMatch) 189 return nameMatchedFont; 190 191 NSFontTraitMask traits = [fontManager traitsOfFont:nameMatchedFont]; 192 if ((traits & desiredTraitsForNameMatch) == desiredTraitsForNameMatch) 193 return [fontManager convertFont:nameMatchedFont toHaveTrait:desiredTraitsForNameMatch]; 194 195 availableFamily = [nameMatchedFont familyName]; 196 break; 197 } 198 } 199 } 200 201 rememberDesiredFamilyToAvailableFamilyMapping(desiredFamily, availableFamily); 202 if (!availableFamily) 203 return nil; 204 } 205 206 // Found a family, now figure out what weight and traits to use. 207 bool choseFont = false; 208 int chosenWeight = 0; 209 NSFontTraitMask chosenTraits = 0; 210 NSString *chosenFullName = 0; 211 212 NSArray *fonts = [fontManager availableMembersOfFontFamily:availableFamily]; 213 for (NSArray *fontInfo in fonts) { 214 // Array indices must be hard coded because of lame AppKit API. 215 NSString *fontFullName = [fontInfo objectAtIndex:0]; 216 NSInteger fontWeight = [[fontInfo objectAtIndex:2] intValue]; 217 NSFontTraitMask fontTraits = [[fontInfo objectAtIndex:3] unsignedIntValue]; 218 219 BOOL newWinner; 220 if (!choseFont) 221 newWinner = acceptableChoice(desiredTraits, fontTraits); 222 else 223 newWinner = betterChoice(desiredTraits, desiredWeight, chosenTraits, chosenWeight, fontTraits, fontWeight); 224 225 if (newWinner) { 226 choseFont = YES; 227 chosenWeight = fontWeight; 228 chosenTraits = fontTraits; 229 chosenFullName = fontFullName; 230 231 if (chosenWeight == desiredWeight && (chosenTraits & IMPORTANT_FONT_TRAITS) == (desiredTraits & IMPORTANT_FONT_TRAITS)) 232 break; 233 } 234 } 235 236 if (!choseFont) 237 return nil; 238 239 NSFont *font = [NSFont fontWithName:chosenFullName size:size]; 240 241 if (!font) 242 return nil; 243 244 NSFontTraitMask actualTraits = 0; 245 if (desiredTraits & NSFontItalicTrait) 246 actualTraits = [fontManager traitsOfFont:font]; 247 int actualWeight = [fontManager weightOfFont:font]; 248 249 bool syntheticBold = desiredWeight >= 7 && actualWeight < 7; 250 bool syntheticOblique = (desiredTraits & NSFontItalicTrait) && !(actualTraits & NSFontItalicTrait); 251 252 // There are some malformed fonts that will be correctly returned by -fontWithFamily:traits:weight:size: as a match for a particular trait, 253 // though -[NSFontManager traitsOfFont:] incorrectly claims the font does not have the specified trait. This could result in applying 254 // synthetic bold on top of an already-bold font, as reported in <http://bugs.webkit.org/show_bug.cgi?id=6146>. To work around this 255 // problem, if we got an apparent exact match, but the requested traits aren't present in the matched font, we'll try to get a font from 256 // the same family without those traits (to apply the synthetic traits to later). 257 NSFontTraitMask nonSyntheticTraits = desiredTraits; 258 259 if (syntheticBold) 260 nonSyntheticTraits &= ~NSBoldFontMask; 261 262 if (syntheticOblique) 263 nonSyntheticTraits &= ~NSItalicFontMask; 264 265 if (nonSyntheticTraits != desiredTraits) { 266 NSFont *fontWithoutSyntheticTraits = [fontManager fontWithFamily:availableFamily traits:nonSyntheticTraits weight:chosenWeight size:size]; 267 if (fontWithoutSyntheticTraits) 268 font = fontWithoutSyntheticTraits; 269 } 270 271 return font; 272 } 273 51 274 // The "void*" parameter makes the function match the prototype for callbacks from callOnMainThread. 52 275 static void invalidateFontCache(void*) … … 57 280 } 58 281 fontCache().invalidate(); 59 [ WebFontCache invalidate];282 [desiredFamilyToAvailableFamilyDictionary() removeAllObjects]; 60 283 } 61 284 … … 222 445 void FontCache::getTraitsInFamily(const AtomicString& familyName, Vector<unsigned>& traitsMasks) 223 446 { 224 [WebFontCache getTraits:traitsMasks inFamily:familyName]; 447 NSFontManager *fontManager = [NSFontManager sharedFontManager]; 448 449 NSString *availableFamily; 450 for (availableFamily in [fontManager availableFontFamilies]) { 451 if ([familyName caseInsensitiveCompare:availableFamily] == NSOrderedSame) 452 break; 453 } 454 455 if (!availableFamily) { 456 // Match by PostScript name. 457 for (NSString *availableFont in [fontManager availableFonts]) { 458 if ([familyName caseInsensitiveCompare:availableFont] == NSOrderedSame) { 459 NSFont *font = [NSFont fontWithName:availableFont size:10]; 460 NSInteger weight = [fontManager weightOfFont:font]; 461 traitsMasks.append(toTraitsMask([fontManager traitsOfFont:font], weight)); 462 break; 463 } 464 } 465 return; 466 } 467 468 NSArray *fonts = [fontManager availableMembersOfFontFamily:availableFamily]; 469 traitsMasks.reserveCapacity([fonts count]); 470 for (NSArray *fontInfo in fonts) { 471 // Array indices must be hard coded because of lame AppKit API. 472 NSInteger fontWeight = [[fontInfo objectAtIndex:2] intValue]; 473 NSFontTraitMask fontTraits = [[fontInfo objectAtIndex:3] unsignedIntValue]; 474 traitsMasks.uncheckedAppend(toTraitsMask(fontTraits, fontWeight)); 475 } 225 476 } 226 477 … … 231 482 float size = fontDescription.computedPixelSize(); 232 483 233 NSFont *nsFont = [WebFontCache fontWithFamily:family traits:traits weight:weight size:size shouldAutoActivateIfNeeded:shouldAutoActivateFontIfNeeded(family)]; 234 if (!nsFont) 235 return nullptr; 484 NSFont *nsFont = fontWithFamily(family, traits, weight, size); 485 if (!nsFont) { 486 if (!shouldAutoActivateFontIfNeeded(family)) 487 return nullptr; 488 489 // Auto activate the font before looking for it a second time. 490 // Ignore the result because we want to use our own algorithm to actually find the font. 491 [NSFont fontWithName:family size:size]; 492 493 nsFont = fontWithFamily(family, traits, weight, size); 494 if (!nsFont) 495 return nullptr; 496 } 236 497 237 498 NSFontManager *fontManager = [NSFontManager sharedFontManager]; -
trunk/Source/WebKit/mac/ChangeLog
r176145 r176146 1 2014-11-14 Myles C. Maxfield <mmaxfield@apple.com> 2 3 Get rid of WebFontCache 4 https://bugs.webkit.org/show_bug.cgi?id=134752 5 6 Reviewed by Dave Hyatt. 7 8 * WebView/WebHTMLView.mm: 9 1 10 2014-11-14 Timothy Horton <timothy_horton@apple.com> 2 11 -
trunk/Source/WebKit/mac/WebView/WebHTMLView.mm
r175954 r176146 136 136 #import "WebNSEventExtras.h" 137 137 #import "WebNSPasteboardExtras.h" 138 #import <WebCore/WebFontCache.h>139 138 #import <WebCore/PlatformEventFactoryMac.h> 140 139 #endif
Note: See TracChangeset
for help on using the changeset viewer.