Changeset 226359 in webkit
- Timestamp:
- Jan 3, 2018 9:05:12 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r226355 r226359 1 2018-01-03 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r226352. 4 5 Breaks Sierra and El Capitan builds. 6 7 Reverted changeset: 8 9 "Web Inspector: Slow open time enumerating system fonts 10 (FontCache::systemFontFamilies)" 11 https://bugs.webkit.org/show_bug.cgi?id=180979 12 https://trac.webkit.org/changeset/226352 13 1 14 2018-01-03 Carlos Garcia Campos <cgarcia@igalia.com> 2 15 -
trunk/LayoutTests/inspector/css/get-system-fonts.html
r226352 r226359 29 29 </head> 30 30 <body onload="runTest()"> 31 <p>This test ensures that the inspector can enumerate system font families, and checks for the existence of common fonts.</p> 31 <p>This test ensures that the inspector can enumerate system font families, and checks for the 32 existence of common fonts.</p> 32 33 </body> 33 34 </html> -
trunk/Source/WebCore/ChangeLog
r226358 r226359 1 2018-01-03 Ryan Haddad <ryanhaddad@apple.com> 2 3 Unreviewed, rolling out r226352. 4 5 Breaks Sierra and El Capitan builds. 6 7 Reverted changeset: 8 9 "Web Inspector: Slow open time enumerating system fonts 10 (FontCache::systemFontFamilies)" 11 https://bugs.webkit.org/show_bug.cgi?id=180979 12 https://trac.webkit.org/changeset/226352 13 1 14 2018-01-03 Philippe Normand <pnormand@igalia.com> 2 15 -
trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
r226352 r226359 414 414 } 415 415 416 static inline bool fontNameIsSystemFont(CFStringRef fontName)417 {418 return CFStringGetLength(fontName) > 0 && CFStringGetCharacterAtIndex(fontName, 0) == '.';419 }420 421 416 static inline bool fontIsSystemFont(CTFontRef font) 422 417 { 423 418 if (CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(font)).get())) 424 419 return true; 425 426 420 auto name = adoptCF(CTFontCopyPostScriptName(font)); 427 return fontNameIsSystemFont(name.get());421 return CFStringGetLength(name.get()) > 0 && CFStringGetCharacterAtIndex(name.get(), 0) == '.'; 428 422 } 429 423 … … 738 732 Vector<String> FontCache::systemFontFamilies() 739 733 { 740 Vector<String> fontFamilies; 741 742 auto availableFontFamilies = adoptCF(CTFontManagerCopyAvailableFontFamilyNames()); 743 CFIndex count = CFArrayGetCount(availableFontFamilies.get()); 744 for (CFIndex i = 0; i < count; ++i) { 745 CFStringRef fontName = static_cast<CFStringRef>(CFArrayGetValueAtIndex(availableFontFamilies.get(), i)); 746 if (CFGetTypeID(fontName) != CFStringGetTypeID()) { 747 ASSERT_NOT_REACHED(); 748 continue; 749 } 750 751 if (fontNameIsSystemFont(fontName)) 752 continue; 753 754 fontFamilies.append(fontName); 755 } 756 757 return fontFamilies; 734 // FIXME: <rdar://problem/21890188> 735 auto attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, nullptr, nullptr, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); 736 auto emptyFontDescriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get())); 737 auto matchedDescriptors = adoptCF(CTFontDescriptorCreateMatchingFontDescriptors(emptyFontDescriptor.get(), nullptr)); 738 if (!matchedDescriptors) 739 return { }; 740 741 CFIndex numMatches = CFArrayGetCount(matchedDescriptors.get()); 742 if (!numMatches) 743 return { }; 744 745 HashSet<String> visited; 746 for (CFIndex i = 0; i < numMatches; ++i) { 747 auto fontDescriptor = static_cast<CTFontDescriptorRef>(CFArrayGetValueAtIndex(matchedDescriptors.get(), i)); 748 if (auto familyName = adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(fontDescriptor, kCTFontFamilyNameAttribute)))) 749 visited.add(familyName.get()); 750 } 751 752 return copyToVector(visited); 758 753 } 759 754
Note: See TracChangeset
for help on using the changeset viewer.