<!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>[176146] trunk/Source</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/176146">176146</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2014-11-14 16:02:57 -0800 (Fri, 14 Nov 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Get rid of WebFontCache
https://bugs.webkit.org/show_bug.cgi?id=134752

Reviewed by Dave Hyatt.

Source/WebCore:

No new tests because there is no behavior change.

* Configurations/WebCore.xcconfig:
* PlatformMac.cmake:
* WebCore.exp.in:
* WebCore.order:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/mac/FontCacheMac.mm:
(WebCore::acceptableChoice):
(WebCore::betterChoice):
(WebCore::toTraitsMask):
(WebCore::desiredFamilyToAvailableFamilyDictionary):
(WebCore::rememberDesiredFamilyToAvailableFamilyMapping):
(WebCore::fontWithFamily):
(WebCore::invalidateFontCache):
(WebCore::FontCache::getTraitsInFamily):
(WebCore::FontCache::createFontPlatformData):
* platform/mac/WebFontCache.h: Removed.
* platform/mac/WebFontCache.mm: Removed.

Source/WebKit/mac:

* WebView/WebHTMLView.mm:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreConfigurationsWebCorexcconfig">trunk/Source/WebCore/Configurations/WebCore.xcconfig</a></li>
<li><a href="#trunkSourceWebCorePlatformMaccmake">trunk/Source/WebCore/PlatformMac.cmake</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoreWebCoreorder">trunk/Source/WebCore/WebCore.order</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacFontCacheMacmm">trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebHTMLViewmm">trunk/Source/WebKit/mac/WebView/WebHTMLView.mm</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformmacWebFontCacheh">trunk/Source/WebCore/platform/mac/WebFontCache.h</a></li>
<li><a href="#trunkSourceWebCoreplatformmacWebFontCachemm">trunk/Source/WebCore/platform/mac/WebFontCache.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (176145 => 176146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-11-14 23:50:35 UTC (rev 176145)
+++ trunk/Source/WebCore/ChangeLog        2014-11-15 00:02:57 UTC (rev 176146)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2014-11-14  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        Get rid of WebFontCache
+        https://bugs.webkit.org/show_bug.cgi?id=134752
+
+        Reviewed by Dave Hyatt.
+
+        No new tests because there is no behavior change.
+
+        * Configurations/WebCore.xcconfig:
+        * PlatformMac.cmake:
+        * WebCore.exp.in:
+        * WebCore.order:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/mac/FontCacheMac.mm:
+        (WebCore::acceptableChoice):
+        (WebCore::betterChoice):
+        (WebCore::toTraitsMask):
+        (WebCore::desiredFamilyToAvailableFamilyDictionary):
+        (WebCore::rememberDesiredFamilyToAvailableFamilyMapping):
+        (WebCore::fontWithFamily):
+        (WebCore::invalidateFontCache):
+        (WebCore::FontCache::getTraitsInFamily):
+        (WebCore::FontCache::createFontPlatformData):
+        * platform/mac/WebFontCache.h: Removed.
+        * platform/mac/WebFontCache.mm: Removed.
+
</ins><span class="cx"> 2014-11-14  Daniel Bates  &lt;dabates@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] NSFileManager and QuickLook SPI not available in public SDK
</span></span></pre></div>
<a id="trunkSourceWebCoreConfigurationsWebCorexcconfig"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Configurations/WebCore.xcconfig (176145 => 176146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Configurations/WebCore.xcconfig        2014-11-14 23:50:35 UTC (rev 176145)
+++ trunk/Source/WebCore/Configurations/WebCore.xcconfig        2014-11-15 00:02:57 UTC (rev 176146)
</span><span class="lines">@@ -122,6 +122,6 @@
</span><span class="cx"> EXCLUDED_SOURCE_FILE_NAMES_FOR_GESTURE_EVENTS_IF_ENABLED_ = JSGesture* DOMGesture*;
</span><span class="cx"> 
</span><span class="cx"> EXCLUDED_SOURCE_FILE_NAMES = $(EXCLUDED_SOURCE_FILE_NAMES_$(PLATFORM_NAME));
</span><del>-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 WebFontCache.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);
</del><ins>+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 DisplayRefresh
 MonitorMac.cpp $(EXCLUDED_SOURCE_FILE_NAMES_FOR_TOUCH_EVENTS) $(EXCLUDED_SOURCE_FILE_NAMES_FOR_GESTURE_EVENTS);
