Changeset 226359 in webkit


Ignore:
Timestamp:
Jan 3, 2018 9:05:12 AM (6 years ago)
Author:
Ryan Haddad
Message:

Unreviewed, rolling out r226352.

Breaks Sierra and El Capitan builds.

Reverted changeset:

"Web Inspector: Slow open time enumerating system fonts
(FontCache::systemFontFamilies)"
https://bugs.webkit.org/show_bug.cgi?id=180979
https://trac.webkit.org/changeset/226352

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r226355 r226359  
     12018-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
    1142018-01-03  Carlos Garcia Campos  <cgarcia@igalia.com>
    215
  • trunk/LayoutTests/inspector/css/get-system-fonts.html

    r226352 r226359  
    2929</head>
    3030<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>
    3233</body>
    3334</html>
  • trunk/Source/WebCore/ChangeLog

    r226358 r226359  
     12018-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
    1142018-01-03  Philippe Normand  <pnormand@igalia.com>
    215
  • trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp

    r226352 r226359  
    414414}
    415415
    416 static inline bool fontNameIsSystemFont(CFStringRef fontName)
    417 {
    418     return CFStringGetLength(fontName) > 0 && CFStringGetCharacterAtIndex(fontName, 0) == '.';
    419 }
    420 
    421416static inline bool fontIsSystemFont(CTFontRef font)
    422417{
    423418    if (CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(font)).get()))
    424419        return true;
    425 
    426420    auto name = adoptCF(CTFontCopyPostScriptName(font));
    427     return fontNameIsSystemFont(name.get());
     421    return CFStringGetLength(name.get()) > 0 && CFStringGetCharacterAtIndex(name.get(), 0) == '.';
    428422}
    429423
     
    738732Vector<String> FontCache::systemFontFamilies()
    739733{
    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);
    758753}
    759754
Note: See TracChangeset for help on using the changeset viewer.