<!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>[183269] 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/183269">183269</a></dd>
<dt>Author</dt> <dd>mmaxfield@apple.com</dd>
<dt>Date</dt> <dd>2015-04-24 11:12:31 -0700 (Fri, 24 Apr 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Cocoa] Start cleaning up FontPlatformData
https://bugs.webkit.org/show_bug.cgi?id=144133

Reviewed by Enrica Casucci.

Source/WebCore:

This is the start of a crusade to ultimately remove one of the CTFontRefs which we have inside
FontPlatformData. This patch starts this effort out by removing the FontPlatformData
constructor which accepts an NSFont. This constructor simply casts the NSFont to a CTFontRef,
and forwards to another constructor. This patch moves this cast to callers of this constructor,
thereby enumerating the places we have left that use NSFont with FontPlatformData.

This patch also cleans up two of the constructors in FontPlatformData.cpp to forward on to
a common constructor.

This patch also collects places inside FontPlatformDataCocoa.mm where we check if a pointer is
not 0 and not -1, and puts this common code inside a new function,
FontPlatformData::isValidCTFontRef().

No new tests because there is no behavior change.

* platform/graphics/FontPlatformData.cpp:
(WebCore::FontPlatformData::FontPlatformData): Coalesce constructors.
* platform/graphics/FontPlatformData.h:
(WebCore::FontPlatformData::isValidCTFontRef): Check if a pointer is not 0 and not -1.
(WebCore::FontPlatformData::hashTableDeletedFontValue): Deleted.
* platform/graphics/cocoa/FontCocoa.mm:
(WebCore::Font::platformCreateScaledFont): Receive cast which has been hoisted from the deleted
FontPlatformData constructor.
(WebCore::Font::compositeFontReferenceFont): Ditto.
* platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::FontPlatformData::~FontPlatformData): Use isValidCTFontRef().
(WebCore::FontPlatformData::platformDataInit): Ditto.
(WebCore::FontPlatformData::platformDataAssign): Ditto.
(WebCore::FontPlatformData::platformIsEqual): Simplify preprocessor macros.
(WebCore::FontPlatformData::allowsLigatures): Remove unnecessary NSFont use.
(WebCore::FontPlatformData::FontPlatformData): Deleted.
* platform/graphics/mac/ComplexTextControllerCoreText.mm:
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Remove unnecessary
NSFont use.
* platform/graphics/mac/FontCacheMac.mm:
(WebCore::FontCache::systemFallbackForCharacters): Receive cast which has been hoisted from the
deleted FontPlatformData constructor.
(WebCore::FontCache::createFontPlatformData): Ditto.
* platform/mac/DragImageMac.mm:
(WebCore::fontFromNSFont): Ditto.
(WebCore::widthWithFont): Ditto.
(WebCore::drawAtPoint): Ditto.

Source/WebKit/mac:

Receive casts which have been hoisted from the deleted FontPlatformData constructor.

* Misc/WebKitNSStringExtras.mm:
(-[NSString _web_drawAtPoint:font:textColor:allowingFontSmoothing:]): Receive cast which has
been hoisted from the deleted FontPlatformData constructor.
(-[NSString _web_widthWithFont:]): Ditto.
* Misc/WebStringTruncator.mm:
(fontFromNSFont): Ditto.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFontPlatformDatacpp">trunk/Source/WebCore/platform/graphics/FontPlatformData.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFontPlatformDatah">trunk/Source/WebCore/platform/graphics/FontPlatformData.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaFontCocoamm">trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaFontPlatformDataCocoamm">trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacComplexTextControllerCoreTextmm">trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacFontCacheMacmm">trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformmacDragImageMacmm">trunk/Source/WebCore/platform/mac/DragImageMac.mm</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebKitNSStringExtrasmm">trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebStringTruncatormm">trunk/Source/WebKit/mac/Misc/WebStringTruncator.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (183268 => 183269)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-04-24 18:02:30 UTC (rev 183268)
+++ trunk/Source/WebCore/ChangeLog        2015-04-24 18:12:31 UTC (rev 183269)
</span><span class="lines">@@ -1,3 +1,53 @@
</span><ins>+2015-04-24  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        [Cocoa] Start cleaning up FontPlatformData
+        https://bugs.webkit.org/show_bug.cgi?id=144133
+
+        Reviewed by Enrica Casucci.
+
+        This is the start of a crusade to ultimately remove one of the CTFontRefs which we have inside
+        FontPlatformData. This patch starts this effort out by removing the FontPlatformData
+        constructor which accepts an NSFont. This constructor simply casts the NSFont to a CTFontRef,
+        and forwards to another constructor. This patch moves this cast to callers of this constructor,
+        thereby enumerating the places we have left that use NSFont with FontPlatformData.
+
+        This patch also cleans up two of the constructors in FontPlatformData.cpp to forward on to
+        a common constructor.
+
+        This patch also collects places inside FontPlatformDataCocoa.mm where we check if a pointer is
+        not 0 and not -1, and puts this common code inside a new function,
+        FontPlatformData::isValidCTFontRef().
+
+        No new tests because there is no behavior change.
+
+        * platform/graphics/FontPlatformData.cpp:
+        (WebCore::FontPlatformData::FontPlatformData): Coalesce constructors.
+        * platform/graphics/FontPlatformData.h:
+        (WebCore::FontPlatformData::isValidCTFontRef): Check if a pointer is not 0 and not -1.
+        (WebCore::FontPlatformData::hashTableDeletedFontValue): Deleted.
+        * platform/graphics/cocoa/FontCocoa.mm:
+        (WebCore::Font::platformCreateScaledFont): Receive cast which has been hoisted from the deleted
+        FontPlatformData constructor.
+        (WebCore::Font::compositeFontReferenceFont): Ditto.
+        * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
+        (WebCore::FontPlatformData::~FontPlatformData): Use isValidCTFontRef().
+        (WebCore::FontPlatformData::platformDataInit): Ditto.
+        (WebCore::FontPlatformData::platformDataAssign): Ditto.
+        (WebCore::FontPlatformData::platformIsEqual): Simplify preprocessor macros.
+        (WebCore::FontPlatformData::allowsLigatures): Remove unnecessary NSFont use.
+        (WebCore::FontPlatformData::FontPlatformData): Deleted.
+        * platform/graphics/mac/ComplexTextControllerCoreText.mm:
+        (WebCore::ComplexTextController::collectComplexTextRunsForCharacters): Remove unnecessary
+        NSFont use.
+        * platform/graphics/mac/FontCacheMac.mm:
+        (WebCore::FontCache::systemFallbackForCharacters): Receive cast which has been hoisted from the
+        deleted FontPlatformData constructor.
+        (WebCore::FontCache::createFontPlatformData): Ditto.
+        * platform/mac/DragImageMac.mm:
+        (WebCore::fontFromNSFont): Ditto.
+        (WebCore::widthWithFont): Ditto.
+        (WebCore::drawAtPoint): Ditto.
+
</ins><span class="cx"> 2015-04-24  Doug Russell  &lt;d_russell@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: richer text change notifications (142719)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontPlatformDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FontPlatformData.cpp (183268 => 183269)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FontPlatformData.cpp        2015-04-24 18:02:30 UTC (rev 183268)
+++ trunk/Source/WebCore/platform/graphics/FontPlatformData.cpp        2015-04-24 18:12:31 UTC (rev 183269)
</span><span class="lines">@@ -61,25 +61,17 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(CG)
</span><span class="cx"> FontPlatformData::FontPlatformData(CGFontRef cgFont, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, FontWidthVariant widthVariant)
</span><del>-    : m_syntheticBold(syntheticBold)
-    , m_syntheticOblique(syntheticOblique)
-    , m_orientation(orientation)
-    , m_size(size)
-    , m_widthVariant(widthVariant)
-    , m_cgFont(cgFont)
</del><ins>+    : FontPlatformData(size, syntheticBold, syntheticOblique, orientation, widthVariant)
</ins><span class="cx"> {
</span><ins>+    m_cgFont = cgFont;
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> FontPlatformData::FontPlatformData(const FontPlatformData&amp; source)
</span><del>-    : m_syntheticBold(source.m_syntheticBold)
-    , m_syntheticOblique(source.m_syntheticOblique)
-    , m_orientation(source.m_orientation)
-    , m_size(source.m_size)
-    , m_widthVariant(source.m_widthVariant)
-    , m_isColorBitmapFont(source.m_isColorBitmapFont)
-    , m_isCompositeFontReference(source.m_isCompositeFontReference)
</del><ins>+    : FontPlatformData(source.m_size, source.m_syntheticBold, source.m_syntheticOblique, source.m_orientation, source.m_widthVariant)
</ins><span class="cx"> {
</span><ins>+    m_isColorBitmapFont = source.m_isColorBitmapFont;
+    m_isCompositeFontReference = source.m_isCompositeFontReference;
</ins><span class="cx">     platformDataInit(source);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontPlatformDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FontPlatformData.h (183268 => 183269)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FontPlatformData.h        2015-04-24 18:02:30 UTC (rev 183268)
+++ trunk/Source/WebCore/platform/graphics/FontPlatformData.h        2015-04-24 18:12:31 UTC (rev 183269)
</span><span class="lines">@@ -86,11 +86,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     WEBCORE_EXPORT FontPlatformData(CTFontRef, float size, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal, FontWidthVariant = RegularWidth);
</span><del>-#if USE(APPKIT)
-    // FIXME: Remove this when all NSFont usage is removed.
-    WEBCORE_EXPORT FontPlatformData(NSFont *, float size, bool syntheticBold = false, bool syntheticOblique = false, FontOrientation = Horizontal, FontWidthVariant = RegularWidth);
</del><span class="cx"> #endif
</span><del>-#endif
</del><span class="cx"> 
</span><span class="cx"> #if USE(CG)
</span><span class="cx">     FontPlatformData(CGFontRef, float size, bool syntheticBold, bool syntheticOblique, FontOrientation, FontWidthVariant);
</span><span class="lines">@@ -206,6 +202,7 @@
</span><span class="cx">     const FontPlatformData&amp; platformDataAssign(const FontPlatformData&amp;);
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     static CTFontRef hashTableDeletedFontValue() { return reinterpret_cast&lt;CTFontRef&gt;(-1); }
</span><ins>+    static bool isValidCTFontRef(CTFontRef font) { return font &amp;&amp; font != hashTableDeletedFontValue(); }
</ins><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(WIN)
</span><span class="cx">     void platformDataInit(HFONT, float size, HDC, WCHAR* faceName);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaFontCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm (183268 => 183269)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm        2015-04-24 18:02:30 UTC (rev 183268)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCocoa.mm        2015-04-24 18:12:31 UTC (rev 183269)
</span><span class="lines">@@ -325,7 +325,7 @@
</span><span class="cx"> #if USE(APPKIT)
</span><span class="cx">     BEGIN_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> 
</span><del>-    FontPlatformData scaledFontData([[NSFontManager sharedFontManager] convertFont:m_platformData.nsFont() toSize:size], size, false, false, m_platformData.orientation());
</del><ins>+    FontPlatformData scaledFontData(reinterpret_cast&lt;CTFontRef&gt;([[NSFontManager sharedFontManager] convertFont:m_platformData.nsFont() toSize:size]), size, false, false, m_platformData.orientation());
</ins><span class="cx"> 
</span><span class="cx">     if (scaledFontData.font()) {
</span><span class="cx">         NSFontManager *fontManager = [NSFontManager sharedFontManager];
</span><span class="lines">@@ -571,7 +571,7 @@
</span><span class="cx">         bool syntheticBold = platformData().syntheticBold() &amp;&amp; !(traits &amp; kCTFontBoldTrait);
</span><span class="cx">         bool syntheticOblique = platformData().syntheticOblique() &amp;&amp; !(traits &amp; kCTFontItalicTrait);
</span><span class="cx"> 
</span><del>-        FontPlatformData substitutePlatform(substituteFont, platformData().size(), syntheticBold, syntheticOblique, platformData().orientation(), platformData().widthVariant());
</del><ins>+        FontPlatformData substitutePlatform(reinterpret_cast&lt;CTFontRef&gt;(substituteFont), platformData().size(), syntheticBold, syntheticOblique, platformData().orientation(), platformData().widthVariant());
</ins><span class="cx">         addResult.iterator-&gt;value = Font::create(substitutePlatform, isCustomFont());
</span><span class="cx">     }
</span><span class="cx">     return addResult.iterator-&gt;value.get();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaFontPlatformDataCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm (183268 => 183269)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm        2015-04-24 18:02:30 UTC (rev 183268)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm        2015-04-24 18:12:31 UTC (rev 183269)
</span><span class="lines">@@ -42,37 +42,24 @@
</span><span class="cx"> enum TextSpacingCTFeatureSelector { TextSpacingProportional, TextSpacingFullWidth, TextSpacingHalfWidth, TextSpacingThirdWidth, TextSpacingQuarterWidth };
</span><span class="cx"> 
</span><span class="cx"> FontPlatformData::FontPlatformData(CTFontRef font, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, FontWidthVariant widthVariant)
</span><del>-    : m_syntheticBold(syntheticBold)
-    , m_syntheticOblique(syntheticOblique)
-    , m_orientation(orientation)
-    , m_size(size)
-    , m_widthVariant(widthVariant)
-    , m_font(font)
-    , m_cgFont(adoptCF(CTFontCopyGraphicsFont(font, NULL)))
-    , m_isColorBitmapFont(CTFontGetSymbolicTraits(font) &amp; kCTFontTraitColorGlyphs)
-    , m_isCompositeFontReference(CTFontGetSymbolicTraits(font) &amp; kCTFontCompositeTrait)
</del><ins>+    : FontPlatformData(adoptCF(CTFontCopyGraphicsFont(font, NULL)), size, syntheticBold, syntheticOblique, orientation, widthVariant)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT_ARG(font, font);
</span><ins>+    m_font = font;
</ins><span class="cx">     CFRetain(m_font);
</span><ins>+    m_isColorBitmapFont = CTFontGetSymbolicTraits(font) &amp; kCTFontTraitColorGlyphs;
+    m_isCompositeFontReference = CTFontGetSymbolicTraits(font) &amp; kCTFontCompositeTrait;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if USE(APPKIT)
-// FIXME: Remove this when all NSFont usage is removed.
-FontPlatformData::FontPlatformData(NSFont *font, float size, bool syntheticBold, bool syntheticOblique, FontOrientation orientation, FontWidthVariant widthVariant)
-    : FontPlatformData((CTFontRef)font, size, syntheticBold, syntheticOblique, orientation, widthVariant)
-{
-}
-#endif
-
</del><span class="cx"> FontPlatformData::~FontPlatformData()
</span><span class="cx"> {
</span><del>-    if (m_font &amp;&amp; m_font != reinterpret_cast&lt;CTFontRef&gt;(-1))
</del><ins>+    if (isValidCTFontRef(m_font))
</ins><span class="cx">         CFRelease(m_font);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void FontPlatformData::platformDataInit(const FontPlatformData&amp; f)
</span><span class="cx"> {
</span><del>-    m_font = f.m_font &amp;&amp; f.m_font != reinterpret_cast&lt;CTFontRef&gt;(-1) ? static_cast&lt;CTFontRef&gt;(const_cast&lt;void *&gt;(CFRetain(f.m_font))) : f.m_font;
</del><ins>+    m_font = isValidCTFontRef(f.m_font) ? static_cast&lt;CTFontRef&gt;(const_cast&lt;void *&gt;(CFRetain(f.m_font))) : f.m_font;
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     m_isEmoji = f.m_isEmoji;
</span><span class="lines">@@ -87,11 +74,11 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     m_isEmoji = f.m_isEmoji;
</span><span class="cx"> #endif
</span><del>-    if (m_font &amp;&amp; m_font != reinterpret_cast&lt;CTFontRef&gt;(-1) &amp;&amp; f.m_font &amp;&amp; f.m_font != reinterpret_cast&lt;CTFontRef&gt;(-1) &amp;&amp; CFEqual(m_font, f.m_font))
</del><ins>+    if (isValidCTFontRef(m_font) &amp;&amp; isValidCTFontRef(f.m_font) &amp;&amp; CFEqual(m_font, f.m_font))
</ins><span class="cx">         return *this;
</span><del>-    if (f.m_font &amp;&amp; f.m_font != reinterpret_cast&lt;CTFontRef&gt;(-1))
</del><ins>+    if (isValidCTFontRef(f.m_font))
</ins><span class="cx">         CFRetain(f.m_font);
</span><del>-    if (m_font &amp;&amp; m_font != reinterpret_cast&lt;CTFontRef&gt;(-1))
</del><ins>+    if (isValidCTFontRef(m_font))
</ins><span class="cx">         CFRelease(m_font);
</span><span class="cx">     m_font = f.m_font;
</span><span class="cx">     m_ctFont = f.m_ctFont;
</span><span class="lines">@@ -104,7 +91,7 @@
</span><span class="cx">     bool result = false;
</span><span class="cx">     if (m_font || other.m_font) {
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-        result = m_font &amp;&amp; m_font != reinterpret_cast&lt;CTFontRef&gt;(-1) &amp;&amp; other.m_font &amp;&amp; other.m_font != reinterpret_cast&lt;CTFontRef&gt;(-1) &amp;&amp; CFEqual(m_font, other.m_font);
</del><ins>+        result = isValidCTFontRef(m_font) &amp;&amp; isValidCTFontRef(other.m_font) &amp;&amp; CFEqual(m_font, other.m_font);
</ins><span class="cx"> #if !ASSERT_DISABLED
</span><span class="cx">         if (result)
</span><span class="cx">             ASSERT(m_isEmoji == other.m_isEmoji);
</span><span class="lines">@@ -114,12 +101,10 @@
</span><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx">         return result;
</span><span class="cx">     }
</span><del>-#if PLATFORM(IOS)
-#if !ASSERT_DISABLED
</del><ins>+#if PLATFORM(IOS) &amp;&amp; !ASSERT_DISABLED
</ins><span class="cx">     if (m_cgFont == other.m_cgFont)
</span><span class="cx">         ASSERT(m_isEmoji == other.m_isEmoji);
</span><span class="cx"> #endif
</span><del>-#endif // PLATFORM(IOS)
</del><span class="cx">     return m_cgFont == other.m_cgFont;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -157,15 +142,11 @@
</span><span class="cx"> 
</span><span class="cx"> bool FontPlatformData::allowsLigatures() const
</span><span class="cx"> {
</span><del>-#if USE(APPKIT)
-    return ![[(NSFont *)m_font coveredCharacterSet] characterIsMember:'a'];
-#else
</del><span class="cx">     if (!m_font)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;CFCharacterSetRef&gt; characterSet = adoptCF(CTFontCopyCharacterSet(ctFont()));
</span><span class="cx">     return !(characterSet.get() &amp;&amp; CFCharacterSetIsCharacterMember(characterSet.get(), 'a'));
</span><del>-#endif
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline int mapFontWidthVariantToCTFeatureSelector(FontWidthVariant variant)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacComplexTextControllerCoreTextmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm (183268 => 183269)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm        2015-04-24 18:02:30 UTC (rev 183268)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm        2015-04-24 18:12:31 UTC (rev 183269)
</span><span class="lines">@@ -286,7 +286,7 @@
</span><span class="cx">                     // Core Text may have used a font that is not known to NSFontManager. In that case, fall back on
</span><span class="cx">                     // using the font as returned, even though it may not have the best NSFontRenderingMode.
</span><span class="cx">                     if (!runFont) {
</span><del>-                        FontPlatformData runFontPlatformData((NSFont *)runCTFont, CTFontGetSize(runCTFont));
</del><ins>+                        FontPlatformData runFontPlatformData(runCTFont, CTFontGetSize(runCTFont));
</ins><span class="cx">                         runFont = fontCache.fontForPlatformData(runFontPlatformData).ptr();
</span><span class="cx">                     }
</span><span class="cx"> #else
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacFontCacheMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm (183268 => 183269)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm        2015-04-24 18:02:30 UTC (rev 183268)
+++ trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm        2015-04-24 18:12:31 UTC (rev 183269)
</span><span class="lines">@@ -403,7 +403,7 @@
</span><span class="cx">     substituteFontTraits = [fontManager traitsOfFont:substituteFont];
</span><span class="cx">     substituteFontWeight = [fontManager weightOfFont:substituteFont];
</span><span class="cx"> 
</span><del>-    FontPlatformData alternateFont(substituteFont, platformData.size(),
</del><ins>+    FontPlatformData alternateFont(reinterpret_cast&lt;CTFontRef&gt;(substituteFont), platformData.size(),
</ins><span class="cx">         !isPlatformFont &amp;&amp; isAppKitFontWeightBold(weight) &amp;&amp; !isAppKitFontWeightBold(substituteFontWeight),
</span><span class="cx">         !isPlatformFont &amp;&amp; (traits &amp; NSFontItalicTrait) &amp;&amp; !(substituteFontTraits &amp; NSFontItalicTrait),
</span><span class="cx">         platformData.m_orientation);
</span><span class="lines">@@ -512,7 +512,7 @@
</span><span class="cx">     bool syntheticBold = isAppKitFontWeightBold(weight) &amp;&amp; !isAppKitFontWeightBold(actualWeight);
</span><span class="cx">     bool syntheticOblique = (traits &amp; NSFontItalicTrait) &amp;&amp; !(actualTraits &amp; NSFontItalicTrait);
</span><span class="cx"> 
</span><del>-    return std::make_unique&lt;FontPlatformData&gt;(platformFont, size, syntheticBold, syntheticOblique, fontDescription.orientation(), fontDescription.widthVariant());
</del><ins>+    return std::make_unique&lt;FontPlatformData&gt;(reinterpret_cast&lt;CTFontRef&gt;(platformFont), size, syntheticBold, syntheticOblique, fontDescription.orientation(), fontDescription.widthVariant());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacDragImageMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/DragImageMac.mm (183268 => 183269)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/DragImageMac.mm        2015-04-24 18:02:30 UTC (rev 183268)
+++ trunk/Source/WebCore/platform/mac/DragImageMac.mm        2015-04-24 18:12:31 UTC (rev 183269)
</span><span class="lines">@@ -168,7 +168,7 @@
</span><span class="cx">         CFRelease(currentFont);
</span><span class="cx">     currentFont = font;
</span><span class="cx">     CFRetain(currentFont);
</span><del>-    currentRenderer = FontCascade(FontPlatformData(font, [font pointSize]));
</del><ins>+    currentRenderer = FontCascade(FontPlatformData(reinterpret_cast&lt;CTFontRef&gt;(font), [font pointSize]));
</ins><span class="cx">     return currentRenderer;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -191,7 +191,7 @@
</span><span class="cx">     [string getCharacters:buffer.data()];
</span><span class="cx">     
</span><span class="cx">     if (canUseFastRenderer(buffer.data(), length)) {
</span><del>-        FontCascade webCoreFont(FontPlatformData(font, [font pointSize]));
</del><ins>+        FontCascade webCoreFont(FontPlatformData(reinterpret_cast&lt;CTFontRef&gt;(font), [font pointSize]));
</ins><span class="cx">         TextRun run(buffer.data(), length);
</span><span class="cx">         run.disableRoundingHacks();
</span><span class="cx">         return webCoreFont.width(run);
</span><span class="lines">@@ -223,7 +223,7 @@
</span><span class="cx">         if (!flipped)
</span><span class="cx">             CGContextScaleCTM(cgContext, 1, -1);
</span><span class="cx">             
</span><del>-        FontCascade webCoreFont(FontPlatformData(font, [font pointSize]), Antialiased);
</del><ins>+        FontCascade webCoreFont(FontPlatformData(reinterpret_cast&lt;CTFontRef&gt;(font), [font pointSize]), Antialiased);
</ins><span class="cx">         TextRun run(buffer.data(), length);
</span><span class="cx">         run.disableRoundingHacks();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (183268 => 183269)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2015-04-24 18:02:30 UTC (rev 183268)
+++ trunk/Source/WebKit/mac/ChangeLog        2015-04-24 18:12:31 UTC (rev 183269)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2015-04-24  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        [Cocoa] Start cleaning up FontPlatformData
+        https://bugs.webkit.org/show_bug.cgi?id=144133
+
+        Reviewed by Enrica Casucci.
+
+        Receive casts which have been hoisted from the deleted FontPlatformData constructor.
+
+        * Misc/WebKitNSStringExtras.mm:
+        (-[NSString _web_drawAtPoint:font:textColor:allowingFontSmoothing:]): Receive cast which has
+        been hoisted from the deleted FontPlatformData constructor.
+        (-[NSString _web_widthWithFont:]): Ditto.
+        * Misc/WebStringTruncator.mm:
+        (fontFromNSFont): Ditto.
+
</ins><span class="cx"> 2015-04-24  Doug Russell  &lt;d_russell@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         AX: richer text change notifications (142719)
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebKitNSStringExtrasmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm (183268 => 183269)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm        2015-04-24 18:02:30 UTC (rev 183268)
+++ trunk/Source/WebKit/mac/Misc/WebKitNSStringExtras.mm        2015-04-24 18:12:31 UTC (rev 183269)
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx">         if (!flipped)
</span><span class="cx">             CGContextScaleCTM(cgContext, 1, -1);
</span><span class="cx"> 
</span><del>-        FontCascade webCoreFont(FontPlatformData(font, [font pointSize]), fontSmoothingIsAllowed ? AutoSmoothing : Antialiased);
</del><ins>+        FontCascade webCoreFont(FontPlatformData(reinterpret_cast&lt;CTFontRef&gt;(font), [font pointSize]), fontSmoothingIsAllowed ? AutoSmoothing : Antialiased);
</ins><span class="cx">         TextRun run(buffer.data(), length);
</span><span class="cx">         run.disableRoundingHacks();
</span><span class="cx"> 
</span><span class="lines">@@ -138,7 +138,7 @@
</span><span class="cx">     [self getCharacters:buffer.data()];
</span><span class="cx"> 
</span><span class="cx">     if (canUseFastRenderer(buffer.data(), length)) {
</span><del>-        FontCascade webCoreFont(FontPlatformData(font, [font pointSize]));
</del><ins>+        FontCascade webCoreFont(FontPlatformData(reinterpret_cast&lt;CTFontRef&gt;(font), [font pointSize]));
</ins><span class="cx">         TextRun run(buffer.data(), length);
</span><span class="cx">         run.disableRoundingHacks();
</span><span class="cx">         return webCoreFont.width(run);
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebStringTruncatormm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebStringTruncator.mm (183268 => 183269)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebStringTruncator.mm        2015-04-24 18:02:30 UTC (rev 183268)
+++ trunk/Source/WebKit/mac/Misc/WebStringTruncator.mm        2015-04-24 18:12:31 UTC (rev 183269)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx">     if ([font isEqual:currentNSFont.get().get()])
</span><span class="cx">         return currentFont;
</span><span class="cx">     currentNSFont.get() = font;
</span><del>-    currentFont.get() = WebCore::FontCascade(WebCore::FontPlatformData(font, [font pointSize]));
</del><ins>+    currentFont.get() = WebCore::FontCascade(WebCore::FontPlatformData(reinterpret_cast&lt;CTFontRef&gt;(font), [font pointSize]));
</ins><span class="cx">     return currentFont;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>