<!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>[178578] trunk/Source/WebCore</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/178578">178578</a></dd>
<dt>Author</dt> <dd>antti@apple.com</dd>
<dt>Date</dt> <dd>2015-01-16 08:07:46 -0800 (Fri, 16 Jan 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Correct naming for FontCascade implementation files
https://bugs.webkit.org/show_bug.cgi?id=140544

Reviewed by Zalan Bujtas.

Also reduce their number.

Merge FontFastPath.cpp into FontCascade.cpp
Merge FontMac.mm and FontComplexTextMac.cpp into FontCascadeCocoa.mm

* CMakeLists.txt:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::getEmphasisMarkGlyphData):
(WebCore::FontCascade::emphasisMarkAscent):
(WebCore::FontCascade::emphasisMarkDescent):
(WebCore::FontCascade::emphasisMarkHeight):
(WebCore::FontCascade::getGlyphsAndAdvancesForSimpleText):
(WebCore::FontCascade::drawSimpleText):
(WebCore::FontCascade::drawEmphasisMarksForSimpleText):
(WebCore::FontCascade::drawGlyphBuffer):
(WebCore::offsetToMiddleOfGlyph):
(WebCore::offsetToMiddleOfGlyphAtIndex):
(WebCore::FontCascade::drawEmphasisMarks):
(WebCore::FontCascade::floatWidthForSimpleText):
(WebCore::FontCascade::adjustSelectionRectForSimpleText):
(WebCore::FontCascade::offsetForPositionForSimpleText):
* platform/graphics/FontFastPath.cpp: Removed.
* platform/graphics/cocoa/FontCascadeCocoa.mm: Copied from Source/WebCore/platform/graphics/mac/FontMac.mm.
(WebCore::FontCascade::drawGlyphs):
(WebCore::FontCascade::adjustSelectionRectForComplexText):
(WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
(WebCore::FontCascade::drawComplexText):
(WebCore::FontCascade::drawEmphasisMarksForComplexText):
(WebCore::FontCascade::floatWidthForComplexText):
(WebCore::FontCascade::offsetForPositionForComplexText):
(WebCore::FontCascade::fontDataForCombiningCharacterSequence):
* platform/graphics/mac/FontComplexTextMac.cpp: Removed.
* platform/graphics/mac/FontMac.mm: Removed.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxproj">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFontCascadecpp">trunk/Source/WebCore/platform/graphics/FontCascade.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaFontCascadeCocoamm">trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformgraphicsFontFastPathcpp">trunk/Source/WebCore/platform/graphics/FontFastPath.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacFontComplexTextMaccpp">trunk/Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacFontMacmm">trunk/Source/WebCore/platform/graphics/mac/FontMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (178577 => 178578)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2015-01-16 10:22:45 UTC (rev 178577)
+++ trunk/Source/WebCore/CMakeLists.txt        2015-01-16 16:07:46 UTC (rev 178578)
</span><span class="lines">@@ -2052,7 +2052,6 @@
</span><span class="cx">     platform/graphics/FontCache.cpp
</span><span class="cx">     platform/graphics/FontCascade.cpp
</span><span class="cx">     platform/graphics/FontDescription.cpp
</span><del>-    platform/graphics/FontFastPath.cpp
</del><span class="cx">     platform/graphics/FontFeatureSettings.cpp
</span><span class="cx">     platform/graphics/FontGenericFamilies.cpp
</span><span class="cx">     platform/graphics/FontGlyphs.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (178577 => 178578)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-01-16 10:22:45 UTC (rev 178577)
+++ trunk/Source/WebCore/ChangeLog        2015-01-16 16:07:46 UTC (rev 178578)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2015-01-16  Antti Koivisto  &lt;antti@apple.com&gt;
+
+        Correct naming for FontCascade implementation files
+        https://bugs.webkit.org/show_bug.cgi?id=140544
+
+        Reviewed by Zalan Bujtas.
+
+        Also reduce their number.
+
+        Merge FontFastPath.cpp into FontCascade.cpp
+        Merge FontMac.mm and FontComplexTextMac.cpp into FontCascadeCocoa.mm
+
+        * CMakeLists.txt:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/FontCascade.cpp:
+        (WebCore::FontCascade::getEmphasisMarkGlyphData):
+        (WebCore::FontCascade::emphasisMarkAscent):
+        (WebCore::FontCascade::emphasisMarkDescent):
+        (WebCore::FontCascade::emphasisMarkHeight):
+        (WebCore::FontCascade::getGlyphsAndAdvancesForSimpleText):
+        (WebCore::FontCascade::drawSimpleText):
+        (WebCore::FontCascade::drawEmphasisMarksForSimpleText):
+        (WebCore::FontCascade::drawGlyphBuffer):
+        (WebCore::offsetToMiddleOfGlyph):
+        (WebCore::offsetToMiddleOfGlyphAtIndex):
+        (WebCore::FontCascade::drawEmphasisMarks):
+        (WebCore::FontCascade::floatWidthForSimpleText):
+        (WebCore::FontCascade::adjustSelectionRectForSimpleText):
+        (WebCore::FontCascade::offsetForPositionForSimpleText):
+        * platform/graphics/FontFastPath.cpp: Removed.
+        * platform/graphics/cocoa/FontCascadeCocoa.mm: Copied from Source/WebCore/platform/graphics/mac/FontMac.mm.
+        (WebCore::FontCascade::drawGlyphs):
+        (WebCore::FontCascade::adjustSelectionRectForComplexText):
+        (WebCore::FontCascade::getGlyphsAndAdvancesForComplexText):
+        (WebCore::FontCascade::drawComplexText):
+        (WebCore::FontCascade::drawEmphasisMarksForComplexText):
+        (WebCore::FontCascade::floatWidthForComplexText):
+        (WebCore::FontCascade::offsetForPositionForComplexText):
+        (WebCore::FontCascade::fontDataForCombiningCharacterSequence):
+        * platform/graphics/mac/FontComplexTextMac.cpp: Removed.
+        * platform/graphics/mac/FontMac.mm: Removed.
+
</ins><span class="cx"> 2014-11-26  Sergio Villar Senin  &lt;svillar@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [CSS Grid Layout] Tracks shrink sometimes with indefinite remaining space
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (178577 => 178578)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2015-01-16 10:22:45 UTC (rev 178577)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2015-01-16 16:07:46 UTC (rev 178578)
</span><span class="lines">@@ -7983,7 +7983,6 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\graphics\FontDescription.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\graphics\FontGenericFamilies.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\graphics\FontGlyphs.cpp&quot; /&gt;
</span><del>-    &lt;ClCompile Include=&quot;..\platform\graphics\FontFastPath.cpp&quot; /&gt;
</del><span class="cx">     &lt;ClCompile Include=&quot;..\platform\graphics\FontFeatureSettings.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\graphics\FontPlatformData.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\platform\graphics\FontRanges.cpp&quot; /&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (178577 => 178578)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-01-16 10:22:45 UTC (rev 178577)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-01-16 16:07:46 UTC (rev 178578)
</span><span class="lines">@@ -1387,7 +1387,6 @@
</span><span class="cx">                 37ACCE420DA2980F0089E602 /* FontRenderingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 37ACCE410DA2980F0089E602 /* FontRenderingMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 37ACCF690DA414E70089E602 /* FontDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37ACCE620DA2AA960089E602 /* FontDescription.cpp */; };
</span><span class="cx">                 37BAAE581980D1DD005DFE71 /* ProtectionSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = 37BAAE571980D1DD005DFE71 /* ProtectionSpace.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                37C2360B1097EDED00EF9F72 /* FontComplexTextMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37C2360A1097EDED00EF9F72 /* FontComplexTextMac.cpp */; };
</del><span class="cx">                 37C236101097EE7700EF9F72 /* ComplexTextController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37C2360E1097EE7700EF9F72 /* ComplexTextController.cpp */; };
</span><span class="cx">                 37C236111097EE7700EF9F72 /* ComplexTextController.h in Headers */ = {isa = PBXBuildFile; fileRef = 37C2360F1097EE7700EF9F72 /* ComplexTextController.h */; };
</span><span class="cx">                 37C238221098C84200EF9F72 /* ComplexTextControllerCoreText.mm in Sources */ = {isa = PBXBuildFile; fileRef = 37C238201098C84200EF9F72 /* ComplexTextControllerCoreText.mm */; };
</span><span class="lines">@@ -2339,7 +2338,6 @@
</span><span class="cx">                 724ED32C1A3A7E5400F5F13C /* EXTBlendMinMax.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 724ED3291A3A7E5400F5F13C /* EXTBlendMinMax.cpp */; };
</span><span class="cx">                 724ED3311A3A8B2300F5F13C /* JSEXTBlendMinMax.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 724ED32F1A3A8B2300F5F13C /* JSEXTBlendMinMax.cpp */; };
</span><span class="cx">                 724ED3321A3A8B2300F5F13C /* JSEXTBlendMinMax.h in Headers */ = {isa = PBXBuildFile; fileRef = 724ED3301A3A8B2300F5F13C /* JSEXTBlendMinMax.h */; };
</span><del>-                72626E020EF022FE00A07E20 /* FontFastPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72626E010EF022FE00A07E20 /* FontFastPath.cpp */; };
</del><span class="cx">                 727AFED41A2EA6AE000442E8 /* EXTsRGB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 727AFED11A2EA6A0000442E8 /* EXTsRGB.cpp */; };
</span><span class="cx">                 72E417631A2E8D2F004C562A /* JSEXTsRGB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72E417611A2E8D2F004C562A /* JSEXTsRGB.cpp */; };
</span><span class="cx">                 72F1ADA21A3904DC00014E18 /* EXTFragDepth.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72F1AD9F1A3904C300014E18 /* EXTFragDepth.cpp */; };
</span><span class="lines">@@ -4670,7 +4668,7 @@
</span><span class="cx">                 B2AFFC7D0D00A5C10030074D /* FontCustomPlatformData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC750D00A5C10030074D /* FontCustomPlatformData.cpp */; };
</span><span class="cx">                 B2AFFC7E0D00A5C10030074D /* FontCustomPlatformData.h in Headers */ = {isa = PBXBuildFile; fileRef = B2AFFC760D00A5C10030074D /* FontCustomPlatformData.h */; };
</span><span class="cx">                 B2AFFC7F0D00A5C10030074D /* SimpleFontDataMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC770D00A5C10030074D /* SimpleFontDataMac.mm */; };
</span><del>-                B2AFFC800D00A5C10030074D /* FontMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC780D00A5C10030074D /* FontMac.mm */; };
</del><ins>+                B2AFFC800D00A5C10030074D /* FontCascadeCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC780D00A5C10030074D /* FontCascadeCocoa.mm */; };
</ins><span class="cx">                 B2AFFC830D00A5C10030074D /* GlyphPageMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC7B0D00A5C10030074D /* GlyphPageMac.cpp */; };
</span><span class="cx">                 B2AFFC970D00A5DF0030074D /* TextBoundaries.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC8C0D00A5DF0030074D /* TextBoundaries.mm */; };
</span><span class="cx">                 B2AFFC980D00A5DF0030074D /* TextBreakIteratorInternalICUMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = B2AFFC8D0D00A5DF0030074D /* TextBreakIteratorInternalICUMac.mm */; };
</span><span class="lines">@@ -8430,7 +8428,6 @@
</span><span class="cx">                 37ACCE410DA2980F0089E602 /* FontRenderingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontRenderingMode.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 37ACCE620DA2AA960089E602 /* FontDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontDescription.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 37BAAE571980D1DD005DFE71 /* ProtectionSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProtectionSpace.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                37C2360A1097EDED00EF9F72 /* FontComplexTextMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontComplexTextMac.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 37C2360E1097EE7700EF9F72 /* ComplexTextController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ComplexTextController.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 37C2360F1097EE7700EF9F72 /* ComplexTextController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ComplexTextController.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 37C238201098C84200EF9F72 /* ComplexTextControllerCoreText.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ComplexTextControllerCoreText.mm; sourceTree = &quot;&lt;group&gt;&quot;; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
</span><span class="lines">@@ -9477,7 +9474,6 @@
</span><span class="cx">                 724ED32B1A3A7E5400F5F13C /* EXTBlendMinMax.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = EXTBlendMinMax.idl; path = canvas/EXTBlendMinMax.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 724ED32F1A3A8B2300F5F13C /* JSEXTBlendMinMax.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEXTBlendMinMax.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 724ED3301A3A8B2300F5F13C /* JSEXTBlendMinMax.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEXTBlendMinMax.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                72626E010EF022FE00A07E20 /* FontFastPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontFastPath.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 727AFED11A2EA6A0000442E8 /* EXTsRGB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EXTsRGB.cpp; path = canvas/EXTsRGB.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 727AFED21A2EA6A0000442E8 /* EXTsRGB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EXTsRGB.h; path = canvas/EXTsRGB.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 727AFED31A2EA6A0000442E8 /* EXTsRGB.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = EXTsRGB.idl; path = canvas/EXTsRGB.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -12044,7 +12040,7 @@
</span><span class="cx">                 B2AFFC750D00A5C10030074D /* FontCustomPlatformData.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FontCustomPlatformData.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 B2AFFC760D00A5C10030074D /* FontCustomPlatformData.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontCustomPlatformData.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 B2AFFC770D00A5C10030074D /* SimpleFontDataMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = SimpleFontDataMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                B2AFFC780D00A5C10030074D /* FontMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = FontMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                B2AFFC780D00A5C10030074D /* FontCascadeCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = FontCascadeCocoa.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 B2AFFC7B0D00A5C10030074D /* GlyphPageMac.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = GlyphPageMac.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 B2AFFC850D00A5DF0030074D /* character-sets.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = &quot;character-sets.txt&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 B2AFFC860D00A5DF0030074D /* mac-encodings.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = &quot;mac-encodings.txt&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -20362,10 +20358,8 @@
</span><span class="cx">                                 B275354C0B053814002CE64F /* FloatRectMac.mm */,
</span><span class="cx">                                 B275354D0B053814002CE64F /* FloatSizeMac.mm */,
</span><span class="cx">                                 B2AFFC740D00A5C10030074D /* FontCacheMac.mm */,
</span><del>-                                37C2360A1097EDED00EF9F72 /* FontComplexTextMac.cpp */,
</del><span class="cx">                                 B2AFFC750D00A5C10030074D /* FontCustomPlatformData.cpp */,
</span><span class="cx">                                 B2AFFC760D00A5C10030074D /* FontCustomPlatformData.h */,
</span><del>-                                B2AFFC780D00A5C10030074D /* FontMac.mm */,
</del><span class="cx">                                 B2AFFC7B0D00A5C10030074D /* GlyphPageMac.cpp */,
</span><span class="cx">                                 49FFBF1C11C8550E006A7118 /* GraphicsContext3DMac.mm */,
</span><span class="cx">                                 B277B4030B22F37C0004BEC6 /* GraphicsContextMac.mm */,
</span><span class="lines">@@ -20446,7 +20440,6 @@
</span><span class="cx">                                 B2C3DA520D006CD600EF6F26 /* FontCache.h */,
</span><span class="cx">                                 37ACCE620DA2AA960089E602 /* FontDescription.cpp */,
</span><span class="cx">                                 B2C3DA550D006CD600EF6F26 /* FontDescription.h */,
</span><del>-                                72626E010EF022FE00A07E20 /* FontFastPath.cpp */,
</del><span class="cx">                                 4A6E9FC513C17D570046A7F8 /* FontFeatureSettings.cpp */,
</span><span class="cx">                                 4A6E9FC613C17D570046A7F8 /* FontFeatureSettings.h */,
</span><span class="cx">                                 E44EE3A617576E5500EEE8CF /* FontGenericFamilies.cpp */,
</span><span class="lines">@@ -20714,6 +20707,7 @@
</span><span class="cx">                 B5320D68122A24E9002D1440 /* cocoa */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                B2AFFC780D00A5C10030074D /* FontCascadeCocoa.mm */,
</ins><span class="cx">                                 B5320D6A122A24E9002D1440 /* FontPlatformDataCocoa.mm */,
</span><span class="cx">                                 2D0B4AA918DA1CCD00434DE1 /* IOSurface.h */,
</span><span class="cx">                                 2D0B4AAA18DA1CCD00434DE1 /* IOSurface.mm */,
</span><span class="lines">@@ -27820,15 +27814,13 @@
</span><span class="cx">                                 B2C3DA620D006CD600EF6F26 /* FontCache.cpp in Sources */,
</span><span class="cx">                                 3727DFD5142AAE4500D449CB /* FontCacheIOS.mm in Sources */,
</span><span class="cx">                                 B2AFFC7C0D00A5C10030074D /* FontCacheMac.mm in Sources */,
</span><del>-                                37C2360B1097EDED00EF9F72 /* FontComplexTextMac.cpp in Sources */,
</del><span class="cx">                                 B2AFFC7D0D00A5C10030074D /* FontCustomPlatformData.cpp in Sources */,
</span><span class="cx">                                 37ACCF690DA414E70089E602 /* FontDescription.cpp in Sources */,
</span><del>-                                72626E020EF022FE00A07E20 /* FontFastPath.cpp in Sources */,
</del><span class="cx">                                 4A6E9FC713C17D570046A7F8 /* FontFeatureSettings.cpp in Sources */,
</span><span class="cx">                                 E44EE3A817577EBD00EEE8CF /* FontGenericFamilies.cpp in Sources */,
</span><span class="cx">                                 B2C3DA670D006CD600EF6F26 /* FontGlyphs.cpp in Sources */,
</span><span class="cx">                                 FD96C9971982FBDF0086E156 /* FontLoader.cpp in Sources */,
</span><del>-                                B2AFFC800D00A5C10030074D /* FontMac.mm in Sources */,
</del><ins>+                                B2AFFC800D00A5C10030074D /* FontCascadeCocoa.mm in Sources */,
</ins><span class="cx">                                 84B62685133138F90095A489 /* FontPlatformData.cpp in Sources */,
</span><span class="cx">                                 B5320D6C122A24E9002D1440 /* FontPlatformDataCocoa.mm in Sources */,
</span><span class="cx">                                 C58361AA1744523F00173511 /* FontServicesIOS.mm in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontCascadecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (178577 => 178578)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp        2015-01-16 10:22:45 UTC (rev 178577)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp        2015-01-16 16:07:46 UTC (rev 178578)
</span><span class="lines">@@ -1139,4 +1139,304 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+// FIXME: This function may not work if the emphasis mark uses a complex script, but none of the
+// standard emphasis marks do so.
+bool FontCascade::getEmphasisMarkGlyphData(const AtomicString&amp; mark, GlyphData&amp; glyphData) const
+{
+    if (mark.isEmpty())
+        return false;
+
+    UChar32 character = mark[0];
+
+    if (U16_IS_SURROGATE(character)) {
+        if (!U16_IS_SURROGATE_LEAD(character))
+            return false;
+
+        if (mark.length() &lt; 2)
+            return false;
+
+        UChar low = mark[1];
+        if (!U16_IS_TRAIL(low))
+            return false;
+
+        character = U16_GET_SUPPLEMENTARY(character, low);
+    }
+
+    glyphData = glyphDataForCharacter(character, false, EmphasisMarkVariant);
+    return true;
</ins><span class="cx"> }
</span><ins>+
+int FontCascade::emphasisMarkAscent(const AtomicString&amp; mark) const
+{
+    GlyphData markGlyphData;
+    if (!getEmphasisMarkGlyphData(mark, markGlyphData))
+        return 0;
+
+    const SimpleFontData* markFontData = markGlyphData.fontData;
+    ASSERT(markFontData);
+    if (!markFontData)
+        return 0;
+
+    return markFontData-&gt;fontMetrics().ascent();
+}
+
+int FontCascade::emphasisMarkDescent(const AtomicString&amp; mark) const
+{
+    GlyphData markGlyphData;
+    if (!getEmphasisMarkGlyphData(mark, markGlyphData))
+        return 0;
+
+    const SimpleFontData* markFontData = markGlyphData.fontData;
+    ASSERT(markFontData);
+    if (!markFontData)
+        return 0;
+
+    return markFontData-&gt;fontMetrics().descent();
+}
+
+int FontCascade::emphasisMarkHeight(const AtomicString&amp; mark) const
+{
+    GlyphData markGlyphData;
+    if (!getEmphasisMarkGlyphData(mark, markGlyphData))
+        return 0;
+
+    const SimpleFontData* markFontData = markGlyphData.fontData;
+    ASSERT(markFontData);
+    if (!markFontData)
+        return 0;
+
+    return markFontData-&gt;fontMetrics().height();
+}
+
+float FontCascade::getGlyphsAndAdvancesForSimpleText(const TextRun&amp; run, int from, int to, GlyphBuffer&amp; glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
+{
+    float initialAdvance;
+
+    WidthIterator it(this, run, 0, false, forTextEmphasis);
+    // FIXME: Using separate glyph buffers for the prefix and the suffix is incorrect when kerning or
+    // ligatures are enabled.
+    GlyphBuffer localGlyphBuffer;
+    it.advance(from, &amp;localGlyphBuffer);
+    float beforeWidth = it.m_runWidthSoFar;
+    it.advance(to, &amp;glyphBuffer);
+
+    if (glyphBuffer.isEmpty())
+        return 0;
+
+    float afterWidth = it.m_runWidthSoFar;
+
+    if (run.rtl()) {
+        float finalRoundingWidth = it.m_finalRoundingWidth;
+        it.advance(run.length(), &amp;localGlyphBuffer);
+        initialAdvance = finalRoundingWidth + it.m_runWidthSoFar - afterWidth;
+    } else
+        initialAdvance = beforeWidth;
+
+    if (run.rtl())
+        glyphBuffer.reverse(0, glyphBuffer.size());
+
+    return initialAdvance;
+}
+
+float FontCascade::drawSimpleText(GraphicsContext* context, const TextRun&amp; run, const FloatPoint&amp; point, int from, int to) const
+{
+    // This glyph buffer holds our glyphs+advances+font data for each glyph.
+    GlyphBuffer glyphBuffer;
+
+    float startX = point.x() + getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer);
+
+    if (glyphBuffer.isEmpty())
+        return 0;
+
+    FloatPoint startPoint(startX, point.y());
+    drawGlyphBuffer(context, run, glyphBuffer, startPoint);
+
+    return startPoint.x() - startX;
+}
+
+void FontCascade::drawEmphasisMarksForSimpleText(GraphicsContext* context, const TextRun&amp; run, const AtomicString&amp; mark, const FloatPoint&amp; point, int from, int to) const
+{
+    GlyphBuffer glyphBuffer;
+    float initialAdvance = getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer, ForTextEmphasis);
+
+    if (glyphBuffer.isEmpty())
+        return;
+
+    drawEmphasisMarks(context, run, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y()));
+}
+
+void FontCascade::drawGlyphBuffer(GraphicsContext* context, const TextRun&amp; run, const GlyphBuffer&amp; glyphBuffer, FloatPoint&amp; point) const
+{
+#if !ENABLE(SVG_FONTS)
+    UNUSED_PARAM(run);
+#endif
+
+    // Draw each contiguous run of glyphs that use the same font data.
+    const SimpleFontData* fontData = glyphBuffer.fontDataAt(0);
+    FloatSize offset = glyphBuffer.offsetAt(0);
+    FloatPoint startPoint(point.x(), point.y() - glyphBuffer.initialAdvance().height());
+    float nextX = startPoint.x() + glyphBuffer.advanceAt(0).width();
+    float nextY = startPoint.y() + glyphBuffer.advanceAt(0).height();
+    int lastFrom = 0;
+    int nextGlyph = 1;
+#if ENABLE(SVG_FONTS)
+    TextRun::RenderingContext* renderingContext = run.renderingContext();
+#endif
+    while (nextGlyph &lt; glyphBuffer.size()) {
+        const SimpleFontData* nextFontData = glyphBuffer.fontDataAt(nextGlyph);
+        FloatSize nextOffset = glyphBuffer.offsetAt(nextGlyph);
+
+        if (nextFontData != fontData || nextOffset != offset) {
+#if ENABLE(SVG_FONTS)
+            if (renderingContext &amp;&amp; fontData-&gt;isSVGFont())
+                renderingContext-&gt;drawSVGGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint);
+            else
+#endif
+                drawGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint);
+
+            lastFrom = nextGlyph;
+            fontData = nextFontData;
+            offset = nextOffset;
+            startPoint.setX(nextX);
+            startPoint.setY(nextY);
+        }
+        nextX += glyphBuffer.advanceAt(nextGlyph).width();
+        nextY += glyphBuffer.advanceAt(nextGlyph).height();
+        nextGlyph++;
+    }
+
+#if ENABLE(SVG_FONTS)
+    if (renderingContext &amp;&amp; fontData-&gt;isSVGFont())
+        renderingContext-&gt;drawSVGGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint);
+    else
+#endif
+    {
+        drawGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint);
+        point.setX(nextX);
+    }
+}
+
+inline static float offsetToMiddleOfGlyph(const SimpleFontData* fontData, Glyph glyph)
+{
+    if (fontData-&gt;platformData().orientation() == Horizontal) {
+        FloatRect bounds = fontData-&gt;boundsForGlyph(glyph);
+        return bounds.x() + bounds.width() / 2;
+    }
+    // FIXME: Use glyph bounds once they make sense for vertical fonts.
+    return fontData-&gt;widthForGlyph(glyph) / 2;
+}
+
+inline static float offsetToMiddleOfGlyphAtIndex(const GlyphBuffer&amp; glyphBuffer, size_t i)
+{
+    return offsetToMiddleOfGlyph(glyphBuffer.fontDataAt(i), glyphBuffer.glyphAt(i));
+}
+
+void FontCascade::drawEmphasisMarks(GraphicsContext* context, const TextRun&amp; run, const GlyphBuffer&amp; glyphBuffer, const AtomicString&amp; mark, const FloatPoint&amp; point) const
+{
+    GlyphData markGlyphData;
+    if (!getEmphasisMarkGlyphData(mark, markGlyphData))
+        return;
+
+    const SimpleFontData* markFontData = markGlyphData.fontData;
+    ASSERT(markFontData);
+    if (!markFontData)
+        return;
+
+    Glyph markGlyph = markGlyphData.glyph;
+    Glyph spaceGlyph = markFontData-&gt;spaceGlyph();
+
+    float middleOfLastGlyph = offsetToMiddleOfGlyphAtIndex(glyphBuffer, 0);
+    FloatPoint startPoint(point.x() + middleOfLastGlyph - offsetToMiddleOfGlyph(markFontData, markGlyph), point.y());
+
+    GlyphBuffer markBuffer;
+    for (int i = 0; i + 1 &lt; glyphBuffer.size(); ++i) {
+        float middleOfNextGlyph = offsetToMiddleOfGlyphAtIndex(glyphBuffer, i + 1);
+        float advance = glyphBuffer.advanceAt(i).width() - middleOfLastGlyph + middleOfNextGlyph;
+        markBuffer.add(glyphBuffer.glyphAt(i) ? markGlyph : spaceGlyph, markFontData, advance);
+        middleOfLastGlyph = middleOfNextGlyph;
+    }
+    markBuffer.add(glyphBuffer.glyphAt(glyphBuffer.size() - 1) ? markGlyph : spaceGlyph, markFontData, 0);
+
+    drawGlyphBuffer(context, run, markBuffer, startPoint);
+}
+
+float FontCascade::floatWidthForSimpleText(const TextRun&amp; run, HashSet&lt;const SimpleFontData*&gt;* fallbackFonts, GlyphOverflow* glyphOverflow) const
+{
+    WidthIterator it(this, run, fallbackFonts, glyphOverflow);
+    GlyphBuffer glyphBuffer;
+    it.advance(run.length(), (typesettingFeatures() &amp; (Kerning | Ligatures)) ? &amp;glyphBuffer : 0);
+
+    if (glyphOverflow) {
+        glyphOverflow-&gt;top = std::max&lt;int&gt;(glyphOverflow-&gt;top, ceilf(-it.minGlyphBoundingBoxY()) - (glyphOverflow-&gt;computeBounds ? 0 : fontMetrics().ascent()));
+        glyphOverflow-&gt;bottom = std::max&lt;int&gt;(glyphOverflow-&gt;bottom, ceilf(it.maxGlyphBoundingBoxY()) - (glyphOverflow-&gt;computeBounds ? 0 : fontMetrics().descent()));
+        glyphOverflow-&gt;left = ceilf(it.firstGlyphOverflow());
+        glyphOverflow-&gt;right = ceilf(it.lastGlyphOverflow());
+    }
+
+    return it.m_runWidthSoFar;
+}
+
+void FontCascade::adjustSelectionRectForSimpleText(const TextRun&amp; run, LayoutRect&amp; selectionRect, int from, int to) const
+{
+    GlyphBuffer glyphBuffer;
+    WidthIterator it(this, run);
+    it.advance(from, &amp;glyphBuffer);
+    float beforeWidth = it.m_runWidthSoFar;
+    it.advance(to, &amp;glyphBuffer);
+    float afterWidth = it.m_runWidthSoFar;
+    float totalWidth = -1;
+
+    if (run.rtl()) {
+        it.advance(run.length(), &amp;glyphBuffer);
+        totalWidth = it.m_runWidthSoFar;
+        selectionRect.move(totalWidth - afterWidth, 0);
+    } else
+        selectionRect.move(beforeWidth, 0);
+    selectionRect.setWidth(afterWidth - beforeWidth);
+}
+
+int FontCascade::offsetForPositionForSimpleText(const TextRun&amp; run, float x, bool includePartialGlyphs) const
+{
+    float delta = x;
+
+    WidthIterator it(this, run);
+    GlyphBuffer localGlyphBuffer;
+    unsigned offset;
+    if (run.rtl()) {
+        delta -= floatWidthForSimpleText(run);
+        while (1) {
+            offset = it.m_currentCharacter;
+            float w;
+            if (!it.advanceOneCharacter(w, localGlyphBuffer))
+                break;
+            delta += w;
+            if (includePartialGlyphs) {
+                if (delta - w / 2 &gt;= 0)
+                    break;
+            } else {
+                if (delta &gt;= 0)
+                    break;
+            }
+        }
+    } else {
+        while (1) {
+            offset = it.m_currentCharacter;
+            float w;
+            if (!it.advanceOneCharacter(w, localGlyphBuffer))
+                break;
+            delta -= w;
+            if (includePartialGlyphs) {
+                if (delta + w / 2 &lt;= 0)
+                    break;
+            } else {
+                if (delta &lt;= 0)
+                    break;
+            }
+        }
+    }
+
+    return offset;
+}
+
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontFastPathcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/graphics/FontFastPath.cpp (178577 => 178578)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FontFastPath.cpp        2015-01-16 10:22:45 UTC (rev 178577)
+++ trunk/Source/WebCore/platform/graphics/FontFastPath.cpp        2015-01-16 16:07:46 UTC (rev 178578)
</span><span class="lines">@@ -1,341 +0,0 @@
</span><del>-/**
- * Copyright (C) 2003, 2006, 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2008 Holger Hans Peter Freyther
- * Copyright (C) 2009 Torch Mobile, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include &quot;config.h&quot;
-#include &quot;FontCascade.h&quot;
-
-#include &quot;FloatRect.h&quot;
-#include &quot;FontGlyphs.h&quot;
-#include &quot;GlyphBuffer.h&quot;
-#include &quot;LayoutRect.h&quot;
-#include &quot;SimpleFontData.h&quot;
-#include &quot;TextRun.h&quot;
-#include &quot;WidthIterator.h&quot;
-#include &lt;wtf/MainThread.h&gt;
-#include &lt;wtf/MathExtras.h&gt;
-#include &lt;wtf/unicode/CharacterNames.h&gt;
-
-using namespace WTF;
-using namespace Unicode;
-
-namespace WebCore {
-
-// FIXME: This function may not work if the emphasis mark uses a complex script, but none of the
-// standard emphasis marks do so.
-bool FontCascade::getEmphasisMarkGlyphData(const AtomicString&amp; mark, GlyphData&amp; glyphData) const
-{
-    if (mark.isEmpty())
-        return false;
-
-    UChar32 character = mark[0];
-
-    if (U16_IS_SURROGATE(character)) {
-        if (!U16_IS_SURROGATE_LEAD(character))
-            return false;
-
-        if (mark.length() &lt; 2)
-            return false;
-
-        UChar low = mark[1];
-        if (!U16_IS_TRAIL(low))
-            return false;
-
-        character = U16_GET_SUPPLEMENTARY(character, low);
-    }
-
-    glyphData = glyphDataForCharacter(character, false, EmphasisMarkVariant);
-    return true;
-}
-
-int FontCascade::emphasisMarkAscent(const AtomicString&amp; mark) const
-{
-    GlyphData markGlyphData;
-    if (!getEmphasisMarkGlyphData(mark, markGlyphData))
-        return 0;
-
-    const SimpleFontData* markFontData = markGlyphData.fontData;
-    ASSERT(markFontData);
-    if (!markFontData)
-        return 0;
-
-    return markFontData-&gt;fontMetrics().ascent();
-}
-
-int FontCascade::emphasisMarkDescent(const AtomicString&amp; mark) const
-{
-    GlyphData markGlyphData;
-    if (!getEmphasisMarkGlyphData(mark, markGlyphData))
-        return 0;
-
-    const SimpleFontData* markFontData = markGlyphData.fontData;
-    ASSERT(markFontData);
-    if (!markFontData)
-        return 0;
-
-    return markFontData-&gt;fontMetrics().descent();
-}
-
-int FontCascade::emphasisMarkHeight(const AtomicString&amp; mark) const
-{
-    GlyphData markGlyphData;
-    if (!getEmphasisMarkGlyphData(mark, markGlyphData))
-        return 0;
-
-    const SimpleFontData* markFontData = markGlyphData.fontData;
-    ASSERT(markFontData);
-    if (!markFontData)
-        return 0;
-
-    return markFontData-&gt;fontMetrics().height();
-}
-
-float FontCascade::getGlyphsAndAdvancesForSimpleText(const TextRun&amp; run, int from, int to, GlyphBuffer&amp; glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
-{
-    float initialAdvance;
-
-    WidthIterator it(this, run, 0, false, forTextEmphasis);
-    // FIXME: Using separate glyph buffers for the prefix and the suffix is incorrect when kerning or
-    // ligatures are enabled.
-    GlyphBuffer localGlyphBuffer;
-    it.advance(from, &amp;localGlyphBuffer);
-    float beforeWidth = it.m_runWidthSoFar;
-    it.advance(to, &amp;glyphBuffer);
-
-    if (glyphBuffer.isEmpty())
-        return 0;
-
-    float afterWidth = it.m_runWidthSoFar;
-
-    if (run.rtl()) {
-        float finalRoundingWidth = it.m_finalRoundingWidth;
-        it.advance(run.length(), &amp;localGlyphBuffer);
-        initialAdvance = finalRoundingWidth + it.m_runWidthSoFar - afterWidth;
-    } else
-        initialAdvance = beforeWidth;
-
-    if (run.rtl())
-        glyphBuffer.reverse(0, glyphBuffer.size());
-
-    return initialAdvance;
-}
-
-float FontCascade::drawSimpleText(GraphicsContext* context, const TextRun&amp; run, const FloatPoint&amp; point, int from, int to) const
-{
-    // This glyph buffer holds our glyphs+advances+font data for each glyph.
-    GlyphBuffer glyphBuffer;
-
-    float startX = point.x() + getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer);
-
-    if (glyphBuffer.isEmpty())
-        return 0;
-
-    FloatPoint startPoint(startX, point.y());
-    drawGlyphBuffer(context, run, glyphBuffer, startPoint);
-
-    return startPoint.x() - startX;
-}
-
-void FontCascade::drawEmphasisMarksForSimpleText(GraphicsContext* context, const TextRun&amp; run, const AtomicString&amp; mark, const FloatPoint&amp; point, int from, int to) const
-{
-    GlyphBuffer glyphBuffer;
-    float initialAdvance = getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer, ForTextEmphasis);
-
-    if (glyphBuffer.isEmpty())
-        return;
-
-    drawEmphasisMarks(context, run, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y()));
-}
-
-void FontCascade::drawGlyphBuffer(GraphicsContext* context, const TextRun&amp; run, const GlyphBuffer&amp; glyphBuffer, FloatPoint&amp; point) const
-{
-#if !ENABLE(SVG_FONTS)
-    UNUSED_PARAM(run);
-#endif
-
-    // Draw each contiguous run of glyphs that use the same font data.
-    const SimpleFontData* fontData = glyphBuffer.fontDataAt(0);
-    FloatSize offset = glyphBuffer.offsetAt(0);
-    FloatPoint startPoint(point.x(), point.y() - glyphBuffer.initialAdvance().height());
-    float nextX = startPoint.x() + glyphBuffer.advanceAt(0).width();
-    float nextY = startPoint.y() + glyphBuffer.advanceAt(0).height();
-    int lastFrom = 0;
-    int nextGlyph = 1;
-#if ENABLE(SVG_FONTS)
-    TextRun::RenderingContext* renderingContext = run.renderingContext();
-#endif
-    while (nextGlyph &lt; glyphBuffer.size()) {
-        const SimpleFontData* nextFontData = glyphBuffer.fontDataAt(nextGlyph);
-        FloatSize nextOffset = glyphBuffer.offsetAt(nextGlyph);
-
-        if (nextFontData != fontData || nextOffset != offset) {
-#if ENABLE(SVG_FONTS)
-            if (renderingContext &amp;&amp; fontData-&gt;isSVGFont())
-                renderingContext-&gt;drawSVGGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint);
-            else
-#endif
-                drawGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint);
-
-            lastFrom = nextGlyph;
-            fontData = nextFontData;
-            offset = nextOffset;
-            startPoint.setX(nextX);
-            startPoint.setY(nextY);
-        }
-        nextX += glyphBuffer.advanceAt(nextGlyph).width();
-        nextY += glyphBuffer.advanceAt(nextGlyph).height();
-        nextGlyph++;
-    }
-
-#if ENABLE(SVG_FONTS)
-    if (renderingContext &amp;&amp; fontData-&gt;isSVGFont())
-        renderingContext-&gt;drawSVGGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint);
-    else
-#endif
-    {
-        drawGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint);
-        point.setX(nextX);
-    }
-}
-
-inline static float offsetToMiddleOfGlyph(const SimpleFontData* fontData, Glyph glyph)
-{
-    if (fontData-&gt;platformData().orientation() == Horizontal) {
-        FloatRect bounds = fontData-&gt;boundsForGlyph(glyph);
-        return bounds.x() + bounds.width() / 2;
-    }
-    // FIXME: Use glyph bounds once they make sense for vertical fonts.
-    return fontData-&gt;widthForGlyph(glyph) / 2;
-}
-
-inline static float offsetToMiddleOfGlyphAtIndex(const GlyphBuffer&amp; glyphBuffer, size_t i)
-{
-    return offsetToMiddleOfGlyph(glyphBuffer.fontDataAt(i), glyphBuffer.glyphAt(i));
-}
-
-void FontCascade::drawEmphasisMarks(GraphicsContext* context, const TextRun&amp; run, const GlyphBuffer&amp; glyphBuffer, const AtomicString&amp; mark, const FloatPoint&amp; point) const
-{
-    GlyphData markGlyphData;
-    if (!getEmphasisMarkGlyphData(mark, markGlyphData))
-        return;
-
-    const SimpleFontData* markFontData = markGlyphData.fontData;
-    ASSERT(markFontData);
-    if (!markFontData)
-        return;
-
-    Glyph markGlyph = markGlyphData.glyph;
-    Glyph spaceGlyph = markFontData-&gt;spaceGlyph();
-
-    float middleOfLastGlyph = offsetToMiddleOfGlyphAtIndex(glyphBuffer, 0);
-    FloatPoint startPoint(point.x() + middleOfLastGlyph - offsetToMiddleOfGlyph(markFontData, markGlyph), point.y());
-
-    GlyphBuffer markBuffer;
-    for (int i = 0; i + 1 &lt; glyphBuffer.size(); ++i) {
-        float middleOfNextGlyph = offsetToMiddleOfGlyphAtIndex(glyphBuffer, i + 1);
-        float advance = glyphBuffer.advanceAt(i).width() - middleOfLastGlyph + middleOfNextGlyph;
-        markBuffer.add(glyphBuffer.glyphAt(i) ? markGlyph : spaceGlyph, markFontData, advance);
-        middleOfLastGlyph = middleOfNextGlyph;
-    }
-    markBuffer.add(glyphBuffer.glyphAt(glyphBuffer.size() - 1) ? markGlyph : spaceGlyph, markFontData, 0);
-
-    drawGlyphBuffer(context, run, markBuffer, startPoint);
-}
-
-float FontCascade::floatWidthForSimpleText(const TextRun&amp; run, HashSet&lt;const SimpleFontData*&gt;* fallbackFonts, GlyphOverflow* glyphOverflow) const
-{
-    WidthIterator it(this, run, fallbackFonts, glyphOverflow);
-    GlyphBuffer glyphBuffer;
-    it.advance(run.length(), (typesettingFeatures() &amp; (Kerning | Ligatures)) ? &amp;glyphBuffer : 0);
-
-    if (glyphOverflow) {
-        glyphOverflow-&gt;top = std::max&lt;int&gt;(glyphOverflow-&gt;top, ceilf(-it.minGlyphBoundingBoxY()) - (glyphOverflow-&gt;computeBounds ? 0 : fontMetrics().ascent()));
-        glyphOverflow-&gt;bottom = std::max&lt;int&gt;(glyphOverflow-&gt;bottom, ceilf(it.maxGlyphBoundingBoxY()) - (glyphOverflow-&gt;computeBounds ? 0 : fontMetrics().descent()));
-        glyphOverflow-&gt;left = ceilf(it.firstGlyphOverflow());
-        glyphOverflow-&gt;right = ceilf(it.lastGlyphOverflow());
-    }
-
-    return it.m_runWidthSoFar;
-}
-
-void FontCascade::adjustSelectionRectForSimpleText(const TextRun&amp; run, LayoutRect&amp; selectionRect, int from, int to) const
-{
-    GlyphBuffer glyphBuffer;
-    WidthIterator it(this, run);
-    it.advance(from, &amp;glyphBuffer);
-    float beforeWidth = it.m_runWidthSoFar;
-    it.advance(to, &amp;glyphBuffer);
-    float afterWidth = it.m_runWidthSoFar;
-    float totalWidth = -1;
-
-    if (run.rtl()) {
-        it.advance(run.length(), &amp;glyphBuffer);
-        totalWidth = it.m_runWidthSoFar;
-        selectionRect.move(totalWidth - afterWidth, 0);
-    } else
-        selectionRect.move(beforeWidth, 0);
-    selectionRect.setWidth(afterWidth - beforeWidth);
-}
-
-int FontCascade::offsetForPositionForSimpleText(const TextRun&amp; run, float x, bool includePartialGlyphs) const
-{
-    float delta = x;
-
-    WidthIterator it(this, run);
-    GlyphBuffer localGlyphBuffer;
-    unsigned offset;
-    if (run.rtl()) {
-        delta -= floatWidthForSimpleText(run);
-        while (1) {
-            offset = it.m_currentCharacter;
-            float w;
-            if (!it.advanceOneCharacter(w, localGlyphBuffer))
-                break;
-            delta += w;
-            if (includePartialGlyphs) {
-                if (delta - w / 2 &gt;= 0)
-                    break;
-            } else {
-                if (delta &gt;= 0)
-                    break;
-            }
-        }
-    } else {
-        while (1) {
-            offset = it.m_currentCharacter;
-            float w;
-            if (!it.advanceOneCharacter(w, localGlyphBuffer))
-                break;
-            delta -= w;
-            if (includePartialGlyphs) {
-                if (delta + w / 2 &lt;= 0)
-                    break;
-            } else {
-                if (delta &lt;= 0)
-                    break;
-            }
-        }
-    }
-
-    return offset;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaFontCascadeCocoammfromrev178510trunkSourceWebCoreplatformgraphicsmacFontMacmm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm (from rev 178510, trunk/Source/WebCore/platform/graphics/mac/FontMac.mm) (0 => 178578)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm                                (rev 0)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm        2015-01-16 16:07:46 UTC (rev 178578)
</span><span class="lines">@@ -0,0 +1,751 @@
</span><ins>+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ *           (C) 1999 Antti Koivisto (koivisto@kde.org)
+ *           (C) 2000 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#import &quot;config.h&quot;
+#import &quot;FontCascade.h&quot;
+
+#import &quot;ComplexTextController.h&quot;
+#import &quot;CoreGraphicsSPI.h&quot;
+#import &quot;CoreTextSPI.h&quot;
+#import &quot;DashArray.h&quot;
+#import &quot;GlyphBuffer.h&quot;
+#import &quot;GraphicsContext.h&quot;
+#import &quot;LayoutRect.h&quot;
+#import &quot;Logging.h&quot;
+#import &quot;SimpleFontData.h&quot;
+#import &quot;WebCoreSystemInterface.h&quot;
+#if USE(APPKIT)
+#import &lt;AppKit/AppKit.h&gt;
+#endif
+#import &lt;wtf/MathExtras.h&gt;
+
+#if ENABLE(LETTERPRESS)
+#import &quot;CoreUISPI.h&quot;
+#import &quot;SoftLinking.h&quot;
+
+SOFT_LINK_PRIVATE_FRAMEWORK(CoreUI)
+SOFT_LINK_CLASS(CoreUI, CUICatalog)
+SOFT_LINK_CLASS(CoreUI, CUIStyleEffectConfiguration)
+
+SOFT_LINK_FRAMEWORK(UIKit)
+SOFT_LINK(UIKit, _UIKitGetTextEffectsCatalog, CUICatalog *, (void), ())
+#endif
+
+#define SYNTHETIC_OBLIQUE_ANGLE 14
+
+#ifdef __LP64__
+#define URefCon void*
+#else
+#define URefCon UInt32
+#endif
+
+namespace WebCore {
+
+bool FontCascade::canReturnFallbackFontsForComplexText()
+{
+    return true;
+}
+
+bool FontCascade::canExpandAroundIdeographsInComplexText()
+{
+    return true;
+}
+
+static inline void fillVectorWithHorizontalGlyphPositions(Vector&lt;CGPoint, 256&gt;&amp; positions, CGContextRef context, const CGSize* advances, size_t count)
+{
+    CGAffineTransform matrix = CGAffineTransformInvert(CGContextGetTextMatrix(context));
+    positions[0] = CGPointZero;
+    for (size_t i = 1; i &lt; count; ++i) {
+        CGSize advance = CGSizeApplyAffineTransform(advances[i - 1], matrix);
+        positions[i].x = positions[i - 1].x + advance.width;
+        positions[i].y = positions[i - 1].y + advance.height;
+    }
+}
+
+static inline bool shouldUseLetterpressEffect(const GraphicsContext&amp; context)
+{
+#if ENABLE(LETTERPRESS)
+    return context.textDrawingMode() &amp; TextModeLetterpress;
+#else
+    UNUSED_PARAM(context);
+    return false;
+#endif
+}
+
+static void showLetterpressedGlyphsWithAdvances(const FloatPoint&amp; point, const SimpleFontData* font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count)
+{
+#if ENABLE(LETTERPRESS)
+    if (!count)
+        return;
+
+    const FontPlatformData&amp; platformData = font-&gt;platformData();
+    if (platformData.orientation() == Vertical) {
+        // FIXME: Implement support for vertical text. See &lt;rdar://problem/13737298&gt;.
+        return;
+    }
+
+    CGContextSetTextPosition(context, point.x(), point.y());
+    Vector&lt;CGPoint, 256&gt; positions(count);
+    fillVectorWithHorizontalGlyphPositions(positions, context, advances, count);
+
+    CTFontRef ctFont = platformData.ctFont();
+    CGContextSetFontSize(context, CTFontGetSize(ctFont));
+
+    static CUICatalog *catalog = _UIKitGetTextEffectsCatalog();
+    if (!catalog)
+        return;
+
+    static CUIStyleEffectConfiguration *styleConfiguration;
+    if (!styleConfiguration) {
+        styleConfiguration = [allocCUIStyleEffectConfigurationInstance() init];
+        styleConfiguration.useSimplifiedEffect = YES;
+    }
+
+    [catalog drawGlyphs:glyphs atPositions:positions.data() inContext:context withFont:ctFont count:count stylePresetName:@&quot;_UIKitNewLetterpressStyle&quot; styleConfiguration:styleConfiguration foregroundColor:CGContextGetFillColorAsColor(context)];
+#else
+    UNUSED_PARAM(point);
+    UNUSED_PARAM(font);
+    UNUSED_PARAM(context);
+    UNUSED_PARAM(glyphs);
+    UNUSED_PARAM(advances);
+    UNUSED_PARAM(count);
+#endif
+}
+
+static void showGlyphsWithAdvances(const FloatPoint&amp; point, const SimpleFontData* font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count)
+{
+    if (!count)
+        return;
+
+    CGContextSetTextPosition(context, point.x(), point.y());
+
+    const FontPlatformData&amp; platformData = font-&gt;platformData();
+    Vector&lt;CGPoint, 256&gt; positions(count);
+    if (platformData.isColorBitmapFont())
+        fillVectorWithHorizontalGlyphPositions(positions, context, advances, count);
+    if (platformData.orientation() == Vertical) {
+        CGAffineTransform savedMatrix;
+        CGAffineTransform rotateLeftTransform = CGAffineTransformMake(0, -1, 1, 0, 0, 0);
+        savedMatrix = CGContextGetTextMatrix(context);
+        CGAffineTransform runMatrix = CGAffineTransformConcat(savedMatrix, rotateLeftTransform);
+        CGContextSetTextMatrix(context, runMatrix);
+
+        Vector&lt;CGSize, 256&gt; translations(count);
+        CTFontGetVerticalTranslationsForGlyphs(platformData.ctFont(), glyphs, translations.data(), count);
+
+        CGAffineTransform transform = CGAffineTransformInvert(CGContextGetTextMatrix(context));
+
+        CGPoint position = FloatPoint(point.x(), point.y() + font-&gt;fontMetrics().floatAscent(IdeographicBaseline) - font-&gt;fontMetrics().floatAscent());
+        for (size_t i = 0; i &lt; count; ++i) {
+            CGSize translation = CGSizeApplyAffineTransform(translations[i], rotateLeftTransform);
+            positions[i] = CGPointApplyAffineTransform(CGPointMake(position.x - translation.width, position.y + translation.height), transform);
+            position.x += advances[i].width;
+            position.y += advances[i].height;
+        }
+        if (!platformData.isColorBitmapFont())
+            CGContextShowGlyphsAtPositions(context, glyphs, positions.data(), count);
+        else
+            CTFontDrawGlyphs(platformData.ctFont(), glyphs, positions.data(), count, context);
+        CGContextSetTextMatrix(context, savedMatrix);
+    } else {
+        if (!platformData.isColorBitmapFont())
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored &quot;-Wdeprecated-declarations&quot;
+            CGContextShowGlyphsWithAdvances(context, glyphs, advances, count);
+#pragma clang diagnostic pop
+        else
+            CTFontDrawGlyphs(platformData.ctFont(), glyphs, positions.data(), count, context);
+    }
+}
+
+#if PLATFORM(MAC)
+static void setCGFontRenderingMode(CGContextRef cgContext, NSFontRenderingMode renderingMode, BOOL shouldSubpixelQuantize)
+{
+    if (renderingMode == NSFontIntegerAdvancementsRenderingMode) {
+        CGContextSetShouldAntialiasFonts(cgContext, false);
+        return;
+    }
+
+    CGContextSetShouldAntialiasFonts(cgContext, true);
+
+    CGAffineTransform contextTransform = CGContextGetCTM(cgContext);
+    BOOL isTranslationOrIntegralScale = WTF::isIntegral(contextTransform.a) &amp;&amp; WTF::isIntegral(contextTransform.d) &amp;&amp; contextTransform.b == 0.f &amp;&amp; contextTransform.c == 0.f;
+    BOOL isRotated = ((contextTransform.b || contextTransform.c) &amp;&amp; (contextTransform.a || contextTransform.d));
+    BOOL doSubpixelQuantization = isTranslationOrIntegralScale || (!isRotated &amp;&amp; shouldSubpixelQuantize);
+
+    CGContextSetShouldSubpixelPositionFonts(cgContext, renderingMode != NSFontAntialiasedIntegerAdvancementsRenderingMode || !isTranslationOrIntegralScale);
+    CGContextSetShouldSubpixelQuantizeFonts(cgContext, doSubpixelQuantization);
+}
+#endif
+
+void FontCascade::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, const GlyphBuffer&amp; glyphBuffer, int from, int numGlyphs, const FloatPoint&amp; anchorPoint) const
+{
+    const FontPlatformData&amp; platformData = font-&gt;platformData();
+    if (!platformData.size())
+        return;
+
+    CGContextRef cgContext = context-&gt;platformContext();
+
+    bool shouldSmoothFonts;
+    bool changeFontSmoothing;
+    
+    switch (fontDescription().fontSmoothing()) {
+    case Antialiased: {
+        context-&gt;setShouldAntialias(true);
+        shouldSmoothFonts = false;
+        changeFontSmoothing = true;
+        break;
+    }
+    case SubpixelAntialiased: {
+        context-&gt;setShouldAntialias(true);
+        shouldSmoothFonts = true;
+        changeFontSmoothing = true;
+        break;
+    }
+    case NoSmoothing: {
+        context-&gt;setShouldAntialias(false);
+        shouldSmoothFonts = false;
+        changeFontSmoothing = true;
+        break;
+    }
+    case AutoSmoothing: {
+        shouldSmoothFonts = true;
+        changeFontSmoothing = false;
+        break;
+    }
+    }
+    
+    if (!shouldUseSmoothing()) {
+        shouldSmoothFonts = false;
+        changeFontSmoothing = true;
+    }
+
+#if !PLATFORM(IOS)
+    bool originalShouldUseFontSmoothing = false;
+    if (changeFontSmoothing) {
+        originalShouldUseFontSmoothing = CGContextGetShouldSmoothFonts(cgContext);
+        CGContextSetShouldSmoothFonts(cgContext, shouldSmoothFonts);
+    }
+#endif
+
+#if !PLATFORM(IOS)
+    NSFont* drawFont;
+    if (!isPrinterFont()) {
+        drawFont = [platformData.nsFont() screenFont];
+        if (drawFont != platformData.nsFont()) {
+            // We are getting this in too many places (3406411); use ERROR so it only prints on debug versions for now. (We should debug this also, eventually).
+            LOG_ERROR(&quot;Attempting to set non-screen font (%@) when drawing to screen.  Using screen font anyway, may result in incorrect metrics.&quot;,
+                [[[platformData.nsFont() fontDescriptor] fontAttributes] objectForKey:NSFontNameAttribute]);
+        }
+    } else {
+        drawFont = [platformData.nsFont() printerFont];
+        if (drawFont != platformData.nsFont()) {
+            NSLog(@&quot;Attempting to set non-printer font (%@) when printing.  Using printer font anyway, may result in incorrect metrics.&quot;,
+                [[[platformData.nsFont() fontDescriptor] fontAttributes] objectForKey:NSFontNameAttribute]);
+        }
+    }
+#endif
+    
+    CGContextSetFont(cgContext, platformData.cgFont());
+
+    bool useLetterpressEffect = shouldUseLetterpressEffect(*context);
+    FloatPoint point = anchorPoint;
+#if PLATFORM(IOS)
+    float fontSize = platformData.size();
+    CGAffineTransform matrix = useLetterpressEffect || platformData.isColorBitmapFont() ? CGAffineTransformIdentity : CGAffineTransformMakeScale(fontSize, fontSize);
+    if (platformData.m_isEmoji) {
+        if (!context-&gt;emojiDrawingEnabled())
+            return;
+
+        // Mimic the positioining of non-bitmap glyphs, which are not subpixel-positioned.
+        point.setY(ceilf(point.y()));
+
+        // Emoji glyphs snap to the CSS pixel grid.
+        point.setX(floorf(point.x()));
+
+        // Emoji glyphs are offset one CSS pixel to the right.
+        point.move(1, 0);
+
+        // Emoji glyphs are offset vertically based on font size.
+        float y = point.y();
+        if (fontSize &lt;= 15) {
+            // Undo Core Text's y adjustment.
+            static float yAdjustmentFactor = iosExecutableWasLinkedOnOrAfterVersion(wkIOSSystemVersion_6_0) ? .19 : .1;
+            point.setY(floorf(y - yAdjustmentFactor * (fontSize + 2) + 2));
+        } else {
+            if (fontSize &lt; 26)
+                y -= .35f * fontSize - 10;
+
+            // Undo Core Text's y adjustment.
+            static float yAdjustment = iosExecutableWasLinkedOnOrAfterVersion(wkIOSSystemVersion_6_0) ? 3.8 : 2;
+            point.setY(floorf(y - yAdjustment));
+        }
+    }
+#else
+    CGAffineTransform matrix = CGAffineTransformIdentity;
+    if (drawFont &amp;&amp; !platformData.isColorBitmapFont())
+        memcpy(&amp;matrix, [drawFont matrix], sizeof(matrix));
+#endif
+    matrix.b = -matrix.b;
+    matrix.d = -matrix.d;
+    if (platformData.m_syntheticOblique) {
+        static float obliqueSkew = tanf(SYNTHETIC_OBLIQUE_ANGLE * piFloat / 180);
+        if (platformData.orientation() == Vertical)
+            matrix = CGAffineTransformConcat(matrix, CGAffineTransformMake(1, obliqueSkew, 0, 1, 0, 0));
+        else
+            matrix = CGAffineTransformConcat(matrix, CGAffineTransformMake(1, 0, -obliqueSkew, 1, 0, 0));
+    }
+    CGContextSetTextMatrix(cgContext, matrix);
+
+#if PLATFORM(IOS)
+    CGContextSetFontSize(cgContext, 1);
+    CGContextSetShouldSubpixelQuantizeFonts(cgContext, context-&gt;shouldSubpixelQuantizeFonts());
+#else
+    setCGFontRenderingMode(cgContext, [drawFont renderingMode], context-&gt;shouldSubpixelQuantizeFonts());
+    if (drawFont)
+        CGContextSetFontSize(cgContext, 1);
+    else
+        CGContextSetFontSize(cgContext, platformData.m_size);
+#endif
+
+
+    FloatSize shadowOffset;
+    float shadowBlur;
+    Color shadowColor;
+    ColorSpace shadowColorSpace;
+    ColorSpace fillColorSpace = context-&gt;fillColorSpace();
+    context-&gt;getShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace);
+
+    AffineTransform contextCTM = context-&gt;getCTM();
+    float syntheticBoldOffset = font-&gt;syntheticBoldOffset();
+    if (syntheticBoldOffset &amp;&amp; !contextCTM.isIdentityOrTranslationOrFlipped()) {
+        FloatSize horizontalUnitSizeInDevicePixels = contextCTM.mapSize(FloatSize(1, 0));
+        float horizontalUnitLengthInDevicePixels = sqrtf(horizontalUnitSizeInDevicePixels.width() * horizontalUnitSizeInDevicePixels.width() + horizontalUnitSizeInDevicePixels.height() * horizontalUnitSizeInDevicePixels.height());
+        if (horizontalUnitLengthInDevicePixels)
+            syntheticBoldOffset /= horizontalUnitLengthInDevicePixels;
+    };
+
+    bool hasSimpleShadow = context-&gt;textDrawingMode() == TextModeFill &amp;&amp; shadowColor.isValid() &amp;&amp; !shadowBlur &amp;&amp; !platformData.isColorBitmapFont() &amp;&amp; (!context-&gt;shadowsIgnoreTransforms() || contextCTM.isIdentityOrTranslationOrFlipped()) &amp;&amp; !context-&gt;isInTransparencyLayer();
+    if (hasSimpleShadow) {
+        // Paint simple shadows ourselves instead of relying on CG shadows, to avoid losing subpixel antialiasing.
+        context-&gt;clearShadow();
+        Color fillColor = context-&gt;fillColor();
+        Color shadowFillColor(shadowColor.red(), shadowColor.green(), shadowColor.blue(), shadowColor.alpha() * fillColor.alpha() / 255);
+        context-&gt;setFillColor(shadowFillColor, shadowColorSpace);
+        float shadowTextX = point.x() + shadowOffset.width();
+        // If shadows are ignoring transforms, then we haven't applied the Y coordinate flip yet, so down is negative.
+        float shadowTextY = point.y() + shadowOffset.height() * (context-&gt;shadowsIgnoreTransforms() ? -1 : 1);
+        showGlyphsWithAdvances(FloatPoint(shadowTextX, shadowTextY), font, cgContext, glyphBuffer.glyphs(from), static_cast&lt;const CGSize*&gt;(glyphBuffer.advances(from)), numGlyphs);
+#if !PLATFORM(IOS)
+        if (syntheticBoldOffset)
+#else
+        if (syntheticBoldOffset &amp;&amp; !platformData.m_isEmoji)
+#endif
+            showGlyphsWithAdvances(FloatPoint(shadowTextX + syntheticBoldOffset, shadowTextY), font, cgContext, glyphBuffer.glyphs(from), static_cast&lt;const CGSize*&gt;(glyphBuffer.advances(from)), numGlyphs);
+        context-&gt;setFillColor(fillColor, fillColorSpace);
+    }
+
+    if (useLetterpressEffect)
+        showLetterpressedGlyphsWithAdvances(point, font, cgContext, glyphBuffer.glyphs(from), static_cast&lt;const CGSize*&gt;(glyphBuffer.advances(from)), numGlyphs);
+    else
+        showGlyphsWithAdvances(point, font, cgContext, glyphBuffer.glyphs(from), static_cast&lt;const CGSize*&gt;(glyphBuffer.advances(from)), numGlyphs);
+#if !PLATFORM(IOS)
+    if (syntheticBoldOffset)
+#else
+    if (syntheticBoldOffset &amp;&amp; !platformData.m_isEmoji)
+#endif
+        showGlyphsWithAdvances(FloatPoint(point.x() + syntheticBoldOffset, point.y()), font, cgContext, glyphBuffer.glyphs(from), static_cast&lt;const CGSize*&gt;(glyphBuffer.advances(from)), numGlyphs);
+
+    if (hasSimpleShadow)
+        context-&gt;setShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace);
+
+#if !PLATFORM(IOS)
+    if (changeFontSmoothing)
+        CGContextSetShouldSmoothFonts(cgContext, originalShouldUseFontSmoothing);
+#endif
+}
+
+#if ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
+struct GlyphIterationState {
+    GlyphIterationState(CGPoint startingPoint, CGPoint currentPoint, CGFloat y1, CGFloat y2, CGFloat minX, CGFloat maxX)
+        : startingPoint(startingPoint)
+        , currentPoint(currentPoint)
+        , y1(y1)
+        , y2(y2)
+        , minX(minX)
+        , maxX(maxX)
+    {
+    }
+    CGPoint startingPoint;
+    CGPoint currentPoint;
+    CGFloat y1;
+    CGFloat y2;
+    CGFloat minX;
+    CGFloat maxX;
+};
+
+static bool findIntersectionPoint(float y, CGPoint p1, CGPoint p2, CGFloat&amp; x)
+{
+    x = p1.x + (y - p1.y) * (p2.x - p1.x) / (p2.y - p1.y);
+    return (p1.y &lt; y &amp;&amp; p2.y &gt; y) || (p1.y &gt; y &amp;&amp; p2.y &lt; y);
+}
+
+static void updateX(GlyphIterationState&amp; state, CGFloat x)
+{
+    state.minX = std::min(state.minX, x);
+    state.maxX = std::max(state.maxX, x);
+}
+
+// This function is called by CGPathApply and is therefore invoked for each
+// contour in a glyph. This function models each contours as a straight line
+// and calculates the intersections between each pseudo-contour and
+// two horizontal lines (the upper and lower bounds of an underline) found in
+// GlyphIterationState::y1 and GlyphIterationState::y2. It keeps track of the
+// leftmost and rightmost intersection in GlyphIterationState::minX and
+// GlyphIterationState::maxX.
+static void findPathIntersections(void* stateAsVoidPointer, const CGPathElement* e)
+{
+    auto&amp; state = *static_cast&lt;GlyphIterationState*&gt;(stateAsVoidPointer);
+    bool doIntersection = false;
+    CGPoint point = CGPointZero;
+    switch (e-&gt;type) {
+    case kCGPathElementMoveToPoint:
+        state.startingPoint = e-&gt;points[0];
+        state.currentPoint = e-&gt;points[0];
+        break;
+    case kCGPathElementAddLineToPoint:
+        doIntersection = true;
+        point = e-&gt;points[0];
+        break;
+    case kCGPathElementAddQuadCurveToPoint:
+        doIntersection = true;
+        point = e-&gt;points[1];
+        break;
+    case kCGPathElementAddCurveToPoint:
+        doIntersection = true;
+        point = e-&gt;points[2];
+        break;
+    case kCGPathElementCloseSubpath:
+        doIntersection = true;
+        point = state.startingPoint;
+        break;
+    }
+    if (!doIntersection)
+        return;
+    CGFloat x;
+    if (findIntersectionPoint(state.y1, state.currentPoint, point, x))
+        updateX(state, x);
+    if (findIntersectionPoint(state.y2, state.currentPoint, point, x))
+        updateX(state, x);
+    if ((state.currentPoint.y &gt;= state.y1 &amp;&amp; state.currentPoint.y &lt;= state.y2)
+        || (state.currentPoint.y &lt;= state.y1 &amp;&amp; state.currentPoint.y &gt;= state.y2))
+        updateX(state, state.currentPoint.x);
+    state.currentPoint = point;
+}
+
+class MacGlyphToPathTranslator final : public GlyphToPathTranslator {
+public:
+    MacGlyphToPathTranslator(const TextRun&amp; textRun, const GlyphBuffer&amp; glyphBuffer, const FloatPoint&amp; textOrigin)
+        : m_index(0)
+        , m_textRun(textRun)
+        , m_glyphBuffer(glyphBuffer)
+        , m_fontData(glyphBuffer.fontDataAt(m_index))
+        , m_translation(CGAffineTransformScale(CGAffineTransformMakeTranslation(textOrigin.x(), textOrigin.y()), 1, -1))
+    {
+        moveToNextValidGlyph();
+    }
+private:
+    virtual bool containsMorePaths() override
+    {
+        return m_index != m_glyphBuffer.size();
+    }
+    virtual Path path() override;
+    virtual std::pair&lt;float, float&gt; extents() override;
+    virtual GlyphUnderlineType underlineType() override;
+    virtual void advance() override;
+    void moveToNextValidGlyph();
+
+    int m_index;
+    const TextRun&amp; m_textRun;
+    const GlyphBuffer&amp; m_glyphBuffer;
+    const SimpleFontData* m_fontData;
+    CGAffineTransform m_translation;
+};
+
+Path MacGlyphToPathTranslator::path()
+{
+    RetainPtr&lt;CGPathRef&gt; result = adoptCF(CTFontCreatePathForGlyph(m_fontData-&gt;platformData().ctFont(), m_glyphBuffer.glyphAt(m_index), &amp;m_translation));
+    return adoptCF(CGPathCreateMutableCopy(result.get()));
+}
+
+std::pair&lt;float, float&gt; MacGlyphToPathTranslator::extents()
+{
+    CGPoint beginning = CGPointApplyAffineTransform(CGPointMake(0, 0), m_translation);
+    CGSize end = CGSizeApplyAffineTransform(m_glyphBuffer.advanceAt(m_index), m_translation);
+    return std::make_pair(static_cast&lt;float&gt;(beginning.x), static_cast&lt;float&gt;(beginning.x + end.width));
+}
+
+auto MacGlyphToPathTranslator::underlineType() -&gt; GlyphUnderlineType
+{
+    return computeUnderlineType(m_textRun, m_glyphBuffer, m_index);
+}
+
+void MacGlyphToPathTranslator::moveToNextValidGlyph()
+{
+    if (!m_fontData-&gt;isSVGFont())
+        return;
+    advance();
+}
+
+void MacGlyphToPathTranslator::advance()
+{
+    do {
+        GlyphBufferAdvance advance = m_glyphBuffer.advanceAt(m_index);
+        m_translation = CGAffineTransformTranslate(m_translation, advance.width(), advance.height());
+        ++m_index;
+        if (m_index &gt;= m_glyphBuffer.size())
+            break;
+        m_fontData = m_glyphBuffer.fontDataAt(m_index);
+    } while (m_fontData-&gt;isSVGFont() &amp;&amp; m_index &lt; m_glyphBuffer.size());
+}
+
+DashArray FontCascade::dashesForIntersectionsWithRect(const TextRun&amp; run, const FloatPoint&amp; textOrigin, const FloatRect&amp; lineExtents) const
+{
+    if (isLoadingCustomFonts())
+        return DashArray();
+
+    GlyphBuffer glyphBuffer;
+    glyphBuffer.saveOffsetsInString();
+    float deltaX;
+    if (codePath(run) != FontCascade::Complex)
+        deltaX = getGlyphsAndAdvancesForSimpleText(run, 0, run.length(), glyphBuffer);
+    else
+        deltaX = getGlyphsAndAdvancesForComplexText(run, 0, run.length(), glyphBuffer);
+
+    if (!glyphBuffer.size())
+        return DashArray();
+    
+    // FIXME: Handle SVG + non-SVG interleaved runs. https://bugs.webkit.org/show_bug.cgi?id=133778
+    const SimpleFontData* fontData = glyphBuffer.fontDataAt(0);
+    std::unique_ptr&lt;GlyphToPathTranslator&gt; translator;
+    bool isSVG = false;
+    FloatPoint origin = FloatPoint(textOrigin.x() + deltaX, textOrigin.y());
+    if (!fontData-&gt;isSVGFont())
+        translator = std::make_unique&lt;MacGlyphToPathTranslator&gt;(run, glyphBuffer, origin);
+    else {
+        TextRun::RenderingContext* renderingContext = run.renderingContext();
+        if (!renderingContext)
+            return DashArray();
+        translator = renderingContext-&gt;createGlyphToPathTranslator(*fontData, &amp;run, glyphBuffer, 0, glyphBuffer.size(), origin);
+        isSVG = true;
+    }
+    DashArray result;
+    for (int index = 0; translator-&gt;containsMorePaths(); ++index, translator-&gt;advance()) {
+        GlyphIterationState info = GlyphIterationState(CGPointMake(0, 0), CGPointMake(0, 0), lineExtents.y(), lineExtents.y() + lineExtents.height(), lineExtents.x() + lineExtents.width(), lineExtents.x());
+        const SimpleFontData* localFontData = glyphBuffer.fontDataAt(index);
+        if (!localFontData || (!isSVG &amp;&amp; localFontData-&gt;isSVGFont()) || (isSVG &amp;&amp; localFontData != fontData)) {
+            // The advances will get all messed up if we do anything other than bail here.
+            result.clear();
+            break;
+        }
+        switch (translator-&gt;underlineType()) {
+        case GlyphToPathTranslator::GlyphUnderlineType::SkipDescenders: {
+            Path path = translator-&gt;path();
+            CGPathApply(path.platformPath(), &amp;info, &amp;findPathIntersections);
+            if (info.minX &lt; info.maxX) {
+                result.append(info.minX - lineExtents.x());
+                result.append(info.maxX - lineExtents.x());
+            }
+            break;
+        }
+        case GlyphToPathTranslator::GlyphUnderlineType::SkipGlyph: {
+            std::pair&lt;float, float&gt; extents = translator-&gt;extents();
+            result.append(extents.first - lineExtents.x());
+            result.append(extents.second - lineExtents.x());
+            break;
+        }
+        case GlyphToPathTranslator::GlyphUnderlineType::DrawOverGlyph:
+            // Nothing to do
+            break;
+        }
+    }
+    return result;
+}
+#endif
+
+bool FontCascade::primaryFontDataIsSystemFont() const
+{
+#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED &gt; 1090
+    const auto&amp; fontData = primaryFontData();
+    return !fontData.isSVGFont() &amp;&amp; CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(fontData.platformData().ctFont())).get());
+#else
+    // System fonts are hidden by having a name that begins with a period, so simply search
+    // for that here rather than try to keep the list up to date.
+    return firstFamily().startsWith('.');
+#endif
+}
+
+void FontCascade::adjustSelectionRectForComplexText(const TextRun&amp; run, LayoutRect&amp; selectionRect, int from, int to) const
+{
+    ComplexTextController controller(this, run);
+    controller.advance(from);
+    float beforeWidth = controller.runWidthSoFar();
+    controller.advance(to);
+    float afterWidth = controller.runWidthSoFar();
+
+    if (run.rtl())
+        selectionRect.move(controller.totalWidth() - afterWidth, 0);
+    else
+        selectionRect.move(beforeWidth, 0);
+    selectionRect.setWidth(afterWidth - beforeWidth);
+}
+
+float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun&amp; run, int from, int to, GlyphBuffer&amp; glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
+{
+    float initialAdvance;
+
+    ComplexTextController controller(this, run, false, 0, forTextEmphasis);
+    controller.advance(from);
+    float beforeWidth = controller.runWidthSoFar();
+    controller.advance(to, &amp;glyphBuffer);
+
+    if (glyphBuffer.isEmpty())
+        return 0;
+
+    float afterWidth = controller.runWidthSoFar();
+
+    if (run.rtl()) {
+        initialAdvance = controller.totalWidth() + controller.finalRoundingWidth() - afterWidth;
+        glyphBuffer.reverse(0, glyphBuffer.size());
+    } else
+        initialAdvance = beforeWidth;
+
+    return initialAdvance;
+}
+
+float FontCascade::drawComplexText(GraphicsContext* context, const TextRun&amp; run, const FloatPoint&amp; point, int from, int to) const
+{
+    // This glyph buffer holds our glyphs + advances + font data for each glyph.
+    GlyphBuffer glyphBuffer;
+
+    float startX = point.x() + getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer);
+
+    // We couldn't generate any glyphs for the run. Give up.
+    if (glyphBuffer.isEmpty())
+        return 0;
+
+    // Draw the glyph buffer now at the starting point returned in startX.
+    FloatPoint startPoint(startX, point.y());
+    drawGlyphBuffer(context, run, glyphBuffer, startPoint);
+
+    return startPoint.x() - startX;
+}
+
+void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext* context, const TextRun&amp; run, const AtomicString&amp; mark, const FloatPoint&amp; point, int from, int to) const
+{
+    GlyphBuffer glyphBuffer;
+    float initialAdvance = getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer, ForTextEmphasis);
+
+    if (glyphBuffer.isEmpty())
+        return;
+
+    drawEmphasisMarks(context, run, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y()));
+}
+
+float FontCascade::floatWidthForComplexText(const TextRun&amp; run, HashSet&lt;const SimpleFontData*&gt;* fallbackFonts, GlyphOverflow* glyphOverflow) const
+{
+    ComplexTextController controller(this, run, true, fallbackFonts);
+    if (glyphOverflow) {
+        glyphOverflow-&gt;top = std::max&lt;int&gt;(glyphOverflow-&gt;top, ceilf(-controller.minGlyphBoundingBoxY()) - (glyphOverflow-&gt;computeBounds ? 0 : fontMetrics().ascent()));
+        glyphOverflow-&gt;bottom = std::max&lt;int&gt;(glyphOverflow-&gt;bottom, ceilf(controller.maxGlyphBoundingBoxY()) - (glyphOverflow-&gt;computeBounds ? 0 : fontMetrics().descent()));
+        glyphOverflow-&gt;left = std::max&lt;int&gt;(0, ceilf(-controller.minGlyphBoundingBoxX()));
+        glyphOverflow-&gt;right = std::max&lt;int&gt;(0, ceilf(controller.maxGlyphBoundingBoxX() - controller.totalWidth()));
+    }
+    return controller.totalWidth();
+}
+
+int FontCascade::offsetForPositionForComplexText(const TextRun&amp; run, float x, bool includePartialGlyphs) const
+{
+    ComplexTextController controller(this, run);
+    return controller.offsetForPosition(x, includePartialGlyphs);
+}
+
+const SimpleFontData* FontCascade::fontDataForCombiningCharacterSequence(const UChar* characters, size_t length, FontDataVariant variant) const
+{
+    UChar32 baseCharacter;
+    size_t baseCharacterLength = 0;
+    U16_NEXT(characters, baseCharacterLength, length, baseCharacter);
+
+    GlyphData baseCharacterGlyphData = glyphDataForCharacter(baseCharacter, false, variant);
+
+    if (!baseCharacterGlyphData.glyph)
+        return 0;
+
+    if (length == baseCharacterLength)
+        return baseCharacterGlyphData.fontData;
+
+    bool triedBaseCharacterFontData = false;
+
+    for (unsigned i = 0; !fallbackRangesAt(i).isNull(); ++i) {
+        const SimpleFontData* simpleFontData = fallbackRangesAt(i).fontDataForCharacter(baseCharacter);
+        if (!simpleFontData)
+            continue;
+#if PLATFORM(IOS)
+        if (baseCharacter &gt;= 0x0600 &amp;&amp; baseCharacter &lt;= 0x06ff &amp;&amp; simpleFontData-&gt;shouldNotBeUsedForArabic())
+            continue;
+#endif
+        if (variant == NormalVariant) {
+            if (simpleFontData-&gt;platformData().orientation() == Vertical) {
+                if (isCJKIdeographOrSymbol(baseCharacter) &amp;&amp; !simpleFontData-&gt;hasVerticalGlyphs()) {
+                    variant = BrokenIdeographVariant;
+                    simpleFontData = simpleFontData-&gt;brokenIdeographFontData().get();
+                } else if (m_fontDescription.nonCJKGlyphOrientation() == NonCJKGlyphOrientationVerticalRight) {
+                    SimpleFontData* verticalRightFontData = simpleFontData-&gt;verticalRightOrientationFontData().get();
+                    Glyph verticalRightGlyph = verticalRightFontData-&gt;glyphForCharacter(baseCharacter);
+                    if (verticalRightGlyph == baseCharacterGlyphData.glyph)
+                        simpleFontData = verticalRightFontData;
+                } else {
+                    SimpleFontData* uprightFontData = simpleFontData-&gt;uprightOrientationFontData().get();
+                    Glyph uprightGlyph = uprightFontData-&gt;glyphForCharacter(baseCharacter);
+                    if (uprightGlyph != baseCharacterGlyphData.glyph)
+                        simpleFontData = uprightFontData;
+                }
+            }
+        } else {
+            if (const SimpleFontData* variantFontData = simpleFontData-&gt;variantFontData(m_fontDescription, variant).get())
+                simpleFontData = variantFontData;
+        }
+
+        if (simpleFontData == baseCharacterGlyphData.fontData)
+            triedBaseCharacterFontData = true;
+
+        if (simpleFontData-&gt;canRenderCombiningCharacterSequence(characters, length))
+            return simpleFontData;
+    }
+
+    if (!triedBaseCharacterFontData &amp;&amp; baseCharacterGlyphData.fontData &amp;&amp; baseCharacterGlyphData.fontData-&gt;canRenderCombiningCharacterSequence(characters, length))
+        return baseCharacterGlyphData.fontData;
+
+    return SimpleFontData::systemFallback();
+}
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacFontComplexTextMaccpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp (178577 => 178578)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp        2015-01-16 10:22:45 UTC (rev 178577)
+++ trunk/Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp        2015-01-16 16:07:46 UTC (rev 178578)
</span><span class="lines">@@ -1,184 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
- *
- * 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. AND ITS CONTRIBUTORS ``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 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.
- */
-
-#include &quot;config.h&quot;
-#include &quot;FontCascade.h&quot;
-
-#include &quot;ComplexTextController.h&quot;
-#include &quot;FontGlyphs.h&quot;
-#include &quot;GlyphBuffer.h&quot;
-#include &quot;GraphicsContext.h&quot;
-#include &quot;IntRect.h&quot;
-#include &quot;LayoutRect.h&quot;
-#include &quot;SimpleFontData.h&quot;
-#include &quot;TextRun.h&quot;
-#include &lt;wtf/MathExtras.h&gt;
-
-namespace WebCore {
-
-void FontCascade::adjustSelectionRectForComplexText(const TextRun&amp; run, LayoutRect&amp; selectionRect, int from, int to) const
-{
-    ComplexTextController controller(this, run);
-    controller.advance(from);
-    float beforeWidth = controller.runWidthSoFar();
-    controller.advance(to);
-    float afterWidth = controller.runWidthSoFar();
-
-    if (run.rtl())
-        selectionRect.move(controller.totalWidth() - afterWidth, 0);
-    else
-        selectionRect.move(beforeWidth, 0);
-    selectionRect.setWidth(afterWidth - beforeWidth);
-}
-
-float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun&amp; run, int from, int to, GlyphBuffer&amp; glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
-{
-    float initialAdvance;
-
-    ComplexTextController controller(this, run, false, 0, forTextEmphasis);
-    controller.advance(from);
-    float beforeWidth = controller.runWidthSoFar();
-    controller.advance(to, &amp;glyphBuffer);
-
-    if (glyphBuffer.isEmpty())
-        return 0;
-
-    float afterWidth = controller.runWidthSoFar();
-
-    if (run.rtl()) {
-        initialAdvance = controller.totalWidth() + controller.finalRoundingWidth() - afterWidth;
-        glyphBuffer.reverse(0, glyphBuffer.size());
-    } else
-        initialAdvance = beforeWidth;
-
-    return initialAdvance;
-}
-
-float FontCascade::drawComplexText(GraphicsContext* context, const TextRun&amp; run, const FloatPoint&amp; point, int from, int to) const
-{
-    // This glyph buffer holds our glyphs + advances + font data for each glyph.
-    GlyphBuffer glyphBuffer;
-
-    float startX = point.x() + getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer);
-
-    // We couldn't generate any glyphs for the run.  Give up.
-    if (glyphBuffer.isEmpty())
-        return 0;
-
-    // Draw the glyph buffer now at the starting point returned in startX.
-    FloatPoint startPoint(startX, point.y());
-    drawGlyphBuffer(context, run, glyphBuffer, startPoint);
-
-    return startPoint.x() - startX;
-}
-
-void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext* context, const TextRun&amp; run, const AtomicString&amp; mark, const FloatPoint&amp; point, int from, int to) const
-{
-    GlyphBuffer glyphBuffer;
-    float initialAdvance = getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer, ForTextEmphasis);
-
-    if (glyphBuffer.isEmpty())
-        return;
-
-    drawEmphasisMarks(context, run, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y()));
-}
-
-float FontCascade::floatWidthForComplexText(const TextRun&amp; run, HashSet&lt;const SimpleFontData*&gt;* fallbackFonts, GlyphOverflow* glyphOverflow) const
-{
-    ComplexTextController controller(this, run, true, fallbackFonts);
-    if (glyphOverflow) {
-        glyphOverflow-&gt;top = std::max&lt;int&gt;(glyphOverflow-&gt;top, ceilf(-controller.minGlyphBoundingBoxY()) - (glyphOverflow-&gt;computeBounds ? 0 : fontMetrics().ascent()));
-        glyphOverflow-&gt;bottom = std::max&lt;int&gt;(glyphOverflow-&gt;bottom, ceilf(controller.maxGlyphBoundingBoxY()) - (glyphOverflow-&gt;computeBounds ? 0 : fontMetrics().descent()));
-        glyphOverflow-&gt;left = std::max&lt;int&gt;(0, ceilf(-controller.minGlyphBoundingBoxX()));
-        glyphOverflow-&gt;right = std::max&lt;int&gt;(0, ceilf(controller.maxGlyphBoundingBoxX() - controller.totalWidth()));
-    }
-    return controller.totalWidth();
-}
-
-int FontCascade::offsetForPositionForComplexText(const TextRun&amp; run, float x, bool includePartialGlyphs) const
-{
-    ComplexTextController controller(this, run);
-    return controller.offsetForPosition(x, includePartialGlyphs);
-}
-
-const SimpleFontData* FontCascade::fontDataForCombiningCharacterSequence(const UChar* characters, size_t length, FontDataVariant variant) const
-{
-    UChar32 baseCharacter;
-    size_t baseCharacterLength = 0;
-    U16_NEXT(characters, baseCharacterLength, length, baseCharacter);
-
-    GlyphData baseCharacterGlyphData = glyphDataForCharacter(baseCharacter, false, variant);
-
-    if (!baseCharacterGlyphData.glyph)
-        return 0;
-
-    if (length == baseCharacterLength)
-        return baseCharacterGlyphData.fontData;
-
-    bool triedBaseCharacterFontData = false;
-
-    for (unsigned i = 0; !fallbackRangesAt(i).isNull(); ++i) {
-        const SimpleFontData* simpleFontData = fallbackRangesAt(i).fontDataForCharacter(baseCharacter);
-        if (!simpleFontData)
-            continue;
-#if PLATFORM(IOS)
-        if (baseCharacter &gt;= 0x0600 &amp;&amp; baseCharacter &lt;= 0x06ff &amp;&amp; simpleFontData-&gt;shouldNotBeUsedForArabic())
-            continue;
-#endif
-        if (variant == NormalVariant) {
-            if (simpleFontData-&gt;platformData().orientation() == Vertical) {
-                if (isCJKIdeographOrSymbol(baseCharacter) &amp;&amp; !simpleFontData-&gt;hasVerticalGlyphs()) {
-                    variant = BrokenIdeographVariant;
-                    simpleFontData = simpleFontData-&gt;brokenIdeographFontData().get();
-                } else if (m_fontDescription.nonCJKGlyphOrientation() == NonCJKGlyphOrientationVerticalRight) {
-                    SimpleFontData* verticalRightFontData = simpleFontData-&gt;verticalRightOrientationFontData().get();
-                    Glyph verticalRightGlyph = verticalRightFontData-&gt;glyphForCharacter(baseCharacter);
-                    if (verticalRightGlyph == baseCharacterGlyphData.glyph)
-                        simpleFontData = verticalRightFontData;
-                } else {
-                    SimpleFontData* uprightFontData = simpleFontData-&gt;uprightOrientationFontData().get();
-                    Glyph uprightGlyph = uprightFontData-&gt;glyphForCharacter(baseCharacter);
-                    if (uprightGlyph != baseCharacterGlyphData.glyph)
-                        simpleFontData = uprightFontData;
-                }
-            }
-        } else {
-            if (const SimpleFontData* variantFontData = simpleFontData-&gt;variantFontData(m_fontDescription, variant).get())
-                simpleFontData = variantFontData;
-        }
-
-        if (simpleFontData == baseCharacterGlyphData.fontData)
-            triedBaseCharacterFontData = true;
-
-        if (simpleFontData-&gt;canRenderCombiningCharacterSequence(characters, length))
-            return simpleFontData;
-    }
-
-    if (!triedBaseCharacterFontData &amp;&amp; baseCharacterGlyphData.fontData &amp;&amp; baseCharacterGlyphData.fontData-&gt;canRenderCombiningCharacterSequence(characters, length))
-        return baseCharacterGlyphData.fontData;
-
-    return SimpleFontData::systemFallback();
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacFontMacmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/graphics/mac/FontMac.mm (178577 => 178578)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/FontMac.mm        2015-01-16 10:22:45 UTC (rev 178577)
+++ trunk/Source/WebCore/platform/graphics/mac/FontMac.mm        2015-01-16 16:07:46 UTC (rev 178578)
</span><span class="lines">@@ -1,605 +0,0 @@
</span><del>-/*
- * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
- *           (C) 1999 Antti Koivisto (koivisto@kde.org)
- *           (C) 2000 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#import &quot;config.h&quot;
-#import &quot;FontCascade.h&quot;
-
-#import &quot;CoreGraphicsSPI.h&quot;
-#import &quot;CoreTextSPI.h&quot;
-#import &quot;DashArray.h&quot;
-#import &quot;GlyphBuffer.h&quot;
-#import &quot;GraphicsContext.h&quot;
-#import &quot;Logging.h&quot;
-#import &quot;SimpleFontData.h&quot;
-#import &quot;WebCoreSystemInterface.h&quot;
-#if USE(APPKIT)
-#import &lt;AppKit/AppKit.h&gt;
-#endif
-#import &lt;wtf/MathExtras.h&gt;
-
-#if ENABLE(LETTERPRESS)
-#import &quot;CoreUISPI.h&quot;
-#import &quot;SoftLinking.h&quot;
-
-SOFT_LINK_PRIVATE_FRAMEWORK(CoreUI)
-SOFT_LINK_CLASS(CoreUI, CUICatalog)
-SOFT_LINK_CLASS(CoreUI, CUIStyleEffectConfiguration)
-
-SOFT_LINK_FRAMEWORK(UIKit)
-SOFT_LINK(UIKit, _UIKitGetTextEffectsCatalog, CUICatalog *, (void), ())
-#endif
-
-#define SYNTHETIC_OBLIQUE_ANGLE 14
-
-#ifdef __LP64__
-#define URefCon void*
-#else
-#define URefCon UInt32
-#endif
-
-namespace WebCore {
-
-bool FontCascade::canReturnFallbackFontsForComplexText()
-{
-    return true;
-}
-
-bool FontCascade::canExpandAroundIdeographsInComplexText()
-{
-    return true;
-}
-
-static inline void fillVectorWithHorizontalGlyphPositions(Vector&lt;CGPoint, 256&gt;&amp; positions, CGContextRef context, const CGSize* advances, size_t count)
-{
-    CGAffineTransform matrix = CGAffineTransformInvert(CGContextGetTextMatrix(context));
-    positions[0] = CGPointZero;
-    for (size_t i = 1; i &lt; count; ++i) {
-        CGSize advance = CGSizeApplyAffineTransform(advances[i - 1], matrix);
-        positions[i].x = positions[i - 1].x + advance.width;
-        positions[i].y = positions[i - 1].y + advance.height;
-    }
-}
-
-static inline bool shouldUseLetterpressEffect(const GraphicsContext&amp; context)
-{
-#if ENABLE(LETTERPRESS)
-    return context.textDrawingMode() &amp; TextModeLetterpress;
-#else
-    UNUSED_PARAM(context);
-    return false;
-#endif
-}
-
-static void showLetterpressedGlyphsWithAdvances(const FloatPoint&amp; point, const SimpleFontData* font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count)
-{
-#if ENABLE(LETTERPRESS)
-    if (!count)
-        return;
-
-    const FontPlatformData&amp; platformData = font-&gt;platformData();
-    if (platformData.orientation() == Vertical) {
-        // FIXME: Implement support for vertical text. See &lt;rdar://problem/13737298&gt;.
-        return;
-    }
-
-    CGContextSetTextPosition(context, point.x(), point.y());
-    Vector&lt;CGPoint, 256&gt; positions(count);
-    fillVectorWithHorizontalGlyphPositions(positions, context, advances, count);
-
-    CTFontRef ctFont = platformData.ctFont();
-    CGContextSetFontSize(context, CTFontGetSize(ctFont));
-
-    static CUICatalog *catalog = _UIKitGetTextEffectsCatalog();
-    if (!catalog)
-        return;
-
-    static CUIStyleEffectConfiguration *styleConfiguration;
-    if (!styleConfiguration) {
-        styleConfiguration = [allocCUIStyleEffectConfigurationInstance() init];
-        styleConfiguration.useSimplifiedEffect = YES;
-    }
-
-    [catalog drawGlyphs:glyphs atPositions:positions.data() inContext:context withFont:ctFont count:count stylePresetName:@&quot;_UIKitNewLetterpressStyle&quot; styleConfiguration:styleConfiguration foregroundColor:CGContextGetFillColorAsColor(context)];
-#else
-    UNUSED_PARAM(point);
-    UNUSED_PARAM(font);
-    UNUSED_PARAM(context);
-    UNUSED_PARAM(glyphs);
-    UNUSED_PARAM(advances);
-    UNUSED_PARAM(count);
-#endif
-}
-
-static void showGlyphsWithAdvances(const FloatPoint&amp; point, const SimpleFontData* font, CGContextRef context, const CGGlyph* glyphs, const CGSize* advances, size_t count)
-{
-    if (!count)
-        return;
-
-    CGContextSetTextPosition(context, point.x(), point.y());
-
-    const FontPlatformData&amp; platformData = font-&gt;platformData();
-    Vector&lt;CGPoint, 256&gt; positions(count);
-    if (platformData.isColorBitmapFont())
-        fillVectorWithHorizontalGlyphPositions(positions, context, advances, count);
-    if (platformData.orientation() == Vertical) {
-        CGAffineTransform savedMatrix;
-        CGAffineTransform rotateLeftTransform = CGAffineTransformMake(0, -1, 1, 0, 0, 0);
-        savedMatrix = CGContextGetTextMatrix(context);
-        CGAffineTransform runMatrix = CGAffineTransformConcat(savedMatrix, rotateLeftTransform);
-        CGContextSetTextMatrix(context, runMatrix);
-
-        Vector&lt;CGSize, 256&gt; translations(count);
-        CTFontGetVerticalTranslationsForGlyphs(platformData.ctFont(), glyphs, translations.data(), count);
-
-        CGAffineTransform transform = CGAffineTransformInvert(CGContextGetTextMatrix(context));
-
-        CGPoint position = FloatPoint(point.x(), point.y() + font-&gt;fontMetrics().floatAscent(IdeographicBaseline) - font-&gt;fontMetrics().floatAscent());
-        for (size_t i = 0; i &lt; count; ++i) {
-            CGSize translation = CGSizeApplyAffineTransform(translations[i], rotateLeftTransform);
-            positions[i] = CGPointApplyAffineTransform(CGPointMake(position.x - translation.width, position.y + translation.height), transform);
-            position.x += advances[i].width;
-            position.y += advances[i].height;
-        }
-        if (!platformData.isColorBitmapFont())
-            CGContextShowGlyphsAtPositions(context, glyphs, positions.data(), count);
-        else
-            CTFontDrawGlyphs(platformData.ctFont(), glyphs, positions.data(), count, context);
-        CGContextSetTextMatrix(context, savedMatrix);
-    } else {
-        if (!platformData.isColorBitmapFont())
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored &quot;-Wdeprecated-declarations&quot;
-            CGContextShowGlyphsWithAdvances(context, glyphs, advances, count);
-#pragma clang diagnostic pop
-        else
-            CTFontDrawGlyphs(platformData.ctFont(), glyphs, positions.data(), count, context);
-    }
-}
-
-#if PLATFORM(MAC)
-static void setCGFontRenderingMode(CGContextRef cgContext, NSFontRenderingMode renderingMode, BOOL shouldSubpixelQuantize)
-{
-    if (renderingMode == NSFontIntegerAdvancementsRenderingMode) {
-        CGContextSetShouldAntialiasFonts(cgContext, false);
-        return;
-    }
-
-    CGContextSetShouldAntialiasFonts(cgContext, true);
-
-    CGAffineTransform contextTransform = CGContextGetCTM(cgContext);
-    BOOL isTranslationOrIntegralScale = WTF::isIntegral(contextTransform.a) &amp;&amp; WTF::isIntegral(contextTransform.d) &amp;&amp; contextTransform.b == 0.f &amp;&amp; contextTransform.c == 0.f;
-    BOOL isRotated = ((contextTransform.b || contextTransform.c) &amp;&amp; (contextTransform.a || contextTransform.d));
-    BOOL doSubpixelQuantization = isTranslationOrIntegralScale || (!isRotated &amp;&amp; shouldSubpixelQuantize);
-
-    CGContextSetShouldSubpixelPositionFonts(cgContext, renderingMode != NSFontAntialiasedIntegerAdvancementsRenderingMode || !isTranslationOrIntegralScale);
-    CGContextSetShouldSubpixelQuantizeFonts(cgContext, doSubpixelQuantization);
-}
-#endif
-
-void FontCascade::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, const GlyphBuffer&amp; glyphBuffer, int from, int numGlyphs, const FloatPoint&amp; anchorPoint) const
-{
-    const FontPlatformData&amp; platformData = font-&gt;platformData();
-    if (!platformData.size())
-        return;
-
-    CGContextRef cgContext = context-&gt;platformContext();
-
-    bool shouldSmoothFonts;
-    bool changeFontSmoothing;
-    
-    switch(fontDescription().fontSmoothing()) {
-    case Antialiased: {
-        context-&gt;setShouldAntialias(true);
-        shouldSmoothFonts = false;
-        changeFontSmoothing = true;
-        break;
-    }
-    case SubpixelAntialiased: {
-        context-&gt;setShouldAntialias(true);
-        shouldSmoothFonts = true;
-        changeFontSmoothing = true;
-        break;
-    }
-    case NoSmoothing: {
-        context-&gt;setShouldAntialias(false);
-        shouldSmoothFonts = false;
-        changeFontSmoothing = true;
-        break;
-    }
-    case AutoSmoothing: {
-        shouldSmoothFonts = true;
-        changeFontSmoothing = false;
-        break;
-    }
-    }
-    
-    if (!shouldUseSmoothing()) {
-        shouldSmoothFonts = false;
-        changeFontSmoothing = true;
-    }
-
-#if !PLATFORM(IOS)
-    bool originalShouldUseFontSmoothing = false;
-    if (changeFontSmoothing) {
-        originalShouldUseFontSmoothing = CGContextGetShouldSmoothFonts(cgContext);
-        CGContextSetShouldSmoothFonts(cgContext, shouldSmoothFonts);
-    }
-#endif
-
-#if !PLATFORM(IOS)
-    NSFont* drawFont;
-    if (!isPrinterFont()) {
-        drawFont = [platformData.nsFont() screenFont];
-        if (drawFont != platformData.nsFont()) {
-            // We are getting this in too many places (3406411); use ERROR so it only prints on debug versions for now. (We should debug this also, eventually).
-            LOG_ERROR(&quot;Attempting to set non-screen font (%@) when drawing to screen.  Using screen font anyway, may result in incorrect metrics.&quot;,
-                [[[platformData.nsFont() fontDescriptor] fontAttributes] objectForKey:NSFontNameAttribute]);
-        }
-    } else {
-        drawFont = [platformData.nsFont() printerFont];
-        if (drawFont != platformData.nsFont()) {
-            NSLog(@&quot;Attempting to set non-printer font (%@) when printing.  Using printer font anyway, may result in incorrect metrics.&quot;,
-                [[[platformData.nsFont() fontDescriptor] fontAttributes] objectForKey:NSFontNameAttribute]);
-        }
-    }
-#endif
-    
-    CGContextSetFont(cgContext, platformData.cgFont());
-
-    bool useLetterpressEffect = shouldUseLetterpressEffect(*context);
-    FloatPoint point = anchorPoint;
-#if PLATFORM(IOS)
-    float fontSize = platformData.size();
-    CGAffineTransform matrix = useLetterpressEffect || platformData.isColorBitmapFont() ? CGAffineTransformIdentity : CGAffineTransformMakeScale(fontSize, fontSize);
-    if (platformData.m_isEmoji) {
-        if (!context-&gt;emojiDrawingEnabled())
-            return;
-
-        // Mimic the positioining of non-bitmap glyphs, which are not subpixel-positioned.
-        point.setY(ceilf(point.y()));
-
-        // Emoji glyphs snap to the CSS pixel grid.
-        point.setX(floorf(point.x()));
-
-        // Emoji glyphs are offset one CSS pixel to the right.
-        point.move(1, 0);
-
-        // Emoji glyphs are offset vertically based on font size.
-        float y = point.y();
-        if (fontSize &lt;= 15) {
-            // Undo Core Text's y adjustment.
-            static float yAdjustmentFactor = iosExecutableWasLinkedOnOrAfterVersion(wkIOSSystemVersion_6_0) ? .19 : .1;
-            point.setY(floorf(y - yAdjustmentFactor * (fontSize + 2) + 2));
-        } else {
-            if (fontSize &lt; 26)
-                y -= .35f * fontSize - 10;
-
-            // Undo Core Text's y adjustment.
-            static float yAdjustment = iosExecutableWasLinkedOnOrAfterVersion(wkIOSSystemVersion_6_0) ? 3.8 : 2;
-            point.setY(floorf(y - yAdjustment));
-        }
-    }
-#else
-    CGAffineTransform matrix = CGAffineTransformIdentity;
-    if (drawFont &amp;&amp; !platformData.isColorBitmapFont())
-        memcpy(&amp;matrix, [drawFont matrix], sizeof(matrix));
-#endif
-    matrix.b = -matrix.b;
-    matrix.d = -matrix.d;
-    if (platformData.m_syntheticOblique) {
-        static float obliqueSkew = tanf(SYNTHETIC_OBLIQUE_ANGLE * piFloat / 180);
-        if (platformData.orientation() == Vertical)
-            matrix = CGAffineTransformConcat(matrix, CGAffineTransformMake(1, obliqueSkew, 0, 1, 0, 0));
-        else
-            matrix = CGAffineTransformConcat(matrix, CGAffineTransformMake(1, 0, -obliqueSkew, 1, 0, 0));
-    }
-    CGContextSetTextMatrix(cgContext, matrix);
-
-#if PLATFORM(IOS)
-    CGContextSetFontSize(cgContext, 1);
-    CGContextSetShouldSubpixelQuantizeFonts(cgContext, context-&gt;shouldSubpixelQuantizeFonts());
-#else
-    setCGFontRenderingMode(cgContext, [drawFont renderingMode], context-&gt;shouldSubpixelQuantizeFonts());
-    if (drawFont)
-        CGContextSetFontSize(cgContext, 1);
-    else
-        CGContextSetFontSize(cgContext, platformData.m_size);
-#endif
-
-
-    FloatSize shadowOffset;
-    float shadowBlur;
-    Color shadowColor;
-    ColorSpace shadowColorSpace;
-    ColorSpace fillColorSpace = context-&gt;fillColorSpace();
-    context-&gt;getShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace);
-
-    AffineTransform contextCTM = context-&gt;getCTM();
-    float syntheticBoldOffset = font-&gt;syntheticBoldOffset();
-    if (syntheticBoldOffset &amp;&amp; !contextCTM.isIdentityOrTranslationOrFlipped()) {
-        FloatSize horizontalUnitSizeInDevicePixels = contextCTM.mapSize(FloatSize(1, 0));
-        float horizontalUnitLengthInDevicePixels = sqrtf(horizontalUnitSizeInDevicePixels.width() * horizontalUnitSizeInDevicePixels.width() + horizontalUnitSizeInDevicePixels.height() * horizontalUnitSizeInDevicePixels.height());
-        if (horizontalUnitLengthInDevicePixels)
-            syntheticBoldOffset /= horizontalUnitLengthInDevicePixels;
-    };
-
-    bool hasSimpleShadow = context-&gt;textDrawingMode() == TextModeFill &amp;&amp; shadowColor.isValid() &amp;&amp; !shadowBlur &amp;&amp; !platformData.isColorBitmapFont() &amp;&amp; (!context-&gt;shadowsIgnoreTransforms() || contextCTM.isIdentityOrTranslationOrFlipped()) &amp;&amp; !context-&gt;isInTransparencyLayer();
-    if (hasSimpleShadow) {
-        // Paint simple shadows ourselves instead of relying on CG shadows, to avoid losing subpixel antialiasing.
-        context-&gt;clearShadow();
-        Color fillColor = context-&gt;fillColor();
-        Color shadowFillColor(shadowColor.red(), shadowColor.green(), shadowColor.blue(), shadowColor.alpha() * fillColor.alpha() / 255);
-        context-&gt;setFillColor(shadowFillColor, shadowColorSpace);
-        float shadowTextX = point.x() + shadowOffset.width();
-        // If shadows are ignoring transforms, then we haven't applied the Y coordinate flip yet, so down is negative.
-        float shadowTextY = point.y() + shadowOffset.height() * (context-&gt;shadowsIgnoreTransforms() ? -1 : 1);
-        showGlyphsWithAdvances(FloatPoint(shadowTextX, shadowTextY), font, cgContext, glyphBuffer.glyphs(from), static_cast&lt;const CGSize*&gt;(glyphBuffer.advances(from)), numGlyphs);
-#if !PLATFORM(IOS)
-        if (syntheticBoldOffset)
-#else
-        if (syntheticBoldOffset &amp;&amp; !platformData.m_isEmoji)
-#endif
-            showGlyphsWithAdvances(FloatPoint(shadowTextX + syntheticBoldOffset, shadowTextY), font, cgContext, glyphBuffer.glyphs(from), static_cast&lt;const CGSize*&gt;(glyphBuffer.advances(from)), numGlyphs);
-        context-&gt;setFillColor(fillColor, fillColorSpace);
-    }
-
-    if (useLetterpressEffect)
-        showLetterpressedGlyphsWithAdvances(point, font, cgContext, glyphBuffer.glyphs(from), static_cast&lt;const CGSize*&gt;(glyphBuffer.advances(from)), numGlyphs);
-    else
-        showGlyphsWithAdvances(point, font, cgContext, glyphBuffer.glyphs(from), static_cast&lt;const CGSize*&gt;(glyphBuffer.advances(from)), numGlyphs);
-#if !PLATFORM(IOS)
-    if (syntheticBoldOffset)
-#else
-    if (syntheticBoldOffset &amp;&amp; !platformData.m_isEmoji)
-#endif
-        showGlyphsWithAdvances(FloatPoint(point.x() + syntheticBoldOffset, point.y()), font, cgContext, glyphBuffer.glyphs(from), static_cast&lt;const CGSize*&gt;(glyphBuffer.advances(from)), numGlyphs);
-
-    if (hasSimpleShadow)
-        context-&gt;setShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace);
-
-#if !PLATFORM(IOS)
-    if (changeFontSmoothing)
-        CGContextSetShouldSmoothFonts(cgContext, originalShouldUseFontSmoothing);
-#endif
-}
-
-#if ENABLE(CSS3_TEXT_DECORATION_SKIP_INK)
-struct GlyphIterationState {
-    GlyphIterationState(CGPoint startingPoint, CGPoint currentPoint, CGFloat y1, CGFloat y2, CGFloat minX, CGFloat maxX)
-        : startingPoint(startingPoint)
-        , currentPoint(currentPoint)
-        , y1(y1)
-        , y2(y2)
-        , minX(minX)
-        , maxX(maxX)
-    {
-    }
-    CGPoint startingPoint;
-    CGPoint currentPoint;
-    CGFloat y1;
-    CGFloat y2;
-    CGFloat minX;
-    CGFloat maxX;
-};
-
-static bool findIntersectionPoint(float y, CGPoint p1, CGPoint p2, CGFloat&amp; x)
-{
-    x = p1.x + (y - p1.y) * (p2.x - p1.x) / (p2.y - p1.y);
-    return (p1.y &lt; y &amp;&amp; p2.y &gt; y) || (p1.y &gt; y &amp;&amp; p2.y &lt; y);
-}
-
-static void updateX(GlyphIterationState&amp; state, CGFloat x)
-{
-    state.minX = std::min(state.minX, x);
-    state.maxX = std::max(state.maxX, x);
-}
-
-// This function is called by CGPathApply and is therefore invoked for each
-// contour in a glyph. This function models each contours as a straight line
-// and calculates the intersections between each pseudo-contour and
-// two horizontal lines (the upper and lower bounds of an underline) found in
-// GlyphIterationState::y1 and GlyphIterationState::y2. It keeps track of the
-// leftmost and rightmost intersection in GlyphIterationState::minX and
-// GlyphIterationState::maxX.
-static void findPathIntersections(void* stateAsVoidPointer, const CGPathElement* e)
-{
-    auto&amp; state = *static_cast&lt;GlyphIterationState*&gt;(stateAsVoidPointer);
-    bool doIntersection = false;
-    CGPoint point = CGPointZero;
-    switch (e-&gt;type) {
-    case kCGPathElementMoveToPoint:
-        state.startingPoint = e-&gt;points[0];
-        state.currentPoint = e-&gt;points[0];
-        break;
-    case kCGPathElementAddLineToPoint:
-        doIntersection = true;
-        point = e-&gt;points[0];
-        break;
-    case kCGPathElementAddQuadCurveToPoint:
-        doIntersection = true;
-        point = e-&gt;points[1];
-        break;
-    case kCGPathElementAddCurveToPoint:
-        doIntersection = true;
-        point = e-&gt;points[2];
-        break;
-    case kCGPathElementCloseSubpath:
-        doIntersection = true;
-        point = state.startingPoint;
-        break;
-    }
-    if (!doIntersection)
-        return;
-    CGFloat x;
-    if (findIntersectionPoint(state.y1, state.currentPoint, point, x))
-        updateX(state, x);
-    if (findIntersectionPoint(state.y2, state.currentPoint, point, x))
-        updateX(state, x);
-    if ((state.currentPoint.y &gt;= state.y1 &amp;&amp; state.currentPoint.y &lt;= state.y2)
-        || (state.currentPoint.y &lt;= state.y1 &amp;&amp; state.currentPoint.y &gt;= state.y2))
-        updateX(state, state.currentPoint.x);
-    state.currentPoint = point;
-}
-
-class MacGlyphToPathTranslator final : public GlyphToPathTranslator {
-public:
-    MacGlyphToPathTranslator(const TextRun&amp; textRun, const GlyphBuffer&amp; glyphBuffer, const FloatPoint&amp; textOrigin)
-        : m_index(0)
-        , m_textRun(textRun)
-        , m_glyphBuffer(glyphBuffer)
-        , m_fontData(glyphBuffer.fontDataAt(m_index))
-        , m_translation(CGAffineTransformScale(CGAffineTransformMakeTranslation(textOrigin.x(), textOrigin.y()), 1, -1))
-    {
-        moveToNextValidGlyph();
-    }
-private:
-    virtual bool containsMorePaths() override
-    {
-        return m_index != m_glyphBuffer.size();
-    }
-    virtual Path path() override;
-    virtual std::pair&lt;float, float&gt; extents() override;
-    virtual GlyphUnderlineType underlineType() override;
-    virtual void advance() override;
-    void moveToNextValidGlyph();
-
-    int m_index;
-    const TextRun&amp; m_textRun;
-    const GlyphBuffer&amp; m_glyphBuffer;
-    const SimpleFontData* m_fontData;
-    CGAffineTransform m_translation;
-};
-
-Path MacGlyphToPathTranslator::path()
-{
-    RetainPtr&lt;CGPathRef&gt; result = adoptCF(CTFontCreatePathForGlyph(m_fontData-&gt;platformData().ctFont(), m_glyphBuffer.glyphAt(m_index), &amp;m_translation));
-    return adoptCF(CGPathCreateMutableCopy(result.get()));
-}
-
-std::pair&lt;float, float&gt; MacGlyphToPathTranslator::extents()
-{
-    CGPoint beginning = CGPointApplyAffineTransform(CGPointMake(0, 0), m_translation);
-    CGSize end = CGSizeApplyAffineTransform(m_glyphBuffer.advanceAt(m_index), m_translation);
-    return std::make_pair(static_cast&lt;float&gt;(beginning.x), static_cast&lt;float&gt;(beginning.x + end.width));
-}
-
-auto MacGlyphToPathTranslator::underlineType() -&gt; GlyphUnderlineType
-{
-    return computeUnderlineType(m_textRun, m_glyphBuffer, m_index);
-}
-
-void MacGlyphToPathTranslator::moveToNextValidGlyph()
-{
-    if (!m_fontData-&gt;isSVGFont())
-        return;
-    advance();
-}
-
-void MacGlyphToPathTranslator::advance()
-{
-    do {
-        GlyphBufferAdvance advance = m_glyphBuffer.advanceAt(m_index);
-        m_translation = CGAffineTransformTranslate(m_translation, advance.width(), advance.height());
-        ++m_index;
-        if (m_index &gt;= m_glyphBuffer.size())
-            break;
-        m_fontData = m_glyphBuffer.fontDataAt(m_index);
-    } while (m_fontData-&gt;isSVGFont() &amp;&amp; m_index &lt; m_glyphBuffer.size());
-}
-
-DashArray FontCascade::dashesForIntersectionsWithRect(const TextRun&amp; run, const FloatPoint&amp; textOrigin, const FloatRect&amp; lineExtents) const
-{
-    if (isLoadingCustomFonts())
-        return DashArray();
-
-    GlyphBuffer glyphBuffer;
-    glyphBuffer.saveOffsetsInString();
-    float deltaX;
-    if (codePath(run) != FontCascade::Complex)
-        deltaX = getGlyphsAndAdvancesForSimpleText(run, 0, run.length(), glyphBuffer);
-    else
-        deltaX = getGlyphsAndAdvancesForComplexText(run, 0, run.length(), glyphBuffer);
-
-    if (!glyphBuffer.size())
-        return DashArray();
-    
-    // FIXME: Handle SVG + non-SVG interleaved runs. https://bugs.webkit.org/show_bug.cgi?id=133778
-    const SimpleFontData* fontData = glyphBuffer.fontDataAt(0);
-    std::unique_ptr&lt;GlyphToPathTranslator&gt; translator;
-    bool isSVG = false;
-    FloatPoint origin = FloatPoint(textOrigin.x() + deltaX, textOrigin.y());
-    if (!fontData-&gt;isSVGFont())
-        translator = std::make_unique&lt;MacGlyphToPathTranslator&gt;(run, glyphBuffer, origin);
-    else {
-        TextRun::RenderingContext* renderingContext = run.renderingContext();
-        if (!renderingContext)
-            return DashArray();
-        translator = renderingContext-&gt;createGlyphToPathTranslator(*fontData, &amp;run, glyphBuffer, 0, glyphBuffer.size(), origin);
-        isSVG = true;
-    }
-    DashArray result;
-    for (int index = 0; translator-&gt;containsMorePaths(); ++index, translator-&gt;advance()) {
-        GlyphIterationState info = GlyphIterationState(CGPointMake(0, 0), CGPointMake(0, 0), lineExtents.y(), lineExtents.y() + lineExtents.height(), lineExtents.x() + lineExtents.width(), lineExtents.x());
-        const SimpleFontData* localFontData = glyphBuffer.fontDataAt(index);
-        if (!localFontData || (!isSVG &amp;&amp; localFontData-&gt;isSVGFont()) || (isSVG &amp;&amp; localFontData != fontData)) {
-            // The advances will get all messed up if we do anything other than bail here.
-            result.clear();
-            break;
-        }
-        switch (translator-&gt;underlineType()) {
-        case GlyphToPathTranslator::GlyphUnderlineType::SkipDescenders: {
-            Path path = translator-&gt;path();
-            CGPathApply(path.platformPath(), &amp;info, &amp;findPathIntersections);
-            if (info.minX &lt; info.maxX) {
-                result.append(info.minX - lineExtents.x());
-                result.append(info.maxX - lineExtents.x());
-            }
-            break;
-        }
-        case GlyphToPathTranslator::GlyphUnderlineType::SkipGlyph: {
-            std::pair&lt;float, float&gt; extents = translator-&gt;extents();
-            result.append(extents.first - lineExtents.x());
-            result.append(extents.second - lineExtents.x());
-            break;
-        }
-        case GlyphToPathTranslator::GlyphUnderlineType::DrawOverGlyph:
-            // Nothing to do
-            break;
-        }
-    }
-    return result;
-}
-#endif
-
-bool FontCascade::primaryFontDataIsSystemFont() const
-{
-#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED &gt; 1090
-    const auto&amp; fontData = primaryFontData();
-    return !fontData.isSVGFont() &amp;&amp; CTFontDescriptorIsSystemUIFont(adoptCF(CTFontCopyFontDescriptor(fontData.platformData().ctFont())).get());
-#else
-    // System fonts are hidden by having a name that begins with a period, so simply search
-    // for that here rather than try to keep the list up to date.
-    return firstFamily().startsWith('.');
-#endif
-}
-
-}
</del></span></pre>
</div>
</div>

</body>
</html>