</ins><span class="cx"> EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(EXCLUDED_SOURCE_FILE_NAMES_iphoneos);
</span><span class="cx"> 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);
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformMaccmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformMac.cmake (176145 => 176146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformMac.cmake        2014-11-14 23:50:35 UTC (rev 176145)
+++ trunk/Source/WebCore/PlatformMac.cmake        2014-11-15 00:02:57 UTC (rev 176146)
</span><span class="lines">@@ -147,7 +147,6 @@
</span><span class="cx">     platform/mac/WebCoreObjCExtras.mm
</span><span class="cx">     platform/mac/WebCoreSystemInterface.mm
</span><span class="cx">     platform/mac/WebCoreView.m
</span><del>-    platform/mac/WebFontCache.mm
</del><span class="cx">     platform/mac/WebNSAttributedStringExtras.mm
</span><span class="cx">     platform/mac/WebVideoFullscreenController.mm
</span><span class="cx">     platform/mac/WebVideoFullscreenHUDWindowController.mm
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (176145 => 176146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-11-14 23:50:35 UTC (rev 176145)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-11-15 00:02:57 UTC (rev 176146)
</span><span class="lines">@@ -2281,7 +2281,6 @@
</span><span class="cx"> .objc_class_name_WebCoreFullScreenPlaceholderView
</span><span class="cx"> .objc_class_name_WebCoreFullScreenWarningView
</span><span class="cx"> .objc_class_name_WebCoreFullScreenWindow
</span><del>-.objc_class_name_WebFontCache
</del><span class="cx"> .objc_class_name_WebWindowFadeAnimation
</span><span class="cx"> .objc_class_name_WebWindowScaleAnimation
</span><span class="cx"> __ZN7WebCore10FloatPointC1ERK8_NSPoint
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreorder"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.order (176145 => 176146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.order        2014-11-14 23:50:35 UTC (rev 176145)
+++ trunk/Source/WebCore/WebCore.order        2014-11-15 00:02:57 UTC (rev 176146)
</span><span class="lines">@@ -4721,8 +4721,6 @@
</span><span class="cx"> __ZN3WTF9HashTableIN7WebCore24FontPlatformDataCacheKeyENS_12KeyValuePairIS2_NS_6OwnPtrINS1_16FontPlatformDataEEEEENS_24KeyValuePairKeyExtractorIS7_EENS1_28FontPlatformDataCacheKeyHashENS_18HashMapValueTraitsINS1_30FontPlatformDataCacheKeyTraitsENS_10HashTraitsIS6_EEEESC_E6lookupINS_22IdentityHashTranslatorISA_EES2_EEPS7_RKT0_
</span><span class="cx"> __ZN3WTF9HashTableIN7WebCore24FontPlatformDataCacheKeyENS_12KeyValuePairIS2_NS_6OwnPtrINS1_16FontPlatformDataEEEEENS_24KeyValuePairKeyExtractorIS7_EENS1_28FontPlatformDataCacheKeyHashENS_18HashMapValueTraitsINS1_30FontPlatformDataCacheKeyTraitsENS_10HashTraitsIS6_EEEESC_E6rehashEi
</span><span class="cx"> __ZN7WebCore9FontCache22createFontPlatformDataERKNS_15FontDescriptionERKN3WTF12AtomicStringE
</span><del>-+[WebFontCache fontWithFamily:traits:weight:size:]
-+[WebFontCache internalFontWithFamily:traits:weight:size:]
</del><span class="cx"> __ZNK7WebCore14SimpleFontData9isLoadingEv
</span><span class="cx"> __ZNK7WebCore11FontMetrics35hasIdenticalAscentDescentAndLineGapERKS0_
</span><span class="cx"> __ZNK7WebCore11RenderStyle10lineHeightEv
</span><span class="lines">@@ -8235,7 +8233,6 @@
</span><span class="cx"> __ZN3WTF9HashTableINS_6StringENS_12KeyValuePairIS1_NS_6OwnPtrINS_6VectorINS_6RefPtrIN7WebCore11CSSFontFaceEEELm0ENS_15CrashOnOverflowEEEEEEENS_24KeyValuePairKeyExtractorISC_EENS_15CaseFoldingHashENS_18HashMapValueTraitsINS_10HashTraitsIS1_EENSH_ISB_EEEESI_E6rehashEi
</span><span class="cx"> __ZN3WTF17HashMapTranslatorINS_18HashMapValueTraitsINS_10HashTraitsINS_6StringEEENS2_INS_6OwnPtrINS_6VectorINS_6RefPtrIN7WebCore11CSSFontFaceEEELm0ENS_15CrashOnOverflowEEEEEEEEENS_15CaseFoldingHashEE9translateINS_12KeyValuePairIS3_SD_EES3_NS_10PassOwnPtrISC_EEEEvRT_RKT0_RKT1_
</span><span class="cx"> __ZN7WebCore9FontCache17getTraitsInFamilyERKN3WTF12AtomicStringERNS1_6VectorIjLm0ENS1_15CrashOnOverflowEEE
</span><del>-+[WebFontCache getTraits:inFamily:]
</del><span class="cx"> __ZNK7WebCore12RenderObject14nextInPreOrderEv
</span><span class="cx"> __ZNK7WebCore10RenderText16linesBoundingBoxEv
</span><span class="cx"> __ZNK7WebCore4Text23canContainRangeEndPointEv
</span><span class="lines">@@ -20522,8 +20519,6 @@
</span><span class="cx"> _OBJC_METACLASS_$_WebCoreFullScreenWarningView
</span><span class="cx"> _OBJC_CLASS_$_WebCoreFullScreenWindow
</span><span class="cx"> _OBJC_METACLASS_$_WebCoreFullScreenWindow
</span><del>-_OBJC_METACLASS_$_WebFontCache
-_OBJC_CLASS_$_WebFontCache
</del><span class="cx"> _OBJC_CLASS_$_WebGLLayer
</span><span class="cx"> _OBJC_METACLASS_$_WebGLLayer
</span><span class="cx"> _OBJC_CLASS_$_WebLayer
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (176145 => 176146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-11-14 23:50:35 UTC (rev 176145)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-11-15 00:02:57 UTC (rev 176146)
</span><span class="lines">@@ -5201,8 +5201,6 @@
</span><span class="cx">                 BC6D44EC0C07F2ED0072D2C9 /* JSHTMLEmbedElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC6D44EA0C07F2ED0072D2C9 /* JSHTMLEmbedElement.cpp */; };
</span><span class="cx">                 BC6D44ED0C07F2ED0072D2C9 /* JSHTMLEmbedElement.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6D44EB0C07F2ED0072D2C9 /* JSHTMLEmbedElement.h */; };
</span><span class="cx">                 BC6D6E2609AF943500F59759 /* ScrollView.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6D6E2509AF943500F59759 /* ScrollView.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                BC6DADEF0A195FDF00E5CD14 /* WebFontCache.h in Headers */ = {isa = PBXBuildFile; fileRef = BC6DADEE0A195FDF00E5CD14 /* WebFontCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
-                BC6DADFA0A19602B00E5CD14 /* WebFontCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC6DADF90A19602B00E5CD14 /* WebFontCache.mm */; };
</del><span class="cx">                 BC74DA371013F3F7007987AD /* RGBColor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC74DA351013F3F7007987AD /* RGBColor.h */; };
</span><span class="cx">                 BC74DA381013F3F7007987AD /* RGBColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC74DA361013F3F7007987AD /* RGBColor.cpp */; };
</span><span class="cx">                 BC74DA481013F468007987AD /* JSRGBColor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC74DA461013F468007987AD /* JSRGBColor.cpp */; };
</span><span class="lines">@@ -12596,8 +12594,6 @@
</span><span class="cx">                 BC6D44EA0C07F2ED0072D2C9 /* JSHTMLEmbedElement.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLEmbedElement.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 BC6D44EB0C07F2ED0072D2C9 /* JSHTMLEmbedElement.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSHTMLEmbedElement.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 BC6D6E2509AF943500F59759 /* ScrollView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ScrollView.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                BC6DADEE0A195FDF00E5CD14 /* WebFontCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebFontCache.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                BC6DADF90A19602B00E5CD14 /* WebFontCache.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebFontCache.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 BC74DA351013F3F7007987AD /* RGBColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RGBColor.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 BC74DA361013F3F7007987AD /* RGBColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RGBColor.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 BC74DA461013F468007987AD /* JSRGBColor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRGBColor.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -16482,8 +16478,6 @@
</span><span class="cx">                                 93EB169409F880B00091F8FF /* WebCoreSystemInterface.mm */,
</span><span class="cx">                                 BE855F7F0701E83500239769 /* WebCoreView.h */,
</span><span class="cx">                                 BE8560510701F91100239769 /* WebCoreView.m */,
</span><del>-                                BC6DADEE0A195FDF00E5CD14 /* WebFontCache.h */,
-                                BC6DADF90A19602B00E5CD14 /* WebFontCache.mm */,
</del><span class="cx">                                 E1A3162B134BC32D007C9A4F /* WebNSAttributedStringExtras.h */,
</span><span class="cx">                                 E1A3162C134BC32D007C9A4F /* WebNSAttributedStringExtras.mm */,
</span><span class="cx">                                 CD8203061395AB6A00F956C6 /* WebVideoFullscreenController.h */,
</span><span class="lines">@@ -26599,7 +26593,6 @@
</span><span class="cx">                                 A5E616741894581F009ADF50 /* WebDebuggerAgent.h in Headers */,
</span><span class="cx">                                 FE0D84E910484348001A179E /* WebEvent.h in Headers */,
</span><span class="cx">                                 225A16B50D5C11E900090295 /* WebEventRegion.h in Headers */,
</span><del>-                                BC6DADEF0A195FDF00E5CD14 /* WebFontCache.h in Headers */,
</del><span class="cx">                                 A7D20F6D107F438B00A80392 /* WebGLActiveInfo.h in Headers */,
</span><span class="cx">                                 49C7B9C91042D32F0009D447 /* WebGLBuffer.h in Headers */,
</span><span class="cx">                                 7E66E23416D6EB6C00F7E7FF /* WebGLCompressedTextureATC.h in Headers */,
</span><span class="lines">@@ -29878,7 +29871,6 @@
</span><span class="cx">                                 A5E616731894581F009ADF50 /* WebDebuggerAgent.cpp in Sources */,
</span><span class="cx">                                 FE0D84EB1048436E001A179E /* WebEvent.mm in Sources */,
</span><span class="cx">                                 225A16B60D5C11E900090295 /* WebEventRegion.mm in Sources */,
</span><del>-                                BC6DADFA0A19602B00E5CD14 /* WebFontCache.mm in Sources */,
</del><span class="cx">                                 49C7B9C81042D32F0009D447 /* WebGLBuffer.cpp in Sources */,
</span><span class="cx">                                 7E66E23316D6EB6C00F7E7FF /* WebGLCompressedTextureATC.cpp in Sources */,
</span><span class="cx">                                 7E66E23317E6EB6C00F7E7FF /* WebGLCompressedTexturePVRTC.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacFontCacheMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm (176145 => 176146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm        2014-11-14 23:50:35 UTC (rev 176145)
+++ trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm        2014-11-15 00:02:57 UTC (rev 176146)
</span><span class="lines">@@ -37,8 +37,8 @@
</span><span class="cx"> #import &quot;SimpleFontData.h&quot;
</span><span class="cx"> #import &quot;FontPlatformData.h&quot;
</span><span class="cx"> #import &quot;NSFontSPI.h&quot;
</span><ins>+#import &quot;WebCoreNSStringExtras.h&quot;
</ins><span class="cx"> #import &quot;WebCoreSystemInterface.h&quot;
</span><del>-#import &quot;WebFontCache.h&quot;
</del><span class="cx"> #import &lt;AppKit/AppKit.h&gt;
</span><span class="cx"> #import &lt;wtf/MainThread.h&gt;
</span><span class="cx"> #import &lt;wtf/NeverDestroyed.h&gt;
</span><span class="lines">@@ -48,6 +48,229 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+#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;
+}
+
+static inline FontTraitsMask toTraitsMask(NSFontTraitMask appKitTraits, NSInteger appKitWeight)
+{
+    return static_cast&lt;FontTraitsMask&gt;(((appKitTraits &amp; NSFontItalicTrait) ? FontStyleItalicMask : FontStyleNormalMask)
+        | FontVariantNormalMask
+        | (appKitWeight == 1 ? FontWeight100Mask :
+            appKitWeight == 2 ? FontWeight200Mask :
+            appKitWeight &lt;= 4 ? FontWeight300Mask :
+            appKitWeight == 5 ? FontWeight400Mask :
+            appKitWeight == 6 ? FontWeight500Mask :
+            appKitWeight &lt;= 8 ? FontWeight600Mask :
+            appKitWeight == 9 ? FontWeight700Mask :
+            appKitWeight &lt;= 11 ? FontWeight800Mask :
+                FontWeight900Mask));
+}
+
+// Keep a cache for mapping desired font families to font families actually
+// available on the system for performance.
+static NSMutableDictionary* desiredFamilyToAvailableFamilyDictionary()
+{
+    ASSERT(isMainThread());
+    static NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
+    return dictionary;
+}
+
+static inline void rememberDesiredFamilyToAvailableFamilyMapping(NSString* desiredFamily, NSString* availableFamily)
+{
+    static const NSUInteger maxCacheSize = 128;
+    NSMutableDictionary *familyMapping = desiredFamilyToAvailableFamilyDictionary();
+    ASSERT([familyMapping count] &lt;= maxCacheSize);
+    if ([familyMapping count] == maxCacheSize) {
+        for (NSString *key in familyMapping) {
+            [familyMapping removeObjectForKey:key];
+            break;
+        }
+    }
+    id value = availableFamily ? availableFamily : [NSNull null];
+    [familyMapping setObject:value forKey:desiredFamily];
+}
+
+// Family name is somewhat of a misnomer here. We first attempt to find an exact match
+// comparing the desiredFamily to the PostScript name of the installed fonts. If that fails
+// we then do a search based on the family names of the installed fonts.
+static NSFont *fontWithFamily(NSString *desiredFamily, NSFontTraitMask desiredTraits, int desiredWeight, float size)
+{
+    if (stringIsCaseInsensitiveEqualToString(desiredFamily, @&quot;-webkit-system-font&quot;)
+        || stringIsCaseInsensitiveEqualToString(desiredFamily, @&quot;-apple-system-font&quot;)) {
+        // We ignore italic for system font.
+        return (desiredWeight &gt;= 7) ? [NSFont boldSystemFontOfSize:size] : [NSFont systemFontOfSize:size];
+    }
+
+    id cachedAvailableFamily = [desiredFamilyToAvailableFamilyDictionary() objectForKey:desiredFamily];
+    if (cachedAvailableFamily == [NSNull null]) {
+        // We already know this font is not available.
+        return nil;
+    }
+
+    NSFontManager *fontManager = [NSFontManager sharedFontManager];
+    NSString *availableFamily = cachedAvailableFamily;
+    if (!availableFamily) {
+        // 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;
+            NSFontTraitMask desiredTraitsForNameMatch = desiredTraits | (desiredWeight &gt;= 7 ? NSBoldFontMask : 0);
+            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 nameMatchedFont;
+
+                    NSFontTraitMask traits = [fontManager traitsOfFont:nameMatchedFont];
+                    if ((traits &amp; desiredTraitsForNameMatch) == desiredTraitsForNameMatch)
+                        return [fontManager convertFont:nameMatchedFont toHaveTrait:desiredTraitsForNameMatch];
+
+                    availableFamily = [nameMatchedFont familyName];
+                    break;
+                }
+            }
+        }
+
+        rememberDesiredFamilyToAvailableFamilyMapping(desiredFamily, availableFamily);
+        if (!availableFamily)
+            return nil;
+    }
+
+    // Found a family, now figure out what weight and traits to use.
+    bool choseFont = false;
+    int chosenWeight = 0;
+    NSFontTraitMask chosenTraits = 0;
+    NSString *chosenFullName = 0;
+
+    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, desiredWeight, chosenTraits, chosenWeight, fontTraits, fontWeight);
+
+        if (newWinner) {
+            choseFont = YES;
+            chosenWeight = fontWeight;
+            chosenTraits = fontTraits;
+            chosenFullName = fontFullName;
+
+            if (chosenWeight == desiredWeight &amp;&amp; (chosenTraits &amp; IMPORTANT_FONT_TRAITS) == (desiredTraits &amp; IMPORTANT_FONT_TRAITS))
+                break;
+        }
+    }
+
+    if (!choseFont)
+        return nil;
+
+    NSFont *font = [NSFont fontWithName:chosenFullName size:size];
+
+    if (!font)
+        return nil;
+
+    NSFontTraitMask actualTraits = 0;
+    if (desiredTraits &amp; NSFontItalicTrait)
+        actualTraits = [fontManager traitsOfFont:font];
+    int actualWeight = [fontManager weightOfFont:font];
+
+    bool syntheticBold = desiredWeight &gt;= 7 &amp;&amp; actualWeight &lt; 7;
+    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 font;
+}
+
</ins><span class="cx"> // The &quot;void*&quot; parameter makes the function match the prototype for callbacks from callOnMainThread.
</span><span class="cx"> static void invalidateFontCache(void*)
</span><span class="cx"> {
</span><span class="lines">@@ -56,7 +279,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     fontCache().invalidate();
</span><del>-    [WebFontCache invalidate];
</del><ins>+    [desiredFamilyToAvailableFamilyDictionary() removeAllObjects];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void fontCacheRegisteredFontsChangedNotificationCallback(CFNotificationCenterRef, void* observer, CFStringRef name, const void *, CFDictionaryRef)
</span><span class="lines">@@ -221,7 +444,35 @@
</span><span class="cx"> 
</span><span class="cx"> void FontCache::getTraitsInFamily(const AtomicString&amp; familyName, Vector&lt;unsigned&gt;&amp; traitsMasks)
</span><span class="cx"> {
</span><del>-    [WebFontCache getTraits:traitsMasks inFamily:familyName];
</del><ins>+    NSFontManager *fontManager = [NSFontManager sharedFontManager];
+
+    NSString *availableFamily;
+    for (availableFamily in [fontManager availableFontFamilies]) {
+        if ([familyName caseInsensitiveCompare:availableFamily] == NSOrderedSame)
+            break;
+    }
+
+    if (!availableFamily) {
+        // Match by PostScript name.
+        for (NSString *availableFont in [fontManager availableFonts]) {
+            if ([familyName caseInsensitiveCompare:availableFont] == NSOrderedSame) {
+                NSFont *font = [NSFont fontWithName:availableFont size:10];
+                NSInteger weight = [fontManager weightOfFont:font];
+                traitsMasks.append(toTraitsMask([fontManager traitsOfFont:font], weight));
+                break;
+            }
+        }
+        return;
+    }
+
+    NSArray *fonts = [fontManager availableMembersOfFontFamily:availableFamily];
+    traitsMasks.reserveCapacity([fonts count]);
+    for (NSArray *fontInfo in fonts) {
+        // Array indices must be hard coded because of lame AppKit API.
+        NSInteger fontWeight = [[fontInfo objectAtIndex:2] intValue];
+        NSFontTraitMask fontTraits = [[fontInfo objectAtIndex:3] unsignedIntValue];
+        traitsMasks.uncheckedAppend(toTraitsMask(fontTraits, fontWeight));
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;FontPlatformData&gt; FontCache::createFontPlatformData(const FontDescription&amp; fontDescription, const AtomicString&amp; family)
</span><span class="lines">@@ -230,10 +481,20 @@
</span><span class="cx">     NSInteger weight = toAppKitFontWeight(fontDescription.weight());
</span><span class="cx">     float size = fontDescription.computedPixelSize();
</span><span class="cx"> 
</span><del>-    NSFont *nsFont = [WebFontCache fontWithFamily:family traits:traits weight:weight size:size shouldAutoActivateIfNeeded:shouldAutoActivateFontIfNeeded(family)];
-    if (!nsFont)
-        return nullptr;
</del><ins>+    NSFont *nsFont = fontWithFamily(family, traits, weight, size);
+    if (!nsFont) {
+        if (!shouldAutoActivateFontIfNeeded(family))
+            return nullptr;
</ins><span class="cx"> 
</span><ins>+        // Auto activate the font before looking for it a second time.
+        // Ignore the result because we want to use our own algorithm to actually find the font.
+        [NSFont fontWithName:family size:size];
+
+        nsFont = fontWithFamily(family, traits, weight, size);
+        if (!nsFont)
+            return nullptr;
+    }
+
</ins><span class="cx">     NSFontManager *fontManager = [NSFontManager sharedFontManager];
</span><span class="cx">     NSFontTraitMask actualTraits = 0;
</span><span class="cx">     if (fontDescription.italic())
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacWebFontCacheh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/mac/WebFontCache.h (176145 => 176146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/WebFontCache.h        2014-11-14 23:50:35 UTC (rev 176145)
+++ trunk/Source/WebCore/platform/mac/WebFontCache.h        2014-11-15 00:02:57 UTC (rev 176146)
</span><span class="lines">@@ -1,39 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006, 2008 Apple Inc.  All rights reserved.
- * Copyright (C) 2007 Nicholas Shanks &lt;webkit@nickshanks.com&gt;
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-#import &lt;AppKit/NSFontManager.h&gt;
-#import &lt;wtf/Vector.h&gt;
-
-// This interface exists so that third party products (like Silk) can patch in to an Obj-C method to manipulate WebKit's font caching/substitution.
-WEBCORE_EXPORT @interface WebFontCache : NSObject
-+ (NSFont *)fontWithFamily:(NSString *)desiredFamily traits:(NSFontTraitMask)desiredTraits weight:(int)desiredWeight size:(float)size shouldAutoActivateIfNeeded:(BOOL)shouldAutoActivateIfNeeded;
-+ (NSFont *)fontWithFamily:(NSString *)desiredFamily traits:(NSFontTraitMask)desiredTraits weight:(int)desiredWeight size:(float)size;
-+ (void)getTraits:(Vector&lt;unsigned&gt;&amp;)traitsMasks inFamily:(NSString *)desiredFamily;
-+ (void)invalidate;
-
-// This older version of the interface is relied upon by some clients. WebCore doesn't use it.
-+ (NSFont *)fontWithFamily:(NSString *)desiredFamily traits:(NSFontTraitMask)desiredTraits size:(float)size;
-@end
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformmacWebFontCachemm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/mac/WebFontCache.mm (176145 => 176146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/WebFontCache.mm        2014-11-14 23:50:35 UTC (rev 176145)
+++ trunk/Source/WebCore/platform/mac/WebFontCache.mm        2014-11-15 00:02:57 UTC (rev 176146)
</span><span class="lines">@@ -1,330 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
- * Copyright (C) 2007 Nicholas Shanks &lt;webkit@nickshanks.com&gt;
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Inc. (&quot;Apple&quot;) nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS &quot;AS IS&quot; AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import &quot;config.h&quot;
-#import &quot;WebFontCache.h&quot;
-
-#import &quot;FontTraitsMask.h&quot;
-#import &quot;WebCoreNSStringExtras.h&quot;
-#import &lt;AppKit/AppKit.h&gt;
-#import &lt;Foundation/Foundation.h&gt;
-#import &lt;math.h&gt;
-#import &lt;wtf/MainThread.h&gt;
-
-using namespace WebCore;
-
-#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 NO;
-
-    // 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) != 0;
-        BOOL chosenHasUnwantedTrait = desired != ((chosenTraits &amp; mask) != 0);
-        BOOL candidateHasUnwantedTrait = desired != ((candidateTraits &amp; mask) != 0);
-        if (!candidateHasUnwantedTrait &amp;&amp; chosenHasUnwantedTrait)
-            return YES;
-        if (!chosenHasUnwantedTrait &amp;&amp; candidateHasUnwantedTrait)
-            return NO;
-    }
-
-    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;
-}
-
-static inline FontTraitsMask toTraitsMask(NSFontTraitMask appKitTraits, NSInteger appKitWeight)
-{
-    return static_cast&lt;FontTraitsMask&gt;(((appKitTraits &amp; NSFontItalicTrait) ? FontStyleItalicMask : FontStyleNormalMask)
-        | FontVariantNormalMask
-        | (appKitWeight == 1 ? FontWeight100Mask :
-              appKitWeight == 2 ? FontWeight200Mask :
-              appKitWeight &lt;= 4 ? FontWeight300Mask :
-              appKitWeight == 5 ? FontWeight400Mask :
-              appKitWeight == 6 ? FontWeight500Mask :
-              appKitWeight &lt;= 8 ? FontWeight600Mask :
-              appKitWeight == 9 ? FontWeight700Mask :
-              appKitWeight &lt;= 11 ? FontWeight800Mask :
-                                   FontWeight900Mask));
-}
-
-// Keep a cache for mapping desired font families to font families actually
-// available on the system for performance.
-static NSMutableDictionary* desiredFamilyToAvailableFamilyDictionary()
-{
-    ASSERT(isMainThread());
-    static NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
-    return dictionary;
-}
-
-static inline void rememberDesiredFamilyToAvailableFamilyMapping(NSString* desiredFamily, NSString* availableFamily)
-{
-    static const NSUInteger maxCacheSize = 128;
-    NSMutableDictionary *familyMapping = desiredFamilyToAvailableFamilyDictionary();
-    ASSERT([familyMapping count] &lt;= maxCacheSize);
-    if ([familyMapping count] == maxCacheSize) {
-        for (NSString *key in familyMapping) {
-            [familyMapping removeObjectForKey:key];
-            break;
-        }
-    }
-    id value = availableFamily ? availableFamily : [NSNull null];
-    [familyMapping setObject:value forKey:desiredFamily];
-}
-
-@implementation WebFontCache
-
-+ (void)getTraits:(Vector&lt;unsigned&gt;&amp;)traitsMasks inFamily:(NSString *)desiredFamily
-{
-    NSFontManager *fontManager = [NSFontManager sharedFontManager];
-
-    NSString *availableFamily;
-    for (availableFamily in [fontManager availableFontFamilies]) {
-        if ([desiredFamily caseInsensitiveCompare:availableFamily] == NSOrderedSame)
-            break;
-    }
-
-    if (!availableFamily) {
-        // Match by PostScript name.
-        for (NSString *availableFont in [fontManager availableFonts]) {
-            if ([desiredFamily caseInsensitiveCompare:availableFont] == NSOrderedSame) {
-                NSFont *font = [NSFont fontWithName:availableFont size:10];
-                NSInteger weight = [fontManager weightOfFont:font];
-                traitsMasks.append(toTraitsMask([fontManager traitsOfFont:font], weight));
-                break;
-            }
-        }
-        return;
-    }
-
-    NSArray *fonts = [fontManager availableMembersOfFontFamily:availableFamily];
-    traitsMasks.reserveCapacity([fonts count]);
-    for (NSArray *fontInfo in fonts) {
-        // Array indices must be hard coded because of lame AppKit API.
-        NSInteger fontWeight = [[fontInfo objectAtIndex:2] intValue];
-        NSFontTraitMask fontTraits = [[fontInfo objectAtIndex:3] unsignedIntValue];
-        traitsMasks.uncheckedAppend(toTraitsMask(fontTraits, fontWeight));
-    }
-}
-
-// Family name is somewhat of a misnomer here.  We first attempt to find an exact match
-// comparing the desiredFamily to the PostScript name of the installed fonts.  If that fails
-// we then do a search based on the family names of the installed fonts.
-+ (NSFont *)internalFontWithFamily:(NSString *)desiredFamily traits:(NSFontTraitMask)desiredTraits weight:(int)desiredWeight size:(float)size
-{
-    if (stringIsCaseInsensitiveEqualToString(desiredFamily, @&quot;-webkit-system-font&quot;)
-        || stringIsCaseInsensitiveEqualToString(desiredFamily, @&quot;-apple-system-font&quot;)) {
-        // We ignore italic for system font.
-        return (desiredWeight &gt;= 7) ? [NSFont boldSystemFontOfSize:size] : [NSFont systemFontOfSize:size];
-    }
-
-    id cachedAvailableFamily = [desiredFamilyToAvailableFamilyDictionary() objectForKey:desiredFamily];
-    if (cachedAvailableFamily == [NSNull null]) {
-        // We already know this font is not available.
-        return nil;
-    }
-
-    NSFontManager *fontManager = [NSFontManager sharedFontManager];
-    NSString *availableFamily = cachedAvailableFamily;
-    if (!availableFamily) {
-        // 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;
-            NSFontTraitMask desiredTraitsForNameMatch = desiredTraits | (desiredWeight &gt;= 7 ? NSBoldFontMask : 0);
-            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 nameMatchedFont;
-
-                    NSFontTraitMask traits = [fontManager traitsOfFont:nameMatchedFont];
-                    if ((traits &amp; desiredTraitsForNameMatch) == desiredTraitsForNameMatch)
-                        return [fontManager convertFont:nameMatchedFont toHaveTrait:desiredTraitsForNameMatch];
-
-                    availableFamily = [nameMatchedFont familyName];
-                    break;
-                }
-            }
-        }
-
-        rememberDesiredFamilyToAvailableFamilyMapping(desiredFamily, availableFamily);
-        if (!availableFamily)
-            return nil;
-    }
-
-    // Found a family, now figure out what weight and traits to use.
-    BOOL choseFont = false;
-    int chosenWeight = 0;
-    NSFontTraitMask chosenTraits = 0;
-    NSString *chosenFullName = 0;
-
-    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, desiredWeight, chosenTraits, chosenWeight, fontTraits, fontWeight);
-
-        if (newWinner) {
-            choseFont = YES;
-            chosenWeight = fontWeight;
-            chosenTraits = fontTraits;
-            chosenFullName = fontFullName;
-
-            if (chosenWeight == desiredWeight &amp;&amp; (chosenTraits &amp; IMPORTANT_FONT_TRAITS) == (desiredTraits &amp; IMPORTANT_FONT_TRAITS))
-                break;
-        }
-    }
-
-    if (!choseFont)
-        return nil;
-
-    NSFont *font = [NSFont fontWithName:chosenFullName size:size];
-
-    if (!font)
-        return nil;
-
-    NSFontTraitMask actualTraits = 0;
-    if (desiredTraits &amp; NSFontItalicTrait)
-        actualTraits = [fontManager traitsOfFont:font];
-    int actualWeight = [fontManager weightOfFont:font];
-
-    bool syntheticBold = desiredWeight &gt;= 7 &amp;&amp; actualWeight &lt; 7;
-    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 font;
-}
-
-+ (NSFont *)fontWithFamily:(NSString *)desiredFamily traits:(NSFontTraitMask)desiredTraits weight:(int)desiredWeight size:(float)size shouldAutoActivateIfNeeded:(BOOL)shouldAutoActivateIfNeeded
-{
-    NSFont *font = [self internalFontWithFamily:desiredFamily traits:desiredTraits weight:desiredWeight size:size];
-    if (font || !shouldAutoActivateIfNeeded)
-        return font;
-
-    // Auto activate the font before looking for it a second time.
-    // Ignore the result because we want to use our own algorithm to actually find the font.
-    [NSFont fontWithName:desiredFamily size:size];
-
-    return [self internalFontWithFamily:desiredFamily traits:desiredTraits weight:desiredWeight size:size];
-}
-
-+ (NSFont *)fontWithFamily:(NSString *)desiredFamily traits:(NSFontTraitMask)desiredTraits weight:(int)desiredWeight size:(float)size
-{
-    return [self fontWithFamily:desiredFamily traits:desiredTraits weight:desiredWeight size:size shouldAutoActivateIfNeeded:YES];
-}
-
-+ (NSFont *)fontWithFamily:(NSString *)desiredFamily traits:(NSFontTraitMask)desiredTraits size:(float)size
-{
-    int desiredWeight = (desiredTraits &amp; NSBoldFontMask) ? 9 : 5;
-    return [self fontWithFamily:desiredFamily traits:desiredTraits weight:desiredWeight size:size shouldAutoActivateIfNeeded:YES];
-}
-
-+ (void)invalidate
-{
-    [desiredFamilyToAvailableFamilyDictionary() removeAllObjects];
-}
-@end
</del></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (176145 => 176146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-11-14 23:50:35 UTC (rev 176145)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-11-15 00:02:57 UTC (rev 176146)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2014-11-14  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        Get rid of WebFontCache
+        https://bugs.webkit.org/show_bug.cgi?id=134752
+
+        Reviewed by Dave Hyatt.
+
+        * WebView/WebHTMLView.mm:
+
</ins><span class="cx"> 2014-11-14  Timothy Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Update some artwork for the legacy WebKit action menu
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebHTMLViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (176145 => 176146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2014-11-14 23:50:35 UTC (rev 176145)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2014-11-15 00:02:57 UTC (rev 176146)
</span><span class="lines">@@ -135,7 +135,6 @@
</span><span class="cx"> #import &lt;ApplicationServices/ApplicationServices.h&gt;
</span><span class="cx"> #import &quot;WebNSEventExtras.h&quot;
</span><span class="cx"> #import &quot;WebNSPasteboardExtras.h&quot;
</span><del>-#import &lt;WebCore/WebFontCache.h&gt;
</del><span class="cx"> #import &lt;WebCore/PlatformEventFactoryMac.h&gt;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>