<!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 <mmaxfield@apple.com>
+
+ [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 <keith_miller@apple.com>
</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) && __MAC_OS_X_VERSION_MIN_REQUIRED > 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 <mmaxfield@apple.com>
+
+ [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 <graouts@apple.com>
</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& family)
</span><span class="cx"> {
</span><span class="cx"> return family.length() >= 1 && 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<CTFontRef> fontWithFamily(const AtomicString& family, CTFontSymbolicTraits desiredTraits, FontWeight weight, const FontFeatureSettings& featureSettings, const FontVariantSettings& variantSettings, const FontVariationSettings& variationSettings, const FontFeatureSettings* fontFaceFeatures, const FontVariantSettings* fontFaceVariantSettings, const TextRenderingMode& 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 &= ~SYNTHESIZED_FONT_TRAITS;
- return (candidateTraits & 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 & mask;
- bool chosenHasUnwantedTrait = desired != (chosenTraits & mask);
- bool candidateHasUnwantedTrait = desired != (candidateTraits & mask);
- if (!candidateHasUnwantedTrait && chosenHasUnwantedTrait)
- return true;
- if (!chosenHasUnwantedTrait && 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) > abs(chosenWeight - 6);
-
- // Otherwise, prefer the one closer to the desired weight.
- return candidateWeightDeltaMagnitude < chosenWeightDeltaMagnitude;
-}
-
-// Keep a cache for mapping desired font families to font families actually available on the system for performance.
-using AvailableFamilyMap = HashMap<std::pair<AtomicString, NSFontTraitMask>, AtomicString>;
-static AvailableFamilyMap& desiredFamilyToAvailableFamilyMap()
-{
- ASSERT(isMainThread());
- static NeverDestroyed<AvailableFamilyMap> map;
- return map;
-}
-
-static bool hasDesiredFamilyToAvailableFamilyMapping(const AtomicString& desiredFamily, NSFontTraitMask desiredTraits, NSString*& availableFamily)
-{
- AtomicString value = desiredFamilyToAvailableFamilyMap().get(std::make_pair(desiredFamily, desiredTraits));
- availableFamily = value.isEmpty() ? nil : static_cast<NSString*>(value);
- return !value.isNull();
-}
-
-static inline void rememberDesiredFamilyToAvailableFamilyMapping(const AtomicString& desiredFamily, NSFontTraitMask desiredTraits, NSString* availableFamily)
-{
- static const unsigned maxCacheSize = 128;
- auto& familyMapping = desiredFamilyToAvailableFamilyMap();
- ASSERT(familyMapping.size() <= maxCacheSize);
- if (familyMapping.size() >= 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 <= 4)
- return FontWeight300;
- if (appKitWeight == 5)
- return FontWeight400;
- if (appKitWeight == 6)
- return FontWeight500;
- if (appKitWeight <= 8)
- return FontWeight600;
- if (appKitWeight == 9)
- return FontWeight700;
- if (appKitWeight <= 11)
- return FontWeight800;
- return FontWeight900;
-}
-
-static NSFontTraitMask toNSFontTraits(CTFontSymbolicTraits traits)
-{
- NSFontTraitMask result = 0;
- if (traits & kCTFontBoldTrait)
- result |= NSBoldFontMask;
- if (traits & 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<CTFontRef> platformFontWithFamily(const AtomicString& 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 >= 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 <rdar://problem/3999467>, we need to
- // treat Osaka-Mono as fixed pitch.
- if ([desiredFamily caseInsensitiveCompare:@"Osaka-Mono"] == NSOrderedSame && !desiredTraitsForNameMatch)
- return toCTFont(nameMatchedFont);
-
- NSFontTraitMask traits = [fontManager traitsOfFont:nameMatchedFont];
- if ((traits & 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 && (chosenTraits & IMPORTANT_FONT_TRAITS) == (desiredTraits & IMPORTANT_FONT_TRAITS))
- break;
- }
- }
-
- if (!choseFont)
- return nil;
-
- font = [NSFont fontWithName:chosenFullName size:size];
-
- if (!font)
- return nil;
-
- NSFontTraitMask actualTraits = 0;
- if (desiredTraits & NSFontItalicTrait)
- actualTraits = [fontManager traitsOfFont:font];
- FontWeight actualWeight = appkitWeightToFontWeight([fontManager weightOfFont:font]);
-
- bool syntheticBold = isFontWeightBold(weight) && isFontWeightBold(actualWeight);
- bool syntheticOblique = (desiredTraits & NSFontItalicTrait) && !(actualTraits & 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 <http://bugs.webkit.org/show_bug.cgi?id=6146>. 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 &= ~NSBoldFontMask;
-
- if (syntheticOblique)
- nonSyntheticTraits &= ~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<Font> FontCache::lastResortFallbackFont(const FontDescription& 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 <mmaxfield@apple.com>
+
+ [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 <clopez@igalia.com>
</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<id>(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("NSFontManager"), @selector(availableFontFamilies));
- ASSERT(availableFontFamiliesMethod);
- if (!availableFontFamiliesMethod) {
- NSLog(@"Failed to swizzle the \"availableFontFamilies\" method on NSFontManager");
- return;
- }
-
- appKitAvailableFontFamiliesIMP = method_setImplementation(availableFontFamiliesMethod, (IMP)drt_NSFontManager_availableFontFamilies);
-
- Method availableFontsMethod = class_getInstanceMethod(objc_getClass("NSFontManager"), @selector(availableFonts));
- ASSERT(availableFontsMethod);
- if (!availableFontsMethod) {
- NSLog(@"Failed to swizzle the \"availableFonts\" method on NSFontManager");
- 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:@"feeds"];
</span><span class="cx"> [WebView registerURLSchemeAsLocal:@"feedsearch"];
</span><span class="cx">
</span><del>-#if PLATFORM(MAC) && 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:
- @"Ahem",
- @"Al Bayan",
- @"American Typewriter",
- @"Andale Mono",
- @"Apple Braille",
- @"Apple Color Emoji",
- @"Apple Chancery",
- @"Apple Garamond BT",
- @"Apple LiGothic",
- @"Apple LiSung",
- @"Apple Symbols",
- @"AppleGothic",
- @"AppleMyungjo",
- @"Arial Black",
- @"Arial Hebrew",
- @"Arial Narrow",
- @"Arial Rounded MT Bold",
- @"Arial Unicode MS",
- @"Arial",
- @"Avenir Next",
- @"Ayuthaya",
- @"Baghdad",
- @"Baskerville",
- @"BiauKai",
- @"Big Caslon",
- @"Brush Script MT",
- @"Chalkboard",
- @"Chalkduster",
- @"Charcoal CY",
- @"Cochin",
- @"Comic Sans MS",
- @"Copperplate",
- @"Corsiva Hebrew",
- @"Courier New",
- @"Courier",
- @"DecoType Naskh",
- @"Devanagari MT",
- @"Didot",
- @"Euphemia UCAS",
- @"Futura",
- @"GB18030 Bitmap",
- @"Geeza Pro",
- @"Geneva CY",
- @"Geneva",
- @"Georgia",
- @"Gill Sans",
- @"Gujarati MT",
- @"GungSeo",
- @"Gurmukhi MT",
- @"HeadLineA",
- @"Hei",
- @"Heiti SC",
- @"Heiti TC",
- @"Helvetica CY",
- @"Helvetica Neue",
- @"Helvetica",
- @"Herculanum",
- @"Hiragino Kaku Gothic Pro",
- @"Hiragino Kaku Gothic ProN",
- @"Hiragino Kaku Gothic Std",
- @"Hiragino Kaku Gothic StdN",
- @"Hiragino Maru Gothic Pro",
- @"Hiragino Maru Gothic ProN",
- @"Hiragino Mincho Pro",
- @"Hiragino Mincho ProN",
- @"Hiragino Sans GB",
- @"Hoefler Text",
- @"Impact",
- @"InaiMathi",
- @"Kai",
- @"Kailasa",
- @"Kokonor",
- @"Krungthep",
- @"KufiStandardGK",
- @"LastResort",
- @"LiHei Pro",
- @"LiSong Pro",
- @"Lucida Grande",
- @"Marker Felt",
- @"Menlo",
- @"Microsoft Sans Serif",
- @"Monaco",
- @"Mshtakan",
- @"Nadeem",
- @"New Peninim MT",
- @"Optima",
- @"Osaka",
- @"Papyrus",
- @"PCMyungjo",
- @"PilGi",
- @"Plantagenet Cherokee",
- @"Raanana",
- @"Sathu",
- @"Silom",
- @"Skia",
- @"Songti SC",
- @"Songti TC",
- @"STFangsong",
- @"STHeiti",
- @"STIXGeneral",
- @"STIXSizeOneSym",
- @"STKaiti",
- @"STSong",
- @"Symbol",
- @"Tahoma",
- @"Thonburi",
- @"Times New Roman",
- @"Times",
- @"Trebuchet MS",
- @"Verdana",
- @"Webdings",
- @"WebKit WeightWatcher",
- @"FontWithFeaturesOTF",
- @"FontWithFeaturesTTF",
- @"Wingdings 2",
- @"Wingdings 3",
- @"Wingdings",
- @"Zapf Dingbats",
- @"Zapfino",
- nil] retain];
-
- return fontFamilySet;
-}
-
-static NSSet *systemHiddenFontFamilySet()
-{
- static NSSet *fontFamilySet = [[NSSet setWithObjects:
- @".LucidaGrandeUI",
- 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<id>(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("NSFontManager"), @selector(availableFontFamilies));
- ASSERT(availableFontFamiliesMethod);
- if (!availableFontFamiliesMethod) {
- NSLog(@"Failed to swizzle the \"availableFontFamilies\" method on NSFontManager");
- return;
- }
-
- appKitAvailableFontFamiliesIMP = method_setImplementation(availableFontFamiliesMethod, (IMP)wtr_NSFontManager_availableFontFamilies);
-
- Method availableFontsMethod = class_getInstanceMethod(objc_getClass("NSFontManager"), @selector(availableFonts));
- ASSERT(availableFontsMethod);
- if (!availableFontsMethod) {
- NSLog(@"Failed to swizzle the \"availableFonts\" method on NSFontManager");
- 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 <rdar://problem/19553550> 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>