<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[212876] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/212876">212876</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2017-02-22 22:11:02 -0800 (Wed, 22 Feb 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Cocoa] Remove Yosemite-specific font lookup code
https://bugs.webkit.org/show_bug.cgi?id=168682

Reviewed by Zalan Bujtas.

Source/WebCore:

No new tests because there is no behavior change.

* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::platformFontLookupWithFamily):
(WebCore::fontWithFamily):
* platform/graphics/mac/FontCacheMac.mm:
(WebCore::platformInvalidateFontCache):
(WebCore::acceptableChoice): Deleted.
(WebCore::betterChoice): Deleted.
(WebCore::desiredFamilyToAvailableFamilyMap): Deleted.
(WebCore::hasDesiredFamilyToAvailableFamilyMapping): Deleted.
(WebCore::rememberDesiredFamilyToAvailableFamilyMapping): Deleted.
(WebCore::toAppKitFontWeight): Deleted.
(WebCore::appkitWeightToFontWeight): Deleted.
(WebCore::toNSFontTraits): Deleted.
(WebCore::platformFontWithFamily): Deleted.

Source/WTF:

* wtf/Platform.h:

Tools:

* DumpRenderTree/mac/DumpRenderTree.mm:
(fontWhitelist):
(adjustFonts):
(createWebViewAndOffscreenWindow):
(drt_NSFontManager_availableFontFamilies): Deleted.
(drt_NSFontManager_availableFonts): Deleted.
(swizzleNSFontManagerMethods): Deleted.
* WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm:
(WTR::activateFonts):
(WTR::allowedFontFamilySet): Deleted.
(WTR::systemHiddenFontFamilySet): Deleted.
(WTR::wtr_NSFontManager_availableFontFamilies): Deleted.
(WTR::wtr_NSFontManager_availableFonts): Deleted.
(WTR::swizzleNSFontManagerMethods): Deleted.
* WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::generateWhitelist):
(WTR::TestController::platformInitializeContext):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfPlatformh">trunk/Source/WTF/wtf/Platform.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaFontCacheCoreTextcpp">trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacFontCacheMacmm">trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreemacDumpRenderTreemm">trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundlecocoaActivateFontsCocoamm">trunk/Tools/WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm</a></li>
<li><a href="#trunkToolsWebKitTestRunnermacTestControllerMacmm">trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (212875 => 212876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2017-02-23 04:43:46 UTC (rev 212875)
+++ trunk/Source/WTF/ChangeLog        2017-02-23 06:11:02 UTC (rev 212876)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2017-02-22  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        [Cocoa] Remove Yosemite-specific font lookup code
+        https://bugs.webkit.org/show_bug.cgi?id=168682
+
+        Reviewed by Zalan Bujtas.
+
+        * wtf/Platform.h:
+
</ins><span class="cx"> 2017-02-22  Keith Miller  &lt;keith_miller@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove the demand executable allocator
</span></span></pre></div>
<a id="trunkSourceWTFwtfPlatformh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/Platform.h (212875 => 212876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/Platform.h        2017-02-23 04:43:46 UTC (rev 212875)
+++ trunk/Source/WTF/wtf/Platform.h        2017-02-23 06:11:02 UTC (rev 212876)
</span><span class="lines">@@ -1109,10 +1109,6 @@
</span><span class="cx"> #define ENABLE_CSS3_TEXT_DECORATION_SKIP_INK 1
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS) || (PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt; 101000)
-#define ENABLE_PLATFORM_FONT_LOOKUP 1
-#endif
-
</del><span class="cx"> #if COMPILER(MSVC)
</span><span class="cx"> #undef __STDC_FORMAT_MACROS
</span><span class="cx"> #define __STDC_FORMAT_MACROS
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (212875 => 212876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-02-23 04:43:46 UTC (rev 212875)
+++ trunk/Source/WebCore/ChangeLog        2017-02-23 06:11:02 UTC (rev 212876)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2017-02-22  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        [Cocoa] Remove Yosemite-specific font lookup code
+        https://bugs.webkit.org/show_bug.cgi?id=168682
+
+        Reviewed by Zalan Bujtas.
+
+        No new tests because there is no behavior change.
+
+        * platform/graphics/cocoa/FontCacheCoreText.cpp:
+        (WebCore::platformFontLookupWithFamily):
+        (WebCore::fontWithFamily):
+        * platform/graphics/mac/FontCacheMac.mm:
+        (WebCore::platformInvalidateFontCache):
+        (WebCore::acceptableChoice): Deleted.
+        (WebCore::betterChoice): Deleted.
+        (WebCore::desiredFamilyToAvailableFamilyMap): Deleted.
+        (WebCore::hasDesiredFamilyToAvailableFamilyMapping): Deleted.
+        (WebCore::rememberDesiredFamilyToAvailableFamilyMapping): Deleted.
+        (WebCore::toAppKitFontWeight): Deleted.
+        (WebCore::appkitWeightToFontWeight): Deleted.
+        (WebCore::toNSFontTraits): Deleted.
+        (WebCore::platformFontWithFamily): Deleted.
+
</ins><span class="cx"> 2017-02-22  Antoine Quint  &lt;graouts@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Modern Media Controls] Clicking on the video doesn't toggle playback state in fullscreen on macOS
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaFontCacheCoreTextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (212875 => 212876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp        2017-02-23 04:43:46 UTC (rev 212875)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp        2017-02-23 06:11:02 UTC (rev 212876)
</span><span class="lines">@@ -791,7 +791,6 @@
</span><span class="cx">         whitelist.add(item);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if ENABLE(PLATFORM_FONT_LOOKUP)
</del><span class="cx"> static bool isSystemFont(const AtomicString&amp; family)
</span><span class="cx"> {
</span><span class="cx">     return family.length() &gt;= 1 &amp;&amp; family[0] == '.';
</span><span class="lines">@@ -805,7 +804,6 @@
</span><span class="cx"> 
</span><span class="cx">     return adoptCF(CTFontCreateForCSS(family.string().createCFString().get(), toCoreTextFontWeight(weight), requestedTraits, size));
</span><span class="cx"> }
</span><del>-#endif
</del><span class="cx"> 
</span><span class="cx"> static RetainPtr&lt;CTFontRef&gt; fontWithFamily(const AtomicString&amp; family, CTFontSymbolicTraits desiredTraits, FontWeight weight, const FontFeatureSettings&amp; featureSettings, const FontVariantSettings&amp; variantSettings, const FontVariationSettings&amp; variationSettings, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, const TextRenderingMode&amp; textRenderingMode, float size)
</span><span class="cx"> {
</span><span class="lines">@@ -813,13 +811,8 @@
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><span class="cx">     auto foundFont = platformFontWithFamilySpecialCase(family, weight, desiredTraits, size);
</span><del>-    if (!foundFont) {
-#if ENABLE(PLATFORM_FONT_LOOKUP)
</del><ins>+    if (!foundFont)
</ins><span class="cx">         foundFont = platformFontLookupWithFamily(family, desiredTraits, weight, size);
</span><del>-#else
-        foundFont = platformFontWithFamily(family, desiredTraits, weight, textRenderingMode, size);
-#endif
-    }
</del><span class="cx">     return preparePlatformFont(foundFont.get(), textRenderingMode, fontFaceFeatures, fontFaceVariantSettings, featureSettings, variantSettings, variationSettings);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacFontCacheMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm (212875 => 212876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm        2017-02-23 04:43:46 UTC (rev 212875)
+++ trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm        2017-02-23 06:11:02 UTC (rev 212876)
</span><span class="lines">@@ -52,146 +52,6 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> 
</span><del>-#if !ENABLE(PLATFORM_FONT_LOOKUP)
-
-#define SYNTHESIZED_FONT_TRAITS (NSBoldFontMask | NSItalicFontMask)
-
-#define IMPORTANT_FONT_TRAITS (0 \
-    | NSCompressedFontMask \
-    | NSCondensedFontMask \
-    | NSExpandedFontMask \
-    | NSItalicFontMask \
-    | NSNarrowFontMask \
-    | NSPosterFontMask \
-    | NSSmallCapsFontMask \
-)
-
-static bool acceptableChoice(NSFontTraitMask desiredTraits, NSFontTraitMask candidateTraits)
-{
-    desiredTraits &amp;= ~SYNTHESIZED_FONT_TRAITS;
-    return (candidateTraits &amp; desiredTraits) == desiredTraits;
-}
-
-static bool betterChoice(NSFontTraitMask desiredTraits, int desiredWeight, NSFontTraitMask chosenTraits, int chosenWeight, NSFontTraitMask candidateTraits, int candidateWeight)
-{
-    if (!acceptableChoice(desiredTraits, candidateTraits))
-        return false;
-
-    // A list of the traits we care about.
-    // The top item in the list is the worst trait to mismatch; if a font has this
-    // and we didn't ask for it, we'd prefer any other font in the family.
-    const NSFontTraitMask masks[] = {
-        NSPosterFontMask,
-        NSSmallCapsFontMask,
-        NSItalicFontMask,
-        NSCompressedFontMask,
-        NSCondensedFontMask,
-        NSExpandedFontMask,
-        NSNarrowFontMask,
-        0
-    };
-
-    int i = 0;
-    NSFontTraitMask mask;
-    while ((mask = masks[i++])) {
-        bool desired = desiredTraits &amp; mask;
-        bool chosenHasUnwantedTrait = desired != (chosenTraits &amp; mask);
-        bool candidateHasUnwantedTrait = desired != (candidateTraits &amp; mask);
-        if (!candidateHasUnwantedTrait &amp;&amp; chosenHasUnwantedTrait)
-            return true;
-        if (!chosenHasUnwantedTrait &amp;&amp; candidateHasUnwantedTrait)
-            return false;
-    }
-
-    int chosenWeightDeltaMagnitude = abs(chosenWeight - desiredWeight);
-    int candidateWeightDeltaMagnitude = abs(candidateWeight - desiredWeight);
-
-    // If both are the same distance from the desired weight, prefer the candidate if it is further from medium.
-    if (chosenWeightDeltaMagnitude == candidateWeightDeltaMagnitude)
-        return abs(candidateWeight - 6) &gt; abs(chosenWeight - 6);
-
-    // Otherwise, prefer the one closer to the desired weight.
-    return candidateWeightDeltaMagnitude &lt; chosenWeightDeltaMagnitude;
-}
-
-// Keep a cache for mapping desired font families to font families actually available on the system for performance.
-using AvailableFamilyMap = HashMap&lt;std::pair&lt;AtomicString, NSFontTraitMask&gt;, AtomicString&gt;;
-static AvailableFamilyMap&amp; desiredFamilyToAvailableFamilyMap()
-{
-    ASSERT(isMainThread());
-    static NeverDestroyed&lt;AvailableFamilyMap&gt; map;
-    return map;
-}
-
-static bool hasDesiredFamilyToAvailableFamilyMapping(const AtomicString&amp; desiredFamily, NSFontTraitMask desiredTraits, NSString*&amp; availableFamily)
-{
-    AtomicString value = desiredFamilyToAvailableFamilyMap().get(std::make_pair(desiredFamily, desiredTraits));
-    availableFamily = value.isEmpty() ? nil : static_cast&lt;NSString*&gt;(value);
-    return !value.isNull();
-}
-
-static inline void rememberDesiredFamilyToAvailableFamilyMapping(const AtomicString&amp; desiredFamily, NSFontTraitMask desiredTraits, NSString* availableFamily)
-{
-    static const unsigned maxCacheSize = 128;
-    auto&amp; familyMapping = desiredFamilyToAvailableFamilyMap();
-    ASSERT(familyMapping.size() &lt;= maxCacheSize);
-    if (familyMapping.size() &gt;= maxCacheSize)
-        familyMapping.remove(familyMapping.begin());
-
-    // Store nil as an emptyAtom to distinguish from missing values (nullAtom).
-    AtomicString value = availableFamily ? AtomicString(availableFamily) : emptyAtom;
-    familyMapping.add(std::make_pair(desiredFamily, desiredTraits), value);
-}
-
-static int toAppKitFontWeight(FontWeight fontWeight)
-{
-    static const int appKitFontWeights[] = {
-        2, // FontWeight100
-        3, // FontWeight200
-        4, // FontWeight300
-        5, // FontWeight400
-        6, // FontWeight500
-        8, // FontWeight600
-        9, // FontWeight700
-        10, // FontWeight800
-        12, // FontWeight900
-    };
-    return appKitFontWeights[fontWeight];
-}
-
-static inline FontWeight appkitWeightToFontWeight(NSInteger appKitWeight)
-{
-    if (appKitWeight == 1)
-        return FontWeight100;
-    if (appKitWeight == 2)
-        return FontWeight200;
-    if (appKitWeight &lt;= 4)
-        return FontWeight300;
-    if (appKitWeight == 5)
-        return FontWeight400;
-    if (appKitWeight == 6)
-        return FontWeight500;
-    if (appKitWeight &lt;= 8)
-        return FontWeight600;
-    if (appKitWeight == 9)
-        return FontWeight700;
-    if (appKitWeight &lt;= 11)
-        return FontWeight800;
-    return FontWeight900;
-}
-
-static NSFontTraitMask toNSFontTraits(CTFontSymbolicTraits traits)
-{
-    NSFontTraitMask result = 0;
-    if (traits &amp; kCTFontBoldTrait)
-        result |= NSBoldFontMask;
-    if (traits &amp; kCTFontItalicTrait)
-        result |= NSItalicFontMask;
-    return result;
-}
-
-#endif // PLATFORM_FONT_LOOKUP
-
</del><span class="cx"> static CGFloat toNSFontWeight(FontWeight fontWeight)
</span><span class="cx"> {
</span><span class="cx">     static const CGFloat nsFontWeights[] = {
</span><span class="lines">@@ -247,136 +107,8 @@
</span><span class="cx">     return nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if !ENABLE(PLATFORM_FONT_LOOKUP)
-RetainPtr&lt;CTFontRef&gt; platformFontWithFamily(const AtomicString&amp; family, CTFontSymbolicTraits requestedTraits, FontWeight weight, TextRenderingMode, float size)
-{
-    NSFontManager *fontManager = [NSFontManager sharedFontManager];
-    NSString *availableFamily;
-    int chosenWeight;
-    NSFont *font;
-
-    NSFontTraitMask desiredTraits = toNSFontTraits(requestedTraits);
-    NSFontTraitMask desiredTraitsForNameMatch = desiredTraits | (weight &gt;= FontWeight600 ? NSBoldFontMask : 0);
-    if (hasDesiredFamilyToAvailableFamilyMapping(family, desiredTraitsForNameMatch, availableFamily)) {
-        if (!availableFamily) {
-            // We already know the desired font family does not map to any available font family.
-            return nil;
-        }
-    }
-
-    if (!availableFamily) {
-        NSString *desiredFamily = family;
-
-        // Do a simple case insensitive search for a matching font family.
-        // NSFontManager requires exact name matches.
-        // This addresses the problem of matching arial to Arial, etc., but perhaps not all the issues.
-        for (availableFamily in [fontManager availableFontFamilies]) {
-            if ([desiredFamily caseInsensitiveCompare:availableFamily] == NSOrderedSame)
-                break;
-        }
-
-        if (!availableFamily) {
-            // Match by PostScript name.
-            NSFont *nameMatchedFont = nil;
-            for (NSString *availableFont in [fontManager availableFonts]) {
-                if ([desiredFamily caseInsensitiveCompare:availableFont] == NSOrderedSame) {
-                    nameMatchedFont = [NSFont fontWithName:availableFont size:size];
-
-                    // Special case Osaka-Mono. According to &lt;rdar://problem/3999467&gt;, we need to
-                    // treat Osaka-Mono as fixed pitch.
-                    if ([desiredFamily caseInsensitiveCompare:@&quot;Osaka-Mono&quot;] == NSOrderedSame &amp;&amp; !desiredTraitsForNameMatch)
-                        return toCTFont(nameMatchedFont);
-
-                    NSFontTraitMask traits = [fontManager traitsOfFont:nameMatchedFont];
-                    if ((traits &amp; desiredTraitsForNameMatch) == desiredTraitsForNameMatch)
-                        return toCTFont([fontManager convertFont:nameMatchedFont toHaveTrait:desiredTraitsForNameMatch]);
-
-                    availableFamily = [nameMatchedFont familyName];
-                    break;
-                }
-            }
-        }
-
-        rememberDesiredFamilyToAvailableFamilyMapping(family, desiredTraitsForNameMatch, availableFamily);
-        if (!availableFamily)
-            return nil;
-    }
-
-    // Found a family, now figure out what weight and traits to use.
-    bool choseFont = false;
-    chosenWeight = 0;
-    NSFontTraitMask chosenTraits = 0;
-    NSString *chosenFullName = 0;
-
-    int appKitDesiredWeight = toAppKitFontWeight(weight);
-    NSArray *fonts = [fontManager availableMembersOfFontFamily:availableFamily];
-    for (NSArray *fontInfo in fonts) {
-        // Array indices must be hard coded because of lame AppKit API.
-        NSString *fontFullName = [fontInfo objectAtIndex:0];
-        NSInteger fontWeight = [[fontInfo objectAtIndex:2] intValue];
-        NSFontTraitMask fontTraits = [[fontInfo objectAtIndex:3] unsignedIntValue];
-
-        BOOL newWinner;
-        if (!choseFont)
-            newWinner = acceptableChoice(desiredTraits, fontTraits);
-        else
-            newWinner = betterChoice(desiredTraits, appKitDesiredWeight, chosenTraits, chosenWeight, fontTraits, fontWeight);
-
-        if (newWinner) {
-            choseFont = YES;
-            chosenWeight = fontWeight;
-            chosenTraits = fontTraits;
-            chosenFullName = fontFullName;
-
-            if (chosenWeight == appKitDesiredWeight &amp;&amp; (chosenTraits &amp; IMPORTANT_FONT_TRAITS) == (desiredTraits &amp; IMPORTANT_FONT_TRAITS))
-                break;
-        }
-    }
-
-    if (!choseFont)
-        return nil;
-
-    font = [NSFont fontWithName:chosenFullName size:size];
-
-    if (!font)
-        return nil;
-
-    NSFontTraitMask actualTraits = 0;
-    if (desiredTraits &amp; NSFontItalicTrait)
-        actualTraits = [fontManager traitsOfFont:font];
-    FontWeight actualWeight = appkitWeightToFontWeight([fontManager weightOfFont:font]);
-
-    bool syntheticBold = isFontWeightBold(weight) &amp;&amp; isFontWeightBold(actualWeight);
-    bool syntheticOblique = (desiredTraits &amp; NSFontItalicTrait) &amp;&amp; !(actualTraits &amp; NSFontItalicTrait);
-
-    // There are some malformed fonts that will be correctly returned by -fontWithFamily:traits:weight:size: as a match for a particular trait,
-    // though -[NSFontManager traitsOfFont:] incorrectly claims the font does not have the specified trait. This could result in applying 
-    // synthetic bold on top of an already-bold font, as reported in &lt;http://bugs.webkit.org/show_bug.cgi?id=6146&gt;. To work around this
-    // 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 
-    // the same family without those traits (to apply the synthetic traits to later).
-    NSFontTraitMask nonSyntheticTraits = desiredTraits;
-
-    if (syntheticBold)
-        nonSyntheticTraits &amp;= ~NSBoldFontMask;
-
-    if (syntheticOblique)
-        nonSyntheticTraits &amp;= ~NSItalicFontMask;
-
-    if (nonSyntheticTraits != desiredTraits) {
-        NSFont *fontWithoutSyntheticTraits = [fontManager fontWithFamily:availableFamily traits:nonSyntheticTraits weight:chosenWeight size:size];
-        if (fontWithoutSyntheticTraits)
-            font = fontWithoutSyntheticTraits;
-    }
-
-    return toCTFont(font);
-}
-#endif
-
</del><span class="cx"> void platformInvalidateFontCache()
</span><span class="cx"> {
</span><del>-#if !ENABLE(PLATFORM_FONT_LOOKUP)
-    desiredFamilyToAvailableFamilyMap().clear();
-#endif
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Ref&lt;Font&gt; FontCache::lastResortFallbackFont(const FontDescription&amp; fontDescription)
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (212875 => 212876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-02-23 04:43:46 UTC (rev 212875)
+++ trunk/Tools/ChangeLog        2017-02-23 06:11:02 UTC (rev 212876)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2017-02-22  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        [Cocoa] Remove Yosemite-specific font lookup code
+        https://bugs.webkit.org/show_bug.cgi?id=168682
+
+        Reviewed by Zalan Bujtas.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (fontWhitelist):
+        (adjustFonts):
+        (createWebViewAndOffscreenWindow):
+        (drt_NSFontManager_availableFontFamilies): Deleted.
+        (drt_NSFontManager_availableFonts): Deleted.
+        (swizzleNSFontManagerMethods): Deleted.
+        * WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm:
+        (WTR::activateFonts):
+        (WTR::allowedFontFamilySet): Deleted.
+        (WTR::systemHiddenFontFamilySet): Deleted.
+        (WTR::wtr_NSFontManager_availableFontFamilies): Deleted.
+        (WTR::wtr_NSFontManager_availableFonts): Deleted.
+        (WTR::swizzleNSFontManagerMethods): Deleted.
+        * WebKitTestRunner/mac/TestControllerMac.mm:
+        (WTR::generateWhitelist):
+        (WTR::TestController::platformInitializeContext):
+
</ins><span class="cx"> 2017-02-22  Carlos Alberto Lopez Perez  &lt;clopez@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AutoInstaller should not skip the install step if the package is downloaded but not installed
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacDumpRenderTreemm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (212875 => 212876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm        2017-02-23 04:43:46 UTC (rev 212875)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm        2017-02-23 06:11:02 UTC (rev 212876)
</span><span class="lines">@@ -428,68 +428,6 @@
</span><span class="cx">     return fontFamilySet;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if !ENABLE(PLATFORM_FONT_LOOKUP)
-static IMP appKitAvailableFontFamiliesIMP;
-static IMP appKitAvailableFontsIMP;
-
-static NSArray *drt_NSFontManager_availableFontFamilies(id self, SEL _cmd)
-{
-    static NSArray *availableFontFamilies;
-    if (availableFontFamilies)
-        return availableFontFamilies;
-    
-    NSArray *availableFamilies = wtfCallIMP&lt;id&gt;(appKitAvailableFontFamiliesIMP, self, _cmd);
-
-    NSMutableSet *prunedFamiliesSet = [NSMutableSet setWithArray:availableFamilies];
-    [prunedFamiliesSet intersectSet:allowedFontFamilySet()];
-
-    availableFontFamilies = [[prunedFamiliesSet allObjects] retain];
-    return availableFontFamilies;
-}
-
-static NSArray *drt_NSFontManager_availableFonts(id self, SEL _cmd)
-{
-    static NSArray *availableFonts;
-    if (availableFonts)
-        return availableFonts;
-    
-    NSSet *allowedFamilies = allowedFontFamilySet();
-    NSMutableArray *availableFontList = [[NSMutableArray alloc] initWithCapacity:[allowedFamilies count] * 2];
-    for (NSString *fontFamily in allowedFontFamilySet()) {
-        NSArray* fontsForFamily = [[NSFontManager sharedFontManager] availableMembersOfFontFamily:fontFamily];
-        for (NSArray* fontInfo in fontsForFamily) {
-            // Font name is the first entry in the array.
-            [availableFontList addObject:[fontInfo objectAtIndex:0]];
-        }
-    }
-
-    availableFonts = availableFontList;
-    return availableFonts;
-}
-
-static void swizzleNSFontManagerMethods()
-{
-    Method availableFontFamiliesMethod = class_getInstanceMethod(objc_getClass(&quot;NSFontManager&quot;), @selector(availableFontFamilies));
-    ASSERT(availableFontFamiliesMethod);
-    if (!availableFontFamiliesMethod) {
-        NSLog(@&quot;Failed to swizzle the \&quot;availableFontFamilies\&quot; method on NSFontManager&quot;);
-        return;
-    }
-    
-    appKitAvailableFontFamiliesIMP = method_setImplementation(availableFontFamiliesMethod, (IMP)drt_NSFontManager_availableFontFamilies);
-
-    Method availableFontsMethod = class_getInstanceMethod(objc_getClass(&quot;NSFontManager&quot;), @selector(availableFonts));
-    ASSERT(availableFontsMethod);
-    if (!availableFontsMethod) {
-        NSLog(@&quot;Failed to swizzle the \&quot;availableFonts\&quot; method on NSFontManager&quot;);
-        return;
-    }
-    
-    appKitAvailableFontsIMP = method_setImplementation(availableFontsMethod, (IMP)drt_NSFontManager_availableFonts);
-}
-
-#else
-
</del><span class="cx"> static NSArray *fontWhitelist()
</span><span class="cx"> {
</span><span class="cx">     static NSArray *availableFonts;
</span><span class="lines">@@ -509,7 +447,6 @@
</span><span class="cx">     availableFonts = availableFontList;
</span><span class="cx">     return availableFonts;
</span><span class="cx"> }
</span><del>-#endif
</del><span class="cx"> 
</span><span class="cx"> // Activating system copies of these fonts overrides any others that could be preferred, such as ones
</span><span class="cx"> // in /Library/Fonts/Microsoft, and which don't always have the same metrics.
</span><span class="lines">@@ -588,9 +525,6 @@
</span><span class="cx"> 
</span><span class="cx"> static void adjustFonts()
</span><span class="cx"> {
</span><del>-#if !ENABLE(PLATFORM_FONT_LOOKUP)
-    swizzleNSFontManagerMethods();
-#endif
</del><span class="cx">     activateSystemCoreWebFonts();
</span><span class="cx">     activateTestingFonts();
</span><span class="cx"> }
</span><span class="lines">@@ -780,7 +714,7 @@
</span><span class="cx">     [WebView registerURLSchemeAsLocal:@&quot;feeds&quot;];
</span><span class="cx">     [WebView registerURLSchemeAsLocal:@&quot;feedsearch&quot;];
</span><span class="cx">     
</span><del>-#if PLATFORM(MAC) &amp;&amp; ENABLE(PLATFORM_FONT_LOOKUP)
</del><ins>+#if PLATFORM(MAC)
</ins><span class="cx">     [WebView _setFontWhitelist:fontWhitelist()];
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundlecocoaActivateFontsCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm (212875 => 212876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm        2017-02-23 04:43:46 UTC (rev 212875)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm        2017-02-23 06:11:02 UTC (rev 212876)
</span><span class="lines">@@ -45,206 +45,6 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(APPKIT)
</span><span class="cx"> 
</span><del>-#if !ENABLE(PLATFORM_FONT_LOOKUP)
-static NSSet *allowedFontFamilySet()
-{
-    static NSSet *fontFamilySet = [[NSSet setWithObjects:
-        @&quot;Ahem&quot;,
-        @&quot;Al Bayan&quot;,
-        @&quot;American Typewriter&quot;,
-        @&quot;Andale Mono&quot;,
-        @&quot;Apple Braille&quot;,
-        @&quot;Apple Color Emoji&quot;,
-        @&quot;Apple Chancery&quot;,
-        @&quot;Apple Garamond BT&quot;,
-        @&quot;Apple LiGothic&quot;,
-        @&quot;Apple LiSung&quot;,
-        @&quot;Apple Symbols&quot;,
-        @&quot;AppleGothic&quot;,
-        @&quot;AppleMyungjo&quot;,
-        @&quot;Arial Black&quot;,
-        @&quot;Arial Hebrew&quot;,
-        @&quot;Arial Narrow&quot;,
-        @&quot;Arial Rounded MT Bold&quot;,
-        @&quot;Arial Unicode MS&quot;,
-        @&quot;Arial&quot;,
-        @&quot;Avenir Next&quot;,
-        @&quot;Ayuthaya&quot;,
-        @&quot;Baghdad&quot;,
-        @&quot;Baskerville&quot;,
-        @&quot;BiauKai&quot;,
-        @&quot;Big Caslon&quot;,
-        @&quot;Brush Script MT&quot;,
-        @&quot;Chalkboard&quot;,
-        @&quot;Chalkduster&quot;,
-        @&quot;Charcoal CY&quot;,
-        @&quot;Cochin&quot;,
-        @&quot;Comic Sans MS&quot;,
-        @&quot;Copperplate&quot;,
-        @&quot;Corsiva Hebrew&quot;,
-        @&quot;Courier New&quot;,
-        @&quot;Courier&quot;,
-        @&quot;DecoType Naskh&quot;,
-        @&quot;Devanagari MT&quot;,
-        @&quot;Didot&quot;,
-        @&quot;Euphemia UCAS&quot;,
-        @&quot;Futura&quot;,
-        @&quot;GB18030 Bitmap&quot;,
-        @&quot;Geeza Pro&quot;,
-        @&quot;Geneva CY&quot;,
-        @&quot;Geneva&quot;,
-        @&quot;Georgia&quot;,
-        @&quot;Gill Sans&quot;,
-        @&quot;Gujarati MT&quot;,
-        @&quot;GungSeo&quot;,
-        @&quot;Gurmukhi MT&quot;,
-        @&quot;HeadLineA&quot;,
-        @&quot;Hei&quot;,
-        @&quot;Heiti SC&quot;,
-        @&quot;Heiti TC&quot;,
-        @&quot;Helvetica CY&quot;,
-        @&quot;Helvetica Neue&quot;,
-        @&quot;Helvetica&quot;,
-        @&quot;Herculanum&quot;,
-        @&quot;Hiragino Kaku Gothic Pro&quot;,
-        @&quot;Hiragino Kaku Gothic ProN&quot;,
-        @&quot;Hiragino Kaku Gothic Std&quot;,
-        @&quot;Hiragino Kaku Gothic StdN&quot;,
-        @&quot;Hiragino Maru Gothic Pro&quot;,
-        @&quot;Hiragino Maru Gothic ProN&quot;,
-        @&quot;Hiragino Mincho Pro&quot;,
-        @&quot;Hiragino Mincho ProN&quot;,
-        @&quot;Hiragino Sans GB&quot;,
-        @&quot;Hoefler Text&quot;,
-        @&quot;Impact&quot;,
-        @&quot;InaiMathi&quot;,
-        @&quot;Kai&quot;,
-        @&quot;Kailasa&quot;,
-        @&quot;Kokonor&quot;,
-        @&quot;Krungthep&quot;,
-        @&quot;KufiStandardGK&quot;,
-        @&quot;LastResort&quot;,
-        @&quot;LiHei Pro&quot;,
-        @&quot;LiSong Pro&quot;,
-        @&quot;Lucida Grande&quot;,
-        @&quot;Marker Felt&quot;,
-        @&quot;Menlo&quot;,
-        @&quot;Microsoft Sans Serif&quot;,
-        @&quot;Monaco&quot;,
-        @&quot;Mshtakan&quot;,
-        @&quot;Nadeem&quot;,
-        @&quot;New Peninim MT&quot;,
-        @&quot;Optima&quot;,
-        @&quot;Osaka&quot;,
-        @&quot;Papyrus&quot;,
-        @&quot;PCMyungjo&quot;,
-        @&quot;PilGi&quot;,
-        @&quot;Plantagenet Cherokee&quot;,
-        @&quot;Raanana&quot;,
-        @&quot;Sathu&quot;,
-        @&quot;Silom&quot;,
-        @&quot;Skia&quot;,
-        @&quot;Songti SC&quot;,
-        @&quot;Songti TC&quot;,
-        @&quot;STFangsong&quot;,
-        @&quot;STHeiti&quot;,
-        @&quot;STIXGeneral&quot;,
-        @&quot;STIXSizeOneSym&quot;,
-        @&quot;STKaiti&quot;,
-        @&quot;STSong&quot;,
-        @&quot;Symbol&quot;,
-        @&quot;Tahoma&quot;,
-        @&quot;Thonburi&quot;,
-        @&quot;Times New Roman&quot;,
-        @&quot;Times&quot;,
-        @&quot;Trebuchet MS&quot;,
-        @&quot;Verdana&quot;,
-        @&quot;Webdings&quot;,
-        @&quot;WebKit WeightWatcher&quot;,
-        @&quot;FontWithFeaturesOTF&quot;,
-        @&quot;FontWithFeaturesTTF&quot;,
-        @&quot;Wingdings 2&quot;,
-        @&quot;Wingdings 3&quot;,
-        @&quot;Wingdings&quot;,
-        @&quot;Zapf Dingbats&quot;,
-        @&quot;Zapfino&quot;,
-        nil] retain];
-    
-    return fontFamilySet;
-}
-
-static NSSet *systemHiddenFontFamilySet()
-{
-    static NSSet *fontFamilySet = [[NSSet setWithObjects:
-        @&quot;.LucidaGrandeUI&quot;,
-        nil] retain];
-
-    return fontFamilySet;
-}
-
-static IMP appKitAvailableFontFamiliesIMP;
-static IMP appKitAvailableFontsIMP;
-
-static NSArray *wtr_NSFontManager_availableFontFamilies(id self, SEL _cmd)
-{
-    static NSArray *availableFontFamilies;
-    if (availableFontFamilies)
-        return availableFontFamilies;
-    
-    NSArray *availableFamilies = wtfCallIMP&lt;id&gt;(appKitAvailableFontFamiliesIMP, self, _cmd);
-
-    NSMutableSet *prunedFamiliesSet = [NSMutableSet setWithArray:availableFamilies];
-    [prunedFamiliesSet intersectSet:allowedFontFamilySet()];
-
-    availableFontFamilies = [[prunedFamiliesSet allObjects] retain];
-    return availableFontFamilies;
-}
-
-static NSArray *wtr_NSFontManager_availableFonts(id self, SEL _cmd)
-{
-    static NSArray *availableFonts;
-    if (availableFonts)
-        return availableFonts;
-    
-    NSSet *allowedFamilies = allowedFontFamilySet();
-    NSMutableArray *availableFontList = [[NSMutableArray alloc] initWithCapacity:[allowedFamilies count] * 2];
-    for (NSString *fontFamily in allowedFontFamilySet()) {
-        NSArray* fontsForFamily = [[NSFontManager sharedFontManager] availableMembersOfFontFamily:fontFamily];
-        for (NSArray* fontInfo in fontsForFamily) {
-            // Font name is the first entry in the array.
-            [availableFontList addObject:[fontInfo objectAtIndex:0]];
-        }
-    }
-
-    for (NSString *hiddenFontFamily in systemHiddenFontFamilySet())
-        [availableFontList addObject:hiddenFontFamily];
-
-    availableFonts = availableFontList;
-    return availableFonts;
-}
-
-static void swizzleNSFontManagerMethods()
-{
-    Method availableFontFamiliesMethod = class_getInstanceMethod(objc_getClass(&quot;NSFontManager&quot;), @selector(availableFontFamilies));
-    ASSERT(availableFontFamiliesMethod);
-    if (!availableFontFamiliesMethod) {
-        NSLog(@&quot;Failed to swizzle the \&quot;availableFontFamilies\&quot; method on NSFontManager&quot;);
-        return;
-    }
-    
-    appKitAvailableFontFamiliesIMP = method_setImplementation(availableFontFamiliesMethod, (IMP)wtr_NSFontManager_availableFontFamilies);
-
-    Method availableFontsMethod = class_getInstanceMethod(objc_getClass(&quot;NSFontManager&quot;), @selector(availableFonts));
-    ASSERT(availableFontsMethod);
-    if (!availableFontsMethod) {
-        NSLog(@&quot;Failed to swizzle the \&quot;availableFonts\&quot; method on NSFontManager&quot;);
-        return;
-    }
-    
-    appKitAvailableFontsIMP = method_setImplementation(availableFontsMethod, (IMP)wtr_NSFontManager_availableFonts);
-}
-#endif
-
</del><span class="cx"> // Activating system copies of these fonts overrides any others that could be preferred, such as ones
</span><span class="cx"> // in /Library/Fonts/Microsoft, and which don't always have the same metrics.
</span><span class="cx"> // FIXME: Switch to a solution from &lt;rdar://problem/19553550&gt; once it's available.
</span><span class="lines">@@ -322,9 +122,6 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> #if USE(APPKIT)
</span><del>-#if !ENABLE(PLATFORM_FONT_LOOKUP)
-    swizzleNSFontManagerMethods();
-#endif
</del><span class="cx">     activateSystemCoreWebFonts();
</span><span class="cx"> #endif // USE(APPKIT)
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnermacTestControllerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm (212875 => 212876)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm        2017-02-23 04:43:46 UTC (rev 212875)
+++ trunk/Tools/WebKitTestRunner/mac/TestControllerMac.mm        2017-02-23 06:11:02 UTC (rev 212876)
</span><span class="lines">@@ -143,7 +143,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if ENABLE(PLATFORM_FONT_LOOKUP)
</del><span class="cx"> static NSSet *allowedFontFamilySet()
</span><span class="cx"> {
</span><span class="cx">     static NSSet *fontFamilySet = [[NSSet setWithObjects:
</span><span class="lines">@@ -299,7 +298,6 @@
</span><span class="cx"> 
</span><span class="cx">     return adoptWK(result);
</span><span class="cx"> }
</span><del>-#endif
</del><span class="cx"> 
</span><span class="cx"> void TestController::platformInitializeContext()
</span><span class="cx"> {
</span><span class="lines">@@ -312,9 +310,7 @@
</span><span class="cx">                                           diskPath:nil]);
</span><span class="cx">     [NSURLCache setSharedURLCache:sharedCache.get()];
</span><span class="cx"> 
</span><del>-#if ENABLE(PLATFORM_FONT_LOOKUP)
</del><span class="cx">     WKContextSetFontWhitelist(m_context.get(), generateWhitelist().get());
</span><del>-#endif
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TestController::setHidden(bool hidden)
</span></span></pre>
</div>
</div>

</body>
</html>