<!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>[211765] trunk</title>
</head>
<body>

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

<h3>Log Message</h3>
<pre>Migrate ComplexTextController to use platform-independent types
https://bugs.webkit.org/show_bug.cgi?id=167833

Reviewed by Brent Fulgham.

Source/WebCore:

ComplexTextController will eventually be used on all ports to perform complex text layout.
This is a mechanical patch which migrates the shared parts of ComplexTextController away from
using CoreGraphics and CoreFoundation types in favor of WebCore/platform types. Eventually,
ComplexTextController will get moved to PAL but there is a layering violation (TextLayout) to
fix first.

No new tests because there is no behavior change.

* platform/graphics/GlyphBuffer.h:
(WebCore::GlyphBufferAdvance::GlyphBufferAdvance):
* platform/graphics/mac/ComplexTextController.cpp:
(WebCore::ComplexTextController::offsetForPosition):
(WebCore::advanceByCombiningCharacterSequence):
(WebCore::ComplexTextController::ComplexTextRun::indexAt):
(WebCore::ComplexTextController::ComplexTextRun::setIsNonMonotonic):
(WebCore::ComplexTextController::advance):
(WebCore::ComplexTextController::adjustGlyphsAndAdvances):
* platform/graphics/mac/ComplexTextController.h:
(WebCore::ComplexTextController::ComplexTextRun::create):
(WebCore::ComplexTextController::ComplexTextRun::stringLength):
(WebCore::ComplexTextController::ComplexTextRun::indexBegin):
(WebCore::ComplexTextController::ComplexTextRun::indexEnd):
(WebCore::ComplexTextController::ComplexTextRun::endOffsetAt):
(WebCore::ComplexTextController::ComplexTextRun::glyphs):
(WebCore::ComplexTextController::ComplexTextRun::growInitialAdvanceHorizontally):
(WebCore::ComplexTextController::ComplexTextRun::initialAdvance):
(WebCore::ComplexTextController::ComplexTextRun::baseAdvances):
(WebCore::ComplexTextController::ComplexTextRun::glyphOrigins):
(WebCore::ComplexTextController::glyphOrigin):
(WebCore::ComplexTextController::ComplexTextRun::createForTesting): Deleted.
* platform/graphics/mac/ComplexTextControllerCoreText.mm:
(SOFT_LINK):
(WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):

Tools:

Migrate tests away from platform-dependent types.

* TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:
(TestWebKitAPI::TEST_F):

LayoutTests:

Rebaseline tiny rounding result.

* platform/mac/fast/text/complex-text-opacity-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacfasttextcomplextextopacityexpectedtxt">trunk/LayoutTests/platform/mac/fast/text/complex-text-opacity-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGlyphBufferh">trunk/Source/WebCore/platform/graphics/GlyphBuffer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacComplexTextControllercpp">trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacComplexTextControllerh">trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacComplexTextControllerCoreTextmm">trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebCoreComplexTextControllercpp">trunk/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (211764 => 211765)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-02-07 02:08:37 UTC (rev 211764)
+++ trunk/LayoutTests/ChangeLog        2017-02-07 02:14:53 UTC (rev 211765)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2017-02-06  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        Migrate ComplexTextController to use platform-independent types
+        https://bugs.webkit.org/show_bug.cgi?id=167833
+
+        Reviewed by Brent Fulgham.
+
+        Rebaseline tiny rounding result.
+
+        * platform/mac/fast/text/complex-text-opacity-expected.txt:
+
</ins><span class="cx"> 2017-02-06  Youenn Fablet  &lt;youennf@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Allow some schemes to opt-out of CORS
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfasttextcomplextextopacityexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/fast/text/complex-text-opacity-expected.txt (211764 => 211765)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/text/complex-text-opacity-expected.txt        2017-02-07 02:08:37 UTC (rev 211764)
+++ trunk/LayoutTests/platform/mac/fast/text/complex-text-opacity-expected.txt        2017-02-07 02:14:53 UTC (rev 211765)
</span><span class="lines">@@ -24,8 +24,8 @@
</span><span class="cx">           text run at (139,4) width 7: &quot; &quot;
</span><span class="cx">         RenderText {#text} at (188,4) size 7x29
</span><span class="cx">           text run at (188,4) width 7: &quot; &quot;
</span><del>-        RenderText {#text} at (237,4) size 7x29
-          text run at (237,4) width 7: &quot; &quot;
</del><ins>+        RenderText {#text} at (236,4) size 8x29
+          text run at (236,4) width 8: &quot; &quot;
</ins><span class="cx">         RenderText {#text} at (285,4) size 7x29
</span><span class="cx">           text run at (285,4) width 7: &quot; &quot;
</span><span class="cx">         RenderText {#text} at (334,4) size 7x29
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (211764 => 211765)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-02-07 02:08:37 UTC (rev 211764)
+++ trunk/Source/WebCore/ChangeLog        2017-02-07 02:14:53 UTC (rev 211765)
</span><span class="lines">@@ -1,3 +1,45 @@
</span><ins>+2017-02-06  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        Migrate ComplexTextController to use platform-independent types
+        https://bugs.webkit.org/show_bug.cgi?id=167833
+
+        Reviewed by Brent Fulgham.
+
+        ComplexTextController will eventually be used on all ports to perform complex text layout.
+        This is a mechanical patch which migrates the shared parts of ComplexTextController away from
+        using CoreGraphics and CoreFoundation types in favor of WebCore/platform types. Eventually,
+        ComplexTextController will get moved to PAL but there is a layering violation (TextLayout) to
+        fix first.
+
+        No new tests because there is no behavior change.
+
+        * platform/graphics/GlyphBuffer.h:
+        (WebCore::GlyphBufferAdvance::GlyphBufferAdvance):
+        * platform/graphics/mac/ComplexTextController.cpp:
+        (WebCore::ComplexTextController::offsetForPosition):
+        (WebCore::advanceByCombiningCharacterSequence):
+        (WebCore::ComplexTextController::ComplexTextRun::indexAt):
+        (WebCore::ComplexTextController::ComplexTextRun::setIsNonMonotonic):
+        (WebCore::ComplexTextController::advance):
+        (WebCore::ComplexTextController::adjustGlyphsAndAdvances):
+        * platform/graphics/mac/ComplexTextController.h:
+        (WebCore::ComplexTextController::ComplexTextRun::create):
+        (WebCore::ComplexTextController::ComplexTextRun::stringLength):
+        (WebCore::ComplexTextController::ComplexTextRun::indexBegin):
+        (WebCore::ComplexTextController::ComplexTextRun::indexEnd):
+        (WebCore::ComplexTextController::ComplexTextRun::endOffsetAt):
+        (WebCore::ComplexTextController::ComplexTextRun::glyphs):
+        (WebCore::ComplexTextController::ComplexTextRun::growInitialAdvanceHorizontally):
+        (WebCore::ComplexTextController::ComplexTextRun::initialAdvance):
+        (WebCore::ComplexTextController::ComplexTextRun::baseAdvances):
+        (WebCore::ComplexTextController::ComplexTextRun::glyphOrigins):
+        (WebCore::ComplexTextController::glyphOrigin):
+        (WebCore::ComplexTextController::ComplexTextRun::createForTesting): Deleted.
+        * platform/graphics/mac/ComplexTextControllerCoreText.mm:
+        (SOFT_LINK):
+        (WebCore::ComplexTextController::ComplexTextRun::ComplexTextRun):
+        (WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
+
</ins><span class="cx"> 2017-02-06  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Correct File Path Handling in SecurityOrigin and FileSystem
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGlyphBufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GlyphBuffer.h (211764 => 211765)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GlyphBuffer.h        2017-02-07 02:08:37 UTC (rev 211764)
+++ trunk/Source/WebCore/platform/graphics/GlyphBuffer.h        2017-02-07 02:14:53 UTC (rev 211765)
</span><span class="lines">@@ -62,9 +62,14 @@
</span><span class="cx"> struct GlyphBufferAdvance : CGSize {
</span><span class="cx"> public:
</span><span class="cx">     GlyphBufferAdvance() : CGSize(CGSizeZero) { }
</span><del>-    GlyphBufferAdvance(CGSize size) : CGSize(size)
</del><ins>+    GlyphBufferAdvance(CGSize size)
+        : CGSize(size)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><ins>+    GlyphBufferAdvance(float width, float height)
+        : CGSize(CGSizeMake(width, height))
+    {
+    }
</ins><span class="cx"> 
</span><span class="cx">     void setWidth(CGFloat width) { this-&gt;CGSize::width = width; }
</span><span class="cx">     void setHeight(CGFloat height) { this-&gt;CGSize::height = height; }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacComplexTextControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp (211764 => 211765)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp        2017-02-07 02:08:37 UTC (rev 211764)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp        2017-02-07 02:14:53 UTC (rev 211765)
</span><span class="lines">@@ -175,61 +175,63 @@
</span><span class="cx">     if (h &lt; 0)
</span><span class="cx">         return m_run.ltr() ? 0 : m_end;
</span><span class="cx"> 
</span><del>-    CGFloat x = h;
</del><ins>+    float x = h;
</ins><span class="cx"> 
</span><span class="cx">     size_t runCount = m_complexTextRuns.size();
</span><del>-    size_t offsetIntoAdjustedGlyphs = 0;
</del><ins>+    unsigned offsetIntoAdjustedGlyphs = 0;
</ins><span class="cx"> 
</span><span class="cx">     for (size_t r = 0; r &lt; runCount; ++r) {
</span><span class="cx">         const ComplexTextRun&amp; complexTextRun = *m_complexTextRuns[r];
</span><span class="cx">         for (unsigned j = 0; j &lt; complexTextRun.glyphCount(); ++j) {
</span><del>-            size_t index = offsetIntoAdjustedGlyphs + j;
-            CGFloat adjustedAdvance = m_adjustedBaseAdvances[index].width;
</del><ins>+            unsigned index = offsetIntoAdjustedGlyphs + j;
+            float adjustedAdvance = m_adjustedBaseAdvances[index].width();
</ins><span class="cx">             if (x &lt; adjustedAdvance) {
</span><del>-                CFIndex hitGlyphStart = complexTextRun.indexAt(j);
-                CFIndex hitGlyphEnd;
</del><ins>+                unsigned hitGlyphStart = complexTextRun.indexAt(j);
+                unsigned hitGlyphEnd;
</ins><span class="cx">                 if (m_run.ltr())
</span><del>-                    hitGlyphEnd = std::max&lt;CFIndex&gt;(hitGlyphStart, j + 1 &lt; complexTextRun.glyphCount() ? complexTextRun.indexAt(j + 1) : static_cast&lt;CFIndex&gt;(complexTextRun.indexEnd()));
</del><ins>+                    hitGlyphEnd = std::max(hitGlyphStart, j + 1 &lt; complexTextRun.glyphCount() ? complexTextRun.indexAt(j + 1) : complexTextRun.indexEnd());
</ins><span class="cx">                 else
</span><del>-                    hitGlyphEnd = std::max&lt;CFIndex&gt;(hitGlyphStart, j &gt; 0 ? complexTextRun.indexAt(j - 1) : static_cast&lt;CFIndex&gt;(complexTextRun.indexEnd()));
</del><ins>+                    hitGlyphEnd = std::max(hitGlyphStart, j &gt; 0 ? complexTextRun.indexAt(j - 1) : complexTextRun.indexEnd());
</ins><span class="cx"> 
</span><span class="cx">                 // FIXME: Instead of dividing the glyph's advance equally between the characters, this
</span><span class="cx">                 // could use the glyph's &quot;ligature carets&quot;. This is available in CoreText via CTFontGetLigatureCaretPositions().
</span><del>-                CFIndex hitIndex = hitGlyphStart + (hitGlyphEnd - hitGlyphStart) * (m_run.ltr() ? x / adjustedAdvance : 1 - x / adjustedAdvance);
-                int stringLength = complexTextRun.stringLength();
</del><ins>+                unsigned hitIndex = hitGlyphStart + (hitGlyphEnd - hitGlyphStart) * (m_run.ltr() ? x / adjustedAdvance : 1 - x / adjustedAdvance);
+                unsigned stringLength = complexTextRun.stringLength();
</ins><span class="cx">                 UBreakIterator* cursorPositionIterator = cursorMovementIterator(StringView(complexTextRun.characters(), stringLength));
</span><del>-                int clusterStart;
</del><ins>+                unsigned clusterStart;
</ins><span class="cx">                 if (ubrk_isBoundary(cursorPositionIterator, hitIndex))
</span><span class="cx">                     clusterStart = hitIndex;
</span><span class="cx">                 else {
</span><del>-                    clusterStart = ubrk_preceding(cursorPositionIterator, hitIndex);
-                    if (clusterStart == UBRK_DONE)
-                        clusterStart = 0;
</del><ins>+                    int preceeding = ubrk_preceding(cursorPositionIterator, hitIndex);
+                    clusterStart = preceeding == UBRK_DONE ? 0 : preceeding;
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 if (!includePartialGlyphs)
</span><span class="cx">                     return complexTextRun.stringLocation() + clusterStart;
</span><span class="cx"> 
</span><del>-                int clusterEnd = ubrk_following(cursorPositionIterator, hitIndex);
-                if (clusterEnd == UBRK_DONE)
-                    clusterEnd = stringLength;
</del><ins>+                int following = ubrk_following(cursorPositionIterator, hitIndex);
+                unsigned clusterEnd = following == UBRK_DONE ? stringLength : following;
</ins><span class="cx"> 
</span><del>-                CGFloat clusterWidth;
</del><ins>+                float clusterWidth;
</ins><span class="cx">                 // FIXME: The search stops at the boundaries of complexTextRun. In theory, it should go on into neighboring ComplexTextRuns
</span><span class="cx">                 // derived from the same CTLine. In practice, we do not expect there to be more than one CTRun in a CTLine, as no
</span><span class="cx">                 // reordering and no font fallback should occur within a CTLine.
</span><span class="cx">                 if (clusterEnd - clusterStart &gt; 1) {
</span><span class="cx">                     clusterWidth = adjustedAdvance;
</span><del>-                    int firstGlyphBeforeCluster = j - 1;
-                    while (firstGlyphBeforeCluster &gt;= 0 &amp;&amp; complexTextRun.indexAt(firstGlyphBeforeCluster) &gt;= clusterStart &amp;&amp; complexTextRun.indexAt(firstGlyphBeforeCluster) &lt; clusterEnd) {
-                        CGFloat width = m_adjustedBaseAdvances[offsetIntoAdjustedGlyphs + firstGlyphBeforeCluster].width;
-                        clusterWidth += width;
-                        x += width;
-                        firstGlyphBeforeCluster--;
</del><ins>+                    if (j) {
+                        unsigned firstGlyphBeforeCluster = j - 1;
+                        while (complexTextRun.indexAt(firstGlyphBeforeCluster) &gt;= clusterStart &amp;&amp; complexTextRun.indexAt(firstGlyphBeforeCluster) &lt; clusterEnd) {
+                            float width = m_adjustedBaseAdvances[offsetIntoAdjustedGlyphs + firstGlyphBeforeCluster].width();
+                            clusterWidth += width;
+                            x += width;
+                            if (!firstGlyphBeforeCluster)
+                                break;
+                            firstGlyphBeforeCluster--;
+                        }
</ins><span class="cx">                     }
</span><span class="cx">                     unsigned firstGlyphAfterCluster = j + 1;
</span><span class="cx">                     while (firstGlyphAfterCluster &lt; complexTextRun.glyphCount() &amp;&amp; complexTextRun.indexAt(firstGlyphAfterCluster) &gt;= clusterStart &amp;&amp; complexTextRun.indexAt(firstGlyphAfterCluster) &lt; clusterEnd) {
</span><del>-                        clusterWidth += m_adjustedBaseAdvances[offsetIntoAdjustedGlyphs + firstGlyphAfterCluster].width;
</del><ins>+                        clusterWidth += m_adjustedBaseAdvances[offsetIntoAdjustedGlyphs + firstGlyphAfterCluster].width();
</ins><span class="cx">                         firstGlyphAfterCluster++;
</span><span class="cx">                     }
</span><span class="cx">                 } else {
</span><span class="lines">@@ -238,8 +240,7 @@
</span><span class="cx">                 }
</span><span class="cx">                 if (x &lt;= clusterWidth / 2)
</span><span class="cx">                     return complexTextRun.stringLocation() + (m_run.ltr() ? clusterStart : clusterEnd);
</span><del>-                else
-                    return complexTextRun.stringLocation() + (m_run.ltr() ? clusterEnd : clusterStart);
</del><ins>+                return complexTextRun.stringLocation() + (m_run.ltr() ? clusterEnd : clusterStart);
</ins><span class="cx">             }
</span><span class="cx">             x -= adjustedAdvance;
</span><span class="cx">         }
</span><span class="lines">@@ -270,9 +271,10 @@
</span><span class="cx">     bool sawJoiner = false;
</span><span class="cx">     while (iterator &lt; end) {
</span><span class="cx">         UChar32 nextCharacter;
</span><del>-        int markLength = 0;
</del><ins>+        unsigned markLength = 0;
</ins><span class="cx">         bool shouldContinue = false;
</span><del>-        U16_NEXT(iterator, markLength, end - iterator, nextCharacter);
</del><ins>+        ASSERT(end &gt;= iterator);
+        U16_NEXT(iterator, markLength, static_cast&lt;unsigned&gt;(end - iterator), nextCharacter);
</ins><span class="cx"> 
</span><span class="cx">         if (isVariationSelector(nextCharacter) || isEmojiFitzpatrickModifier(nextCharacter))
</span><span class="cx">             shouldContinue = true;
</span><span class="lines">@@ -453,7 +455,7 @@
</span><span class="cx">         m_complexTextRuns.reverse();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-CFIndex ComplexTextController::ComplexTextRun::indexAt(size_t i) const
</del><ins>+unsigned ComplexTextController::ComplexTextRun::indexAt(unsigned i) const
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(i &lt; m_glyphCount);
</span><span class="cx"> 
</span><span class="lines">@@ -466,15 +468,15 @@
</span><span class="cx">     m_isMonotonic = false;
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;bool, 64&gt; mappedIndices(m_stringLength, false);
</span><del>-    for (size_t i = 0; i &lt; m_glyphCount; ++i) {
-        ASSERT(indexAt(i) &lt; static_cast&lt;CFIndex&gt;(m_stringLength));
</del><ins>+    for (unsigned i = 0; i &lt; m_glyphCount; ++i) {
+        ASSERT(indexAt(i) &lt; m_stringLength);
</ins><span class="cx">         mappedIndices[indexAt(i)] = true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     m_glyphEndOffsets.grow(m_glyphCount);
</span><span class="cx">     for (unsigned i = 0; i &lt; m_glyphCount; ++i) {
</span><del>-        CFIndex nextMappedIndex = m_indexEnd;
-        for (size_t j = indexAt(i) + 1; j &lt; m_stringLength; ++j) {
</del><ins>+        unsigned nextMappedIndex = m_indexEnd;
+        for (unsigned j = indexAt(i) + 1; j &lt; m_stringLength; ++j) {
</ins><span class="cx">             if (mappedIndices[j]) {
</span><span class="cx">                 nextMappedIndex = j;
</span><span class="cx">                 break;
</span><span class="lines">@@ -580,7 +582,7 @@
</span><span class="cx">     while (m_currentRun &lt; runCount) {
</span><span class="cx">         const ComplexTextRun&amp; complexTextRun = *m_complexTextRuns[currentRunIndex];
</span><span class="cx">         bool ltr = complexTextRun.isLTR();
</span><del>-        size_t glyphCount = complexTextRun.glyphCount();
</del><ins>+        unsigned glyphCount = complexTextRun.glyphCount();
</ins><span class="cx">         unsigned glyphIndexIntoCurrentRun = ltr ? m_glyphInCurrentRun : glyphCount - 1 - m_glyphInCurrentRun;
</span><span class="cx">         unsigned glyphIndexIntoComplexTextController = indexOfLeftmostGlyphInCurrentRun + glyphIndexIntoCurrentRun;
</span><span class="cx">         if (fallbackFonts &amp;&amp; &amp;complexTextRun.font() != &amp;m_font.primaryFont())
</span><span class="lines">@@ -590,7 +592,7 @@
</span><span class="cx">         // When leftmostGlyph is 0, it represents the first glyph to draw, taking into
</span><span class="cx">         // account the text direction.
</span><span class="cx">         if (!indexOfLeftmostGlyphInCurrentRun &amp;&amp; glyphBuffer)
</span><del>-            glyphBuffer-&gt;setInitialAdvance(complexTextRun.initialAdvance());
</del><ins>+            glyphBuffer-&gt;setInitialAdvance(GlyphBufferAdvance(complexTextRun.initialAdvance().width(), complexTextRun.initialAdvance().height()));
</ins><span class="cx"> 
</span><span class="cx">         while (m_glyphInCurrentRun &lt; glyphCount) {
</span><span class="cx">             unsigned glyphStartOffset = complexTextRun.indexAt(glyphIndexIntoCurrentRun);
</span><span class="lines">@@ -597,13 +599,13 @@
</span><span class="cx">             unsigned glyphEndOffset;
</span><span class="cx">             if (complexTextRun.isMonotonic()) {
</span><span class="cx">                 if (ltr)
</span><del>-                    glyphEndOffset = std::max&lt;unsigned&gt;(glyphStartOffset, static_cast&lt;unsigned&gt;(glyphIndexIntoCurrentRun + 1 &lt; glyphCount ? complexTextRun.indexAt(glyphIndexIntoCurrentRun + 1) : complexTextRun.indexEnd()));
</del><ins>+                    glyphEndOffset = std::max(glyphStartOffset, glyphIndexIntoCurrentRun + 1 &lt; glyphCount ? complexTextRun.indexAt(glyphIndexIntoCurrentRun + 1) : complexTextRun.indexEnd());
</ins><span class="cx">                 else
</span><del>-                    glyphEndOffset = std::max&lt;unsigned&gt;(glyphStartOffset, static_cast&lt;unsigned&gt;(glyphIndexIntoCurrentRun &gt; 0 ? complexTextRun.indexAt(glyphIndexIntoCurrentRun - 1) : complexTextRun.indexEnd()));
</del><ins>+                    glyphEndOffset = std::max(glyphStartOffset, glyphIndexIntoCurrentRun &gt; 0 ? complexTextRun.indexAt(glyphIndexIntoCurrentRun - 1) : complexTextRun.indexEnd());
</ins><span class="cx">             } else
</span><span class="cx">                 glyphEndOffset = complexTextRun.endOffsetAt(glyphIndexIntoCurrentRun);
</span><span class="cx"> 
</span><del>-            CGSize adjustedBaseAdvance = m_adjustedBaseAdvances[glyphIndexIntoComplexTextController];
</del><ins>+            FloatSize adjustedBaseAdvance = m_adjustedBaseAdvances[glyphIndexIntoComplexTextController];
</ins><span class="cx"> 
</span><span class="cx">             if (glyphStartOffset + complexTextRun.stringLocation() &gt;= m_currentCharacter)
</span><span class="cx">                 return;
</span><span class="lines">@@ -610,21 +612,21 @@
</span><span class="cx"> 
</span><span class="cx">             if (glyphBuffer &amp;&amp; !m_characterInCurrentGlyph) {
</span><span class="cx">                 auto currentGlyphOrigin = glyphOrigin(glyphIndexIntoComplexTextController);
</span><del>-                GlyphBufferAdvance paintAdvance = adjustedBaseAdvance;
</del><ins>+                GlyphBufferAdvance paintAdvance(adjustedBaseAdvance);
</ins><span class="cx">                 if (!glyphIndexIntoCurrentRun) {
</span><span class="cx">                     // The first layout advance of every run includes the &quot;initial layout advance.&quot; However, here, we need
</span><span class="cx">                     // paint advances, so subtract it out before transforming the layout advance into a paint advance.
</span><del>-                    paintAdvance.setWidth(paintAdvance.width() - (complexTextRun.initialAdvance().width - currentGlyphOrigin.x));
-                    paintAdvance.setHeight(paintAdvance.height() - (complexTextRun.initialAdvance().height - currentGlyphOrigin.y));
</del><ins>+                    paintAdvance.setWidth(paintAdvance.width() - (complexTextRun.initialAdvance().width() - currentGlyphOrigin.x()));
+                    paintAdvance.setHeight(paintAdvance.height() - (complexTextRun.initialAdvance().height() - currentGlyphOrigin.y()));
</ins><span class="cx">                 }
</span><del>-                paintAdvance.setWidth(paintAdvance.width() + glyphOrigin(glyphIndexIntoComplexTextController + 1).x - currentGlyphOrigin.x);
-                paintAdvance.setHeight(paintAdvance.height() + glyphOrigin(glyphIndexIntoComplexTextController + 1).y - currentGlyphOrigin.y);
</del><ins>+                paintAdvance.setWidth(paintAdvance.width() + glyphOrigin(glyphIndexIntoComplexTextController + 1).x() - currentGlyphOrigin.x());
+                paintAdvance.setHeight(paintAdvance.height() + glyphOrigin(glyphIndexIntoComplexTextController + 1).y() - currentGlyphOrigin.y());
</ins><span class="cx">                 if (glyphIndexIntoCurrentRun == glyphCount - 1 &amp;&amp; currentRunIndex + 1 &lt; runCount) {
</span><span class="cx">                     // Our paint advance points to the end of the run. However, the next run may have an
</span><span class="cx">                     // initial advance, and our paint advance needs to point to the location of the next
</span><span class="cx">                     // glyph. So, we need to add in the next run's initial advance.
</span><del>-                    paintAdvance.setWidth(paintAdvance.width() - glyphOrigin(glyphIndexIntoComplexTextController + 1).x + m_complexTextRuns[currentRunIndex + 1]-&gt;initialAdvance().width);
-                    paintAdvance.setHeight(paintAdvance.height() - glyphOrigin(glyphIndexIntoComplexTextController + 1).y + m_complexTextRuns[currentRunIndex + 1]-&gt;initialAdvance().height);
</del><ins>+                    paintAdvance.setWidth(paintAdvance.width() - glyphOrigin(glyphIndexIntoComplexTextController + 1).x() + m_complexTextRuns[currentRunIndex + 1]-&gt;initialAdvance().width());
+                    paintAdvance.setHeight(paintAdvance.height() - glyphOrigin(glyphIndexIntoComplexTextController + 1).y() + m_complexTextRuns[currentRunIndex + 1]-&gt;initialAdvance().height());
</ins><span class="cx">                 }
</span><span class="cx">                 paintAdvance.setHeight(-paintAdvance.height()); // Increasing y points down
</span><span class="cx">                 glyphBuffer-&gt;add(m_adjustedGlyphs[glyphIndexIntoComplexTextController], &amp;complexTextRun.font(), paintAdvance, complexTextRun.indexAt(m_glyphInCurrentRun));
</span><span class="lines">@@ -632,7 +634,7 @@
</span><span class="cx"> 
</span><span class="cx">             unsigned oldCharacterInCurrentGlyph = m_characterInCurrentGlyph;
</span><span class="cx">             m_characterInCurrentGlyph = std::min(m_currentCharacter - complexTextRun.stringLocation(), glyphEndOffset) - glyphStartOffset;
</span><del>-            m_runWidthSoFar += adjustedBaseAdvance.width * runWidthSoFarFraction(glyphStartOffset, glyphEndOffset, oldCharacterInCurrentGlyph, iterationStyle);
</del><ins>+            m_runWidthSoFar += adjustedBaseAdvance.width() * runWidthSoFarFraction(glyphStartOffset, glyphEndOffset, oldCharacterInCurrentGlyph, iterationStyle);
</ins><span class="cx"> 
</span><span class="cx">             if (glyphEndOffset + complexTextRun.stringLocation() &gt; m_currentCharacter)
</span><span class="cx">                 return;
</span><span class="lines">@@ -681,7 +683,7 @@
</span><span class="cx"> void ComplexTextController::adjustGlyphsAndAdvances()
</span><span class="cx"> {
</span><span class="cx">     bool afterExpansion = (m_run.expansionBehavior() &amp; LeadingExpansionMask) == ForbidLeadingExpansion;
</span><del>-    CGFloat widthSinceLastCommit = 0;
</del><ins>+    float widthSinceLastCommit = 0;
</ins><span class="cx">     size_t runCount = m_complexTextRuns.size();
</span><span class="cx">     bool hasExtraSpacing = (m_font.letterSpacing() || m_font.wordSpacing() || m_expansion) &amp;&amp; !m_run.spacingDisabled();
</span><span class="cx">     bool runForcesLeadingExpansion = (m_run.expansionBehavior() &amp; LeadingExpansionMask) == ForceLeadingExpansion;
</span><span class="lines">@@ -699,17 +701,17 @@
</span><span class="cx">             m_isLTROnly = false;
</span><span class="cx"> 
</span><span class="cx">         const CGGlyph* glyphs = complexTextRun.glyphs();
</span><del>-        const CGSize* advances = complexTextRun.baseAdvances();
</del><ins>+        const FloatSize* advances = complexTextRun.baseAdvances();
</ins><span class="cx"> 
</span><span class="cx">         bool lastRun = runIndex + 1 == runCount;
</span><span class="cx">         float spaceWidth = font.spaceWidth() - font.syntheticBoldOffset();
</span><span class="cx">         const UChar* cp = complexTextRun.characters();
</span><del>-        CGPoint glyphOrigin = CGPointZero;
-        CFIndex lastCharacterIndex = m_run.ltr() ? std::numeric_limits&lt;CFIndex&gt;::min() : std::numeric_limits&lt;CFIndex&gt;::max();
</del><ins>+        FloatPoint glyphOrigin;
+        unsigned lastCharacterIndex = m_run.ltr() ? std::numeric_limits&lt;unsigned&gt;::min() : std::numeric_limits&lt;unsigned&gt;::max();
</ins><span class="cx">         bool isMonotonic = true;
</span><span class="cx"> 
</span><span class="cx">         for (unsigned i = 0; i &lt; glyphCount; i++) {
</span><del>-            CFIndex characterIndex = complexTextRun.indexAt(i);
</del><ins>+            unsigned characterIndex = complexTextRun.indexAt(i);
</ins><span class="cx">             if (m_run.ltr()) {
</span><span class="cx">                 if (characterIndex &lt; lastCharacterIndex)
</span><span class="cx">                     isMonotonic = false;
</span><span class="lines">@@ -729,35 +731,32 @@
</span><span class="cx"> 
</span><span class="cx">             bool treatAsSpace = FontCascade::treatAsSpace(ch);
</span><span class="cx">             CGGlyph glyph = treatAsSpace ? font.spaceGlyph() : glyphs[i];
</span><del>-            CGSize advance = treatAsSpace ? CGSizeMake(spaceWidth, advances[i].height) : advances[i];
</del><ins>+            FloatSize advance = treatAsSpace ? FloatSize(spaceWidth, advances[i].height()) : advances[i];
</ins><span class="cx"> 
</span><span class="cx">             if (ch == '\t' &amp;&amp; m_run.allowTabs())
</span><del>-                advance.width = m_font.tabWidth(font, m_run.tabSize(), m_run.xPos() + m_totalWidth + widthSinceLastCommit);
</del><ins>+                advance.setWidth(m_font.tabWidth(font, m_run.tabSize(), m_run.xPos() + m_totalWidth + widthSinceLastCommit));
</ins><span class="cx">             else if (FontCascade::treatAsZeroWidthSpace(ch) &amp;&amp; !treatAsSpace) {
</span><del>-                advance.width = 0;
</del><ins>+                advance.setWidth(0);
</ins><span class="cx">                 glyph = font.spaceGlyph();
</span><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             if (!i) {
</span><del>-                advance.width += complexTextRun.initialAdvance().width;
-                advance.height += complexTextRun.initialAdvance().height;
-                if (auto* origins = complexTextRun.glyphOrigins()) {
-                    advance.width -= origins[0].x;
-                    advance.height -= origins[0].y;
-                }
</del><ins>+                advance.expand(complexTextRun.initialAdvance().width(), complexTextRun.initialAdvance().height());
+                if (auto* origins = complexTextRun.glyphOrigins())
+                    advance.expand(-origins[0].x(), -origins[0].y());
</ins><span class="cx">             }
</span><span class="cx"> 
</span><del>-            advance.width += font.syntheticBoldOffset();
</del><ins>+            advance.expand(font.syntheticBoldOffset(), 0);
</ins><span class="cx"> 
</span><span class="cx">             if (hasExtraSpacing) {
</span><span class="cx">                 // If we're a glyph with an advance, add in letter-spacing.
</span><del>-                // That way we weed out zero width lurkers.  This behavior matches the fast text code path.
-                if (advance.width)
-                    advance.width += m_font.letterSpacing();
</del><ins>+                // That way we weed out zero width lurkers. This behavior matches the fast text code path.
+                if (advance.width())
+                    advance.expand(m_font.letterSpacing(), 0);
</ins><span class="cx"> 
</span><span class="cx">                 unsigned characterIndexInRun = characterIndex + complexTextRun.stringLocation();
</span><span class="cx">                 bool isFirstCharacter = !(characterIndex + complexTextRun.stringLocation());
</span><del>-                bool isLastCharacter = static_cast&lt;unsigned&gt;(characterIndexInRun + 1) == m_run.length() || (U16_IS_LEAD(ch) &amp;&amp; static_cast&lt;unsigned&gt;(characterIndexInRun + 2) == m_run.length() &amp;&amp; U16_IS_TRAIL(*(cp + characterIndex + 1)));
</del><ins>+                bool isLastCharacter = characterIndexInRun + 1 == m_run.length() || (U16_IS_LEAD(ch) &amp;&amp; characterIndexInRun + 2 == m_run.length() &amp;&amp; U16_IS_TRAIL(*(cp + characterIndex + 1)));
</ins><span class="cx"> 
</span><span class="cx">                 bool forceLeadingExpansion = false; // On the left, regardless of m_run.ltr()
</span><span class="cx">                 bool forceTrailingExpansion = false; // On the right, regardless of m_run.ltr()
</span><span class="lines">@@ -779,13 +778,13 @@
</span><span class="cx">                         bool expandLeft, expandRight;
</span><span class="cx">                         std::tie(expandLeft, expandRight) = expansionLocation(ideograph, treatAsSpace, m_run.ltr(), afterExpansion, forbidLeadingExpansion, forbidTrailingExpansion, forceLeadingExpansion, forceTrailingExpansion);
</span><span class="cx">                         m_expansion -= m_expansionPerOpportunity;
</span><del>-                        advance.width += m_expansionPerOpportunity;
</del><ins>+                        advance.expand(m_expansionPerOpportunity, 0);
</ins><span class="cx">                         if (expandLeft) {
</span><span class="cx">                             // Increase previous width
</span><span class="cx">                             if (m_adjustedBaseAdvances.isEmpty())
</span><span class="cx">                                 complexTextRun.growInitialAdvanceHorizontally(m_expansionPerOpportunity);
</span><span class="cx">                             else
</span><del>-                                m_adjustedBaseAdvances.last().width += m_expansionPerOpportunity;
</del><ins>+                                m_adjustedBaseAdvances.last().expand(m_expansionPerOpportunity, 0);
</ins><span class="cx">                         }
</span><span class="cx">                         if (expandRight)
</span><span class="cx">                             afterExpansion = true;
</span><span class="lines">@@ -794,12 +793,12 @@
</span><span class="cx"> 
</span><span class="cx">                     // Account for word-spacing.
</span><span class="cx">                     if (treatAsSpace &amp;&amp; (ch != '\t' || !m_run.allowTabs()) &amp;&amp; (characterIndex &gt; 0 || runIndex &gt; 0) &amp;&amp; m_font.wordSpacing())
</span><del>-                        advance.width += m_font.wordSpacing();
</del><ins>+                        advance.expand(m_font.wordSpacing(), 0);
</ins><span class="cx">                 } else
</span><span class="cx">                     afterExpansion = false;
</span><span class="cx">             }
</span><span class="cx"> 
</span><del>-            widthSinceLastCommit += advance.width; 
</del><ins>+            widthSinceLastCommit += advance.width();
</ins><span class="cx"> 
</span><span class="cx">             // FIXME: Combining marks should receive a text emphasis mark if they are combine with a space.
</span><span class="cx">             if (m_forTextEmphasis &amp;&amp; (!FontCascade::canReceiveTextEmphasis(ch) || (U_GET_GC_MASK(ch) &amp; U_GC_M_MASK)))
</span><span class="lines">@@ -815,13 +814,12 @@
</span><span class="cx">             m_adjustedGlyphs.append(glyph);
</span><span class="cx">             
</span><span class="cx">             FloatRect glyphBounds = font.boundsForGlyph(glyph);
</span><del>-            glyphBounds.move(glyphOrigin.x, glyphOrigin.y);
</del><ins>+            glyphBounds.move(glyphOrigin.x(), glyphOrigin.y());
</ins><span class="cx">             m_minGlyphBoundingBoxX = std::min(m_minGlyphBoundingBoxX, glyphBounds.x());
</span><span class="cx">             m_maxGlyphBoundingBoxX = std::max(m_maxGlyphBoundingBoxX, glyphBounds.maxX());
</span><span class="cx">             m_minGlyphBoundingBoxY = std::min(m_minGlyphBoundingBoxY, glyphBounds.y());
</span><span class="cx">             m_maxGlyphBoundingBoxY = std::max(m_maxGlyphBoundingBoxY, glyphBounds.maxY());
</span><del>-            glyphOrigin.x += advance.width;
-            glyphOrigin.y += advance.height;
</del><ins>+            glyphOrigin.move(advance);
</ins><span class="cx">             
</span><span class="cx">             lastCharacterIndex = characterIndex;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacComplexTextControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h (211764 => 211765)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h        2017-02-07 02:08:37 UTC (rev 211764)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h        2017-02-07 02:14:53 UTC (rev 211765)
</span><span class="lines">@@ -22,9 +22,9 @@
</span><span class="cx">  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef ComplexTextController_h
-#define ComplexTextController_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><ins>+#include &quot;FloatPoint.h&quot;
</ins><span class="cx"> #include &quot;GlyphBuffer.h&quot;
</span><span class="cx"> #include &lt;wtf/HashSet.h&gt;
</span><span class="cx"> #include &lt;wtf/RefCounted.h&gt;
</span><span class="lines">@@ -39,10 +39,6 @@
</span><span class="cx"> typedef const struct __CTRun * CTRunRef;
</span><span class="cx"> typedef const struct __CTLine * CTLineRef;
</span><span class="cx"> 
</span><del>-namespace WTF {
-template&lt;&gt; struct VectorTraits&lt;CGPoint&gt; : SimpleClassVectorTraits { };
-}
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class FontCascade;
</span><span class="lines">@@ -78,19 +74,19 @@
</span><span class="cx"> 
</span><span class="cx">     class ComplexTextRun : public RefCounted&lt;ComplexTextRun&gt; {
</span><span class="cx">     public:
</span><del>-        static Ref&lt;ComplexTextRun&gt; create(CTRunRef ctRun, const Font&amp; font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange)
</del><ins>+        static Ref&lt;ComplexTextRun&gt; create(CTRunRef ctRun, const Font&amp; font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd)
</ins><span class="cx">         {
</span><del>-            return adoptRef(*new ComplexTextRun(ctRun, font, characters, stringLocation, stringLength, runRange));
</del><ins>+            return adoptRef(*new ComplexTextRun(ctRun, font, characters, stringLocation, stringLength, indexBegin, indexEnd));
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        static Ref&lt;ComplexTextRun&gt; create(const Font&amp; font, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr)
</del><ins>+        static Ref&lt;ComplexTextRun&gt; create(const Font&amp; font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr)
</ins><span class="cx">         {
</span><del>-            return adoptRef(*new ComplexTextRun(font, characters, stringLocation, stringLength, ltr));
</del><ins>+            return adoptRef(*new ComplexTextRun(font, characters, stringLocation, stringLength, indexBegin, indexEnd, ltr));
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        static Ref&lt;ComplexTextRun&gt; createForTesting(const Vector&lt;CGSize&gt;&amp; advances, const Vector&lt;CGPoint&gt;&amp; origins, const Vector&lt;CGGlyph&gt;&amp; glyphs, const Vector&lt;CFIndex&gt;&amp; stringIndices, CGSize initialAdvance, const Font&amp; font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange, bool ltr)
</del><ins>+        static Ref&lt;ComplexTextRun&gt; create(const Vector&lt;FloatSize&gt;&amp; advances, const Vector&lt;FloatPoint&gt;&amp; origins, const Vector&lt;Glyph&gt;&amp; glyphs, const Vector&lt;unsigned&gt;&amp; stringIndices, FloatSize initialAdvance, const Font&amp; font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr)
</ins><span class="cx">         {
</span><del>-            return adoptRef(*new ComplexTextRun(advances, origins, glyphs, stringIndices, initialAdvance, font, characters, stringLocation, stringLength, runRange, ltr));
</del><ins>+            return adoptRef(*new ComplexTextRun(advances, origins, glyphs, stringIndices, initialAdvance, font, characters, stringLocation, stringLength, indexBegin, indexEnd, ltr));
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         unsigned glyphCount() const { return m_glyphCount; }
</span><span class="lines">@@ -97,12 +93,12 @@
</span><span class="cx">         const Font&amp; font() const { return m_font; }
</span><span class="cx">         const UChar* characters() const { return m_characters; }
</span><span class="cx">         unsigned stringLocation() const { return m_stringLocation; }
</span><del>-        size_t stringLength() const { return m_stringLength; }
-        ALWAYS_INLINE CFIndex indexAt(size_t i) const;
-        CFIndex indexBegin() const { return m_indexBegin; }
-        CFIndex indexEnd() const { return m_indexEnd; }
-        CFIndex endOffsetAt(size_t i) const { ASSERT(!m_isMonotonic); return m_glyphEndOffsets[i]; }
-        const CGGlyph* glyphs() const { return m_glyphs; }
</del><ins>+        unsigned stringLength() const { return m_stringLength; }
+        ALWAYS_INLINE unsigned indexAt(unsigned) const;
+        unsigned indexBegin() const { return m_indexBegin; }
+        unsigned indexEnd() const { return m_indexEnd; }
+        unsigned endOffsetAt(unsigned i) const { ASSERT(!m_isMonotonic); return m_glyphEndOffsets[i]; }
+        const CGGlyph* glyphs() const { return m_glyphs.data(); }
</ins><span class="cx"> 
</span><span class="cx">         /*
</span><span class="cx">          * This is the format of the information CoreText gives us about each run:
</span><span class="lines">@@ -131,33 +127,30 @@
</span><span class="cx">          *                X--------------------------------------------------X--------------------------X--------------------------X
</span><span class="cx">          * (text position ^)                (layout advance)                       (layout advance)           (layout advance)
</span><span class="cx">          */
</span><del>-        void growInitialAdvanceHorizontally(CGFloat delta) { m_initialAdvance.width += delta; }
-        CGSize initialAdvance() const { return m_initialAdvance; }
-        const CGSize* baseAdvances() const { return m_baseAdvances; }
-        const CGPoint* glyphOrigins() const { return m_glyphOrigins.size() == glyphCount() ? m_glyphOrigins.data() : nullptr; }
</del><ins>+        void growInitialAdvanceHorizontally(float delta) { m_initialAdvance.expand(delta, 0); }
+        FloatSize initialAdvance() const { return m_initialAdvance; }
+        const FloatSize* baseAdvances() const { return m_baseAdvances.data(); }
+        const FloatPoint* glyphOrigins() const { return m_glyphOrigins.size() == glyphCount() ? m_glyphOrigins.data() : nullptr; }
</ins><span class="cx">         bool isLTR() const { return m_isLTR; }
</span><span class="cx">         bool isMonotonic() const { return m_isMonotonic; }
</span><span class="cx">         void setIsNonMonotonic();
</span><span class="cx"> 
</span><span class="cx">     private:
</span><del>-        ComplexTextRun(CTRunRef, const Font&amp;, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange);
-        ComplexTextRun(const Font&amp;, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr);
-        WEBCORE_EXPORT ComplexTextRun(const Vector&lt;CGSize&gt;&amp; advances, const Vector&lt;CGPoint&gt;&amp; origins, const Vector&lt;CGGlyph&gt;&amp; glyphs, const Vector&lt;CFIndex&gt;&amp; stringIndices, CGSize initialAdvance, const Font&amp;, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange, bool ltr);
</del><ins>+        ComplexTextRun(CTRunRef, const Font&amp;, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd);
+        ComplexTextRun(const Font&amp;, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr);
+        WEBCORE_EXPORT ComplexTextRun(const Vector&lt;FloatSize&gt;&amp; advances, const Vector&lt;FloatPoint&gt;&amp; origins, const Vector&lt;Glyph&gt;&amp; glyphs, const Vector&lt;unsigned&gt;&amp; stringIndices, FloatSize initialAdvance, const Font&amp;, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr);
</ins><span class="cx"> 
</span><del>-        Vector&lt;CGSize, 64&gt; m_baseAdvancesVector;
-        Vector&lt;CGPoint, 64&gt; m_glyphOrigins;
-        Vector&lt;CGGlyph, 64&gt; m_glyphsVector;
-        Vector&lt;CFIndex, 64&gt; m_glyphEndOffsets;
-        Vector&lt;CFIndex, 64&gt; m_coreTextIndicesVector;
-        CGSize m_initialAdvance;
</del><ins>+        Vector&lt;FloatSize, 64&gt; m_baseAdvances;
+        Vector&lt;FloatPoint, 64&gt; m_glyphOrigins;
+        Vector&lt;CGGlyph, 64&gt; m_glyphs;
+        Vector&lt;unsigned, 64&gt; m_glyphEndOffsets;
+        Vector&lt;unsigned, 64&gt; m_coreTextIndices;
+        FloatSize m_initialAdvance;
</ins><span class="cx">         const Font&amp; m_font;
</span><span class="cx">         const UChar* m_characters;
</span><del>-        size_t m_stringLength;
-        const CFIndex* m_coreTextIndices;
-        const CGGlyph* m_glyphs;
-        const CGSize* m_baseAdvances;
-        CFIndex m_indexBegin;
-        CFIndex m_indexEnd;
</del><ins>+        unsigned m_stringLength;
+        unsigned m_indexBegin;
+        unsigned m_indexEnd;
</ins><span class="cx">         unsigned m_glyphCount;
</span><span class="cx">         unsigned m_stringLocation;
</span><span class="cx">         bool m_isLTR;
</span><span class="lines">@@ -180,10 +173,10 @@
</span><span class="cx"> 
</span><span class="cx">     float runWidthSoFarFraction(unsigned glyphStartOffset, unsigned glyphEndOffset, unsigned oldCharacterInCurrentGlyph, GlyphIterationStyle) const;
</span><span class="cx"> 
</span><del>-    CGPoint glyphOrigin(unsigned index) const { return index &lt; m_glyphOrigins.size() ? m_glyphOrigins[index] : CGPointZero; }
</del><ins>+    FloatPoint glyphOrigin(unsigned index) const { return index &lt; m_glyphOrigins.size() ? m_glyphOrigins[index] : FloatPoint(); }
</ins><span class="cx"> 
</span><del>-    Vector&lt;CGSize, 256&gt; m_adjustedBaseAdvances;
-    Vector&lt;CGPoint, 256&gt; m_glyphOrigins;
</del><ins>+    Vector&lt;FloatSize, 256&gt; m_adjustedBaseAdvances;
+    Vector&lt;FloatPoint, 256&gt; m_glyphOrigins;
</ins><span class="cx">     Vector&lt;CGGlyph, 256&gt; m_adjustedGlyphs;
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;UChar, 256&gt; m_smallCapsBuffer;
</span><span class="lines">@@ -210,7 +203,7 @@
</span><span class="cx"> 
</span><span class="cx">     const FontCascade&amp; m_font;
</span><span class="cx">     const TextRun&amp; m_run;
</span><del>- 
</del><ins>+
</ins><span class="cx">     unsigned m_currentCharacter { 0 };
</span><span class="cx">     unsigned m_end { 0 };
</span><span class="cx"> 
</span><span class="lines">@@ -234,5 +227,3 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span><del>-
-#endif // ComplexTextController_h
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacComplexTextControllerCoreTextmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm (211764 => 211765)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm        2017-02-07 02:08:37 UTC (rev 211764)
+++ trunk/Source/WebCore/platform/graphics/mac/ComplexTextControllerCoreText.mm        2017-02-07 02:14:53 UTC (rev 211765)
</span><span class="lines">@@ -42,10 +42,9 @@
</span><span class="cx"> 
</span><span class="cx"> #if (PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &lt; 101100) || (PLATFORM(IOS) &amp;&amp; __IPHONE_OS_VERSION_MIN_REQUIRED &lt; 90000)
</span><span class="cx"> SOFT_LINK_FRAMEWORK(CoreText);
</span><del>-SOFT_LINK(CoreText, CTRunGetBaseAdvancesAndOrigins, void, (CTRunRef run, CFRange range, CGSize baseAdvances[], CGPoint origins[]), (run, range, baseAdvances, origins))
</del><ins>+SOFT_LINK(CoreText, CTRunGetBaseAdvancesAndOrigins, void, (CTRunRef run, CFRange range, FloatSize baseAdvances[], FloatPoint origins[]), (run, range, baseAdvances, origins))
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> // Note: CTFontDescriptorRefs can live forever in caches inside CoreText, so this object can too.
</span><span class="cx"> @interface WebCascadeList : NSArray {
</span><span class="cx">     @private
</span><span class="lines">@@ -106,97 +105,108 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Font&amp; font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange)
</del><ins>+ComplexTextController::ComplexTextRun::ComplexTextRun(CTRunRef ctRun, const Font&amp; font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd)
</ins><span class="cx">     : m_initialAdvance(CTRunGetInitialAdvance(ctRun))
</span><span class="cx">     , m_font(font)
</span><span class="cx">     , m_characters(characters)
</span><span class="cx">     , m_stringLength(stringLength)
</span><del>-    , m_coreTextIndices(CTRunGetStringIndicesPtr(ctRun))
-    , m_glyphs(CTRunGetGlyphsPtr(ctRun))
-    , m_indexBegin(runRange.location)
-    , m_indexEnd(runRange.location + runRange.length)
</del><ins>+    , m_indexBegin(indexBegin)
+    , m_indexEnd(indexEnd)
</ins><span class="cx">     , m_glyphCount(CTRunGetGlyphCount(ctRun))
</span><span class="cx">     , m_stringLocation(stringLocation)
</span><span class="cx">     , m_isLTR(!(CTRunGetStatus(ctRun) &amp; kCTRunStatusRightToLeft))
</span><span class="cx"> {
</span><del>-    if (!m_coreTextIndices) {
-        m_coreTextIndicesVector.grow(m_glyphCount);
-        CTRunGetStringIndices(ctRun, CFRangeMake(0, 0), m_coreTextIndicesVector.data());
-        m_coreTextIndices = m_coreTextIndicesVector.data();
</del><ins>+    const CFIndex* coreTextIndicesPtr = CTRunGetStringIndicesPtr(ctRun);
+    Vector&lt;CFIndex&gt; coreTextIndices;
+    if (!coreTextIndicesPtr) {
+        coreTextIndices.grow(m_glyphCount);
+        CTRunGetStringIndices(ctRun, CFRangeMake(0, 0), coreTextIndices.data());
+        coreTextIndicesPtr = coreTextIndices.data();
</ins><span class="cx">     }
</span><ins>+    m_coreTextIndices.reserveInitialCapacity(m_glyphCount);
+    for (unsigned i = 0; i &lt; m_glyphCount; ++i)
+        m_coreTextIndices.uncheckedAppend(coreTextIndicesPtr[i]);
</ins><span class="cx"> 
</span><del>-    if (!m_glyphs) {
-        m_glyphsVector.grow(m_glyphCount);
-        CTRunGetGlyphs(ctRun, CFRangeMake(0, 0), m_glyphsVector.data());
-        m_glyphs = m_glyphsVector.data();
</del><ins>+    const CGGlyph* glyphsPtr = CTRunGetGlyphsPtr(ctRun);
+    Vector&lt;CGGlyph&gt; glyphs;
+    if (!glyphsPtr) {
+        glyphs.grow(m_glyphCount);
+        CTRunGetGlyphs(ctRun, CFRangeMake(0, 0), glyphs.data());
+        glyphsPtr = glyphs.data();
</ins><span class="cx">     }
</span><ins>+    m_glyphs.reserveInitialCapacity(m_glyphCount);
+    for (unsigned i = 0; i &lt; m_glyphCount; ++i)
+        m_glyphs.uncheckedAppend(glyphsPtr[i]);
</ins><span class="cx"> 
</span><span class="cx"> #if USE_LAYOUT_SPECIFIC_ADVANCES
</span><span class="cx">     if (CTRunGetStatus(ctRun) &amp; kCTRunStatusHasOrigins) {
</span><del>-        m_baseAdvancesVector.grow(m_glyphCount);
-        m_glyphOrigins.grow(m_glyphCount);
-        CTRunGetBaseAdvancesAndOrigins(ctRun, CFRangeMake(0, 0), m_baseAdvancesVector.data(), m_glyphOrigins.data());
-        m_baseAdvances = m_baseAdvancesVector.data();
</del><ins>+        Vector&lt;CGSize&gt; baseAdvances(m_glyphCount);
+        Vector&lt;CGPoint&gt; glyphOrigins(m_glyphCount);
+        CTRunGetBaseAdvancesAndOrigins(ctRun, CFRangeMake(0, 0), baseAdvances.data(), glyphOrigins.data());
+        m_baseAdvances.reserveInitialCapacity(m_glyphCount);
+        m_glyphOrigins.reserveInitialCapacity(m_glyphCount);
+        for (unsigned i = 0; i &lt; m_glyphCount; ++i) {
+            m_baseAdvances.uncheckedAppend(baseAdvances[i]);
+            m_glyphOrigins.uncheckedAppend(glyphOrigins[i]);
+        }
</ins><span class="cx">     } else
</span><span class="cx"> #endif
</span><span class="cx">     {
</span><del>-        m_baseAdvances = CTRunGetAdvancesPtr(ctRun);
-        if (!m_baseAdvances) {
-            m_baseAdvancesVector.grow(m_glyphCount);
-            CTRunGetAdvances(ctRun, CFRangeMake(0, 0), m_baseAdvancesVector.data());
-            m_baseAdvances = m_baseAdvancesVector.data();
</del><ins>+        const CGSize* baseAdvances = CTRunGetAdvancesPtr(ctRun);
+        Vector&lt;CGSize&gt; baseAdvancesVector;
+        if (!baseAdvances) {
+            baseAdvancesVector.grow(m_glyphCount);
+            CTRunGetAdvances(ctRun, CFRangeMake(0, 0), baseAdvancesVector.data());
+            baseAdvances = baseAdvancesVector.data();
</ins><span class="cx">         }
</span><ins>+        m_baseAdvances.reserveInitialCapacity(m_glyphCount);
+        for (unsigned i = 0; i &lt; m_glyphCount; ++i)
+            m_baseAdvances.uncheckedAppend(baseAdvances[i]);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Missing glyphs run constructor. Core Text will not generate a run of missing glyphs, instead falling back on
</span><span class="cx"> // glyphs from LastResort. We want to use the primary font's missing glyph in order to match the fast text code path.
</span><del>-ComplexTextController::ComplexTextRun::ComplexTextRun(const Font&amp; font, const UChar* characters, unsigned stringLocation, size_t stringLength, bool ltr)
-    : m_initialAdvance(CGSizeZero)
-    , m_font(font)
</del><ins>+ComplexTextController::ComplexTextRun::ComplexTextRun(const Font&amp; font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr)
+    : m_font(font)
</ins><span class="cx">     , m_characters(characters)
</span><span class="cx">     , m_stringLength(stringLength)
</span><del>-    , m_indexBegin(0)
-    , m_indexEnd(stringLength)
</del><ins>+    , m_indexBegin(indexBegin)
+    , m_indexEnd(indexEnd)
</ins><span class="cx">     , m_stringLocation(stringLocation)
</span><span class="cx">     , m_isLTR(ltr)
</span><span class="cx"> {
</span><del>-    m_coreTextIndicesVector.reserveInitialCapacity(m_stringLength);
-    unsigned r = 0;
-    while (r &lt; m_stringLength) {
-        m_coreTextIndicesVector.uncheckedAppend(r);
</del><ins>+    auto runLengthInCodeUnits = m_indexEnd - m_indexBegin;
+    m_coreTextIndices.reserveInitialCapacity(runLengthInCodeUnits);
+    unsigned r = m_indexBegin;
+    while (r &lt; m_indexEnd) {
+        m_coreTextIndices.uncheckedAppend(r);
</ins><span class="cx">         UChar32 character;
</span><span class="cx">         U16_NEXT(m_characters, r, m_stringLength, character);
</span><span class="cx">     }
</span><del>-    m_glyphCount = m_coreTextIndicesVector.size();
</del><ins>+    m_glyphCount = m_coreTextIndices.size();
</ins><span class="cx">     if (!ltr) {
</span><span class="cx">         for (unsigned r = 0, end = m_glyphCount - 1; r &lt; m_glyphCount / 2; ++r, --end)
</span><del>-            std::swap(m_coreTextIndicesVector[r], m_coreTextIndicesVector[end]);
</del><ins>+            std::swap(m_coreTextIndices[r], m_coreTextIndices[end]);
</ins><span class="cx">     }
</span><del>-    m_coreTextIndices = m_coreTextIndicesVector.data();
</del><span class="cx"> 
</span><span class="cx">     // Synthesize a run of missing glyphs.
</span><del>-    m_glyphsVector.fill(0, m_glyphCount);
-    m_glyphs = m_glyphsVector.data();
-    m_baseAdvancesVector.fill(CGSizeMake(m_font.widthForGlyph(0), 0), m_glyphCount);
-    m_baseAdvances = m_baseAdvancesVector.data();
</del><ins>+    m_glyphs.fill(0, m_glyphCount);
+    m_baseAdvances.fill(FloatSize(m_font.widthForGlyph(0), 0), m_glyphCount);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-ComplexTextController::ComplexTextRun::ComplexTextRun(const Vector&lt;CGSize&gt;&amp; advances, const Vector&lt;CGPoint&gt;&amp; origins, const Vector&lt;CGGlyph&gt;&amp; glyphs, const Vector&lt;CFIndex&gt;&amp; stringIndices, CGSize initialAdvance, const Font&amp; font, const UChar* characters, unsigned stringLocation, size_t stringLength, CFRange runRange, bool ltr)
-    : m_baseAdvancesVector(advances)
</del><ins>+ComplexTextController::ComplexTextRun::ComplexTextRun(const Vector&lt;FloatSize&gt;&amp; advances, const Vector&lt;FloatPoint&gt;&amp; origins, const Vector&lt;Glyph&gt;&amp; glyphs, const Vector&lt;unsigned&gt;&amp; stringIndices, FloatSize initialAdvance, const Font&amp; font, const UChar* characters, unsigned stringLocation, unsigned stringLength, unsigned indexBegin, unsigned indexEnd, bool ltr)
+    : m_baseAdvances(advances)
</ins><span class="cx">     , m_glyphOrigins(origins)
</span><del>-    , m_glyphsVector(glyphs)
-    , m_coreTextIndicesVector(stringIndices)
</del><ins>+    , m_glyphs(glyphs)
+    , m_coreTextIndices(stringIndices)
</ins><span class="cx">     , m_initialAdvance(initialAdvance)
</span><span class="cx">     , m_font(font)
</span><span class="cx">     , m_characters(characters)
</span><span class="cx">     , m_stringLength(stringLength)
</span><del>-    , m_coreTextIndices(m_coreTextIndicesVector.data())
-    , m_glyphs(m_glyphsVector.data())
-    , m_baseAdvances(m_baseAdvancesVector.data())
-    , m_indexBegin(runRange.location)
-    , m_indexEnd(runRange.location + runRange.length)
</del><ins>+    , m_indexBegin(indexBegin)
+    , m_indexEnd(indexEnd)
</ins><span class="cx">     , m_glyphCount(glyphs.size())
</span><span class="cx">     , m_stringLocation(stringLocation)
</span><span class="cx">     , m_isLTR(ltr)
</span><span class="lines">@@ -229,7 +239,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (!font) {
</span><span class="cx">         // Create a run of missing glyphs from the primary font.
</span><del>-        m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation, length, m_run.ltr()));
</del><ins>+        m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation, length, 0, length, m_run.ltr()));
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -313,7 +323,7 @@
</span><span class="cx">                     // NSFontRenderingMode.
</span><span class="cx">                     RetainPtr&lt;CFStringRef&gt; fontName = adoptCF(CTFontCopyPostScriptName(runCTFont));
</span><span class="cx">                     if (CFEqual(fontName.get(), CFSTR(&quot;LastResort&quot;))) {
</span><del>-                        m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation + runRange.location, runRange.length, m_run.ltr()));
</del><ins>+                        m_complexTextRuns.append(ComplexTextRun::create(m_font.primaryFont(), cp, stringLocation, length, runRange.location, runRange.location + runRange.length, m_run.ltr()));
</ins><span class="cx">                         continue;
</span><span class="cx">                     }
</span><span class="cx">                     auto&amp; fontCache = FontCache::singleton();
</span><span class="lines">@@ -332,7 +342,7 @@
</span><span class="cx">         if (m_fallbackFonts &amp;&amp; runFont != &amp;m_font.primaryFont())
</span><span class="cx">             m_fallbackFonts-&gt;add(font);
</span><span class="cx"> 
</span><del>-        m_complexTextRuns.append(ComplexTextRun::create(ctRun, *runFont, cp, stringLocation, length, runRange));
</del><ins>+        m_complexTextRuns.append(ComplexTextRun::create(ctRun, *runFont, cp, stringLocation, length, runRange.location, runRange.location + runRange.length));
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (211764 => 211765)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-02-07 02:08:37 UTC (rev 211764)
+++ trunk/Tools/ChangeLog        2017-02-07 02:14:53 UTC (rev 211765)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2017-02-06  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
+
+        Migrate ComplexTextController to use platform-independent types
+        https://bugs.webkit.org/show_bug.cgi?id=167833
+
+        Reviewed by Brent Fulgham.
+
+        Migrate tests away from platform-dependent types.
+
+        * TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp:
+        (TestWebKitAPI::TEST_F):
+
</ins><span class="cx"> 2017-02-06  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Correct File Path Handling in SecurityOrigin and FileSystem
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebCoreComplexTextControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp (211764 => 211765)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp        2017-02-07 02:08:37 UTC (rev 211764)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/ComplexTextController.cpp        2017-02-07 02:14:53 UTC (rev 211765)
</span><span class="lines">@@ -55,20 +55,20 @@
</span><span class="cx">     auto spaceWidth = font.primaryFont().spaceWidth();
</span><span class="cx"> 
</span><span class="cx"> #if USE_LAYOUT_SPECIFIC_ADVANCES
</span><del>-    Vector&lt;CGSize&gt; advances = { CGSizeZero, CGSizeMake(21.640625, 0.0), CGSizeMake(42.3046875, 0.0), CGSizeMake(55.8984375, 0.0), CGSizeMake(22.34375, 0.0) };
-    Vector&lt;CGPoint&gt; origins = { CGPointMake(-15.15625, 18.046875), CGPointZero, CGPointZero, CGPointZero, CGPointZero };
</del><ins>+    Vector&lt;FloatSize&gt; advances = { FloatSize(), FloatSize(21.640625, 0.0), FloatSize(42.3046875, 0.0), FloatSize(55.8984375, 0.0), FloatSize(22.34375, 0.0) };
+    Vector&lt;FloatPoint&gt; origins = { FloatPoint(-15.15625, 18.046875), FloatPoint(), FloatPoint(), FloatPoint(), FloatPoint() };
</ins><span class="cx"> #else
</span><del>-    Vector&lt;CGSize&gt; advances = { CGSizeMake(15.15625, -18.046875), CGSizeMake(21.640625, 0.0), CGSizeMake(42.3046875, 0.0), CGSizeMake(55.8984375, 0.0), CGSizeMake(22.34375, 0.0) };
-    Vector&lt;CGPoint&gt; origins = { };
</del><ins>+    Vector&lt;FloatSize&gt; advances = { FloatSize(15.15625, -18.046875), FloatSize(21.640625, 0.0), FloatSize(42.3046875, 0.0), FloatSize(55.8984375, 0.0), FloatSize(22.34375, 0.0) };
+    Vector&lt;FloatPoint&gt; origins = { };
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    CGSize initialAdvance = CGSizeMake(-15.15625, 18.046875);
</del><ins>+    FloatSize initialAdvance = FloatSize(-15.15625, 18.046875);
</ins><span class="cx"> 
</span><span class="cx">     UChar characters[] = { 0x644, 0x637, 0x641, 0x627, 0x64b, 0x20 };
</span><span class="cx">     size_t charactersLength = WTF_ARRAY_LENGTH(characters);
</span><span class="cx">     TextRun textRun(StringView(characters, charactersLength));
</span><del>-    auto run1 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(21.875, 0) }, { CGPointZero }, { 5 }, { 5 }, CGSizeZero, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(5, 1), false);
-    auto run2 = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 193, 377, 447, 431, 458 }, { 4, 3, 2, 1, 0 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 5), false);
</del><ins>+    auto run1 = ComplexTextController::ComplexTextRun::create({ FloatSize(21.875, 0) }, { FloatPoint() }, { 5 }, { 5 }, FloatSize(), font.primaryFont(), characters, 0, charactersLength, 5, 6, false);
+    auto run2 = ComplexTextController::ComplexTextRun::create(advances, origins, { 193, 377, 447, 431, 458 }, { 4, 3, 2, 1, 0 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, 0, 5, false);
</ins><span class="cx">     Vector&lt;Ref&lt;ComplexTextController::ComplexTextRun&gt;&gt; runs;
</span><span class="cx">     runs.append(WTFMove(run1));
</span><span class="cx">     runs.append(WTFMove(run2));
</span><span class="lines">@@ -76,7 +76,7 @@
</span><span class="cx"> 
</span><span class="cx">     CGFloat totalWidth = 0;
</span><span class="cx">     for (size_t i = 1; i &lt; advances.size(); ++i)
</span><del>-        totalWidth += advances[i].width;
</del><ins>+        totalWidth += advances[i].width();
</ins><span class="cx">     EXPECT_NEAR(controller.totalWidth(), spaceWidth + totalWidth, 0.0001);
</span><span class="cx">     GlyphBuffer glyphBuffer;
</span><span class="cx">     EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
</span><span class="lines">@@ -83,18 +83,18 @@
</span><span class="cx">     controller.advance(0, &amp;glyphBuffer);
</span><span class="cx">     EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
</span><span class="cx">     controller.advance(1, &amp;glyphBuffer);
</span><del>-    EXPECT_NEAR(controller.runWidthSoFar(), advances[4].width, 0.0001);
</del><ins>+    EXPECT_NEAR(controller.runWidthSoFar(), advances[4].width(), 0.0001);
</ins><span class="cx">     controller.advance(6, &amp;glyphBuffer);
</span><span class="cx">     EXPECT_NEAR(controller.runWidthSoFar(), spaceWidth + totalWidth, 0.0001);
</span><span class="cx">     EXPECT_NEAR(glyphBuffer.initialAdvance().width(), 0, 0.0001);
</span><span class="cx">     EXPECT_NEAR(glyphBuffer.initialAdvance().height(), 0, 0.0001);
</span><span class="cx">     EXPECT_EQ(glyphBuffer.size(), 6U);
</span><del>-    EXPECT_NEAR(glyphBuffer.advanceAt(0).width(), advances[4].width, 0.0001);
-    EXPECT_NEAR(glyphBuffer.advanceAt(1).width(), advances[3].width, 0.0001);
-    EXPECT_NEAR(glyphBuffer.advanceAt(2).width(), advances[2].width, 0.0001);
-    EXPECT_NEAR(glyphBuffer.advanceAt(3).width(), advances[1].width, 0.0001);
-    EXPECT_NEAR(glyphBuffer.advanceAt(4).width(), -initialAdvance.width, 0.0001);
-    EXPECT_NEAR(glyphBuffer.advanceAt(5).width(), spaceWidth + initialAdvance.width, 0.0001);
</del><ins>+    EXPECT_NEAR(glyphBuffer.advanceAt(0).width(), advances[4].width(), 0.0001);
+    EXPECT_NEAR(glyphBuffer.advanceAt(1).width(), advances[3].width(), 0.0001);
+    EXPECT_NEAR(glyphBuffer.advanceAt(2).width(), advances[2].width(), 0.0001);
+    EXPECT_NEAR(glyphBuffer.advanceAt(3).width(), advances[1].width(), 0.0001);
+    EXPECT_NEAR(glyphBuffer.advanceAt(4).width(), -initialAdvance.width(), 0.0001);
+    EXPECT_NEAR(glyphBuffer.advanceAt(5).width(), spaceWidth + initialAdvance.width(), 0.0001);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> TEST_F(ComplexTextControllerTest, InitialAdvanceInRTL)
</span><span class="lines">@@ -106,19 +106,19 @@
</span><span class="cx">     font.update();
</span><span class="cx"> 
</span><span class="cx"> #if USE_LAYOUT_SPECIFIC_ADVANCES
</span><del>-    Vector&lt;CGSize&gt; advances = { CGSizeZero, CGSizeMake(21.640625, 0.0), CGSizeMake(42.3046875, 0.0), CGSizeMake(55.8984375, 0.0), CGSizeMake(22.34375, 0.0) };
-    Vector&lt;CGPoint&gt; origins = { CGPointMake(-15.15625, 18.046875), CGPointZero, CGPointZero, CGPointZero, CGPointZero };
</del><ins>+    Vector&lt;FloatSize&gt; advances = { FloatSize(), FloatSize(21.640625, 0.0), FloatSize(42.3046875, 0.0), FloatSize(55.8984375, 0.0), FloatSize(22.34375, 0.0) };
+    Vector&lt;FloatPoint&gt; origins = { FloatPoint(-15.15625, 18.046875), FloatPoint(), FloatPoint(), FloatPoint(), FloatPoint() };
</ins><span class="cx"> #else
</span><del>-    Vector&lt;CGSize&gt; advances = { CGSizeMake(15.15625, -18.046875), CGSizeMake(21.640625, 0.0), CGSizeMake(42.3046875, 0.0), CGSizeMake(55.8984375, 0.0), CGSizeMake(22.34375, 0.0) };
-    Vector&lt;CGPoint&gt; origins = { };
</del><ins>+    Vector&lt;FloatSize&gt; advances = { FloatSize(15.15625, -18.046875), FloatSize(21.640625, 0.0), FloatSize(42.3046875, 0.0), FloatSize(55.8984375, 0.0), FloatSize(22.34375, 0.0) };
+    Vector&lt;FloatPoint&gt; origins = { };
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    CGSize initialAdvance = CGSizeMake(-15.15625, 18.046875);
</del><ins>+    FloatSize initialAdvance = FloatSize(-15.15625, 18.046875);
</ins><span class="cx"> 
</span><span class="cx">     UChar characters[] = { 0x644, 0x637, 0x641, 0x627, 0x64b };
</span><span class="cx">     size_t charactersLength = WTF_ARRAY_LENGTH(characters);
</span><span class="cx">     TextRun textRun(StringView(characters, charactersLength));
</span><del>-    auto run = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 193, 377, 447, 431, 458 }, { 4, 3, 2, 1, 0 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 5), false);
</del><ins>+    auto run = ComplexTextController::ComplexTextRun::create(advances, origins, { 193, 377, 447, 431, 458 }, { 4, 3, 2, 1, 0 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, 0, 5, false);
</ins><span class="cx">     Vector&lt;Ref&lt;ComplexTextController::ComplexTextRun&gt;&gt; runs;
</span><span class="cx">     runs.append(WTFMove(run));
</span><span class="cx">     ComplexTextController controller(font, textRun, runs);
</span><span class="lines">@@ -125,7 +125,7 @@
</span><span class="cx"> 
</span><span class="cx">     CGFloat totalWidth = 0;
</span><span class="cx">     for (size_t i = 1; i &lt; advances.size(); ++i)
</span><del>-        totalWidth += advances[i].width;
</del><ins>+        totalWidth += advances[i].width();
</ins><span class="cx">     EXPECT_NEAR(controller.totalWidth(), totalWidth, 0.0001);
</span><span class="cx">     GlyphBuffer glyphBuffer;
</span><span class="cx">     EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
</span><span class="lines">@@ -132,18 +132,18 @@
</span><span class="cx">     controller.advance(0, &amp;glyphBuffer);
</span><span class="cx">     EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
</span><span class="cx">     controller.advance(1, &amp;glyphBuffer);
</span><del>-    EXPECT_NEAR(controller.runWidthSoFar(), advances[4].width, 0.0001);
</del><ins>+    EXPECT_NEAR(controller.runWidthSoFar(), advances[4].width(), 0.0001);
</ins><span class="cx">     controller.advance(5, &amp;glyphBuffer);
</span><span class="cx">     EXPECT_NEAR(controller.runWidthSoFar(), totalWidth, 0.0001);
</span><del>-    EXPECT_NEAR(glyphBuffer.initialAdvance().width(), initialAdvance.width, 0.0001);
-    EXPECT_NEAR(glyphBuffer.initialAdvance().height(), initialAdvance.height, 0.0001);
</del><ins>+    EXPECT_NEAR(glyphBuffer.initialAdvance().width(), initialAdvance.width(), 0.0001);
+    EXPECT_NEAR(glyphBuffer.initialAdvance().height(), initialAdvance.height(), 0.0001);
</ins><span class="cx">     EXPECT_EQ(glyphBuffer.size(), 5U);
</span><del>-    EXPECT_NEAR(glyphBuffer.advanceAt(0).width(), advances[4].width, 0.0001);
-    EXPECT_NEAR(glyphBuffer.advanceAt(1).width(), advances[3].width, 0.0001);
-    EXPECT_NEAR(glyphBuffer.advanceAt(2).width(), advances[2].width, 0.0001);
-    EXPECT_NEAR(glyphBuffer.advanceAt(3).width(), advances[1].width, 0.0001);
-    EXPECT_NEAR(glyphBuffer.advanceAt(4).width(), -initialAdvance.width, 0.0001);
-    EXPECT_NEAR(glyphBuffer.advanceAt(4).height(), initialAdvance.height, 0.0001);
</del><ins>+    EXPECT_NEAR(glyphBuffer.advanceAt(0).width(), advances[4].width(), 0.0001);
+    EXPECT_NEAR(glyphBuffer.advanceAt(1).width(), advances[3].width(), 0.0001);
+    EXPECT_NEAR(glyphBuffer.advanceAt(2).width(), advances[2].width(), 0.0001);
+    EXPECT_NEAR(glyphBuffer.advanceAt(3).width(), advances[1].width(), 0.0001);
+    EXPECT_NEAR(glyphBuffer.advanceAt(4).width(), -initialAdvance.width(), 0.0001);
+    EXPECT_NEAR(glyphBuffer.advanceAt(4).height(), initialAdvance.height(), 0.0001);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> TEST_F(ComplexTextControllerTest, InitialAdvanceWithLeftRunInLTR)
</span><span class="lines">@@ -156,26 +156,26 @@
</span><span class="cx">     auto spaceWidth = font.primaryFont().spaceWidth();
</span><span class="cx"> 
</span><span class="cx"> #if USE_LAYOUT_SPECIFIC_ADVANCES
</span><del>-    Vector&lt;CGSize&gt; advances = { CGSizeMake(76.347656, 0.000000), CGSizeMake(0.000000, 0.000000) };
-    Vector&lt;CGPoint&gt; origins = { CGPointZero, CGPointMake(-23.281250, -8.398438) };
</del><ins>+    Vector&lt;FloatSize&gt; advances = { FloatSize(76.347656, 0.000000), FloatSize(0.000000, 0.000000) };
+    Vector&lt;FloatPoint&gt; origins = { FloatPoint(), FloatPoint(-23.281250, -8.398438) };
</ins><span class="cx"> #else
</span><del>-    Vector&lt;CGSize&gt; advances = { CGSizeMake(53.066406, -8.398438), CGSizeMake(23.281250, 8.398438) };
-    Vector&lt;CGPoint&gt; origins = { };
</del><ins>+    Vector&lt;FloatSize&gt; advances = { FloatSize(53.066406, -8.398438), FloatSize(23.281250, 8.398438) };
+    Vector&lt;FloatPoint&gt; origins = { };
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    CGSize initialAdvance = CGSizeMake(28.144531, 0);
</del><ins>+    FloatSize initialAdvance = FloatSize(28.144531, 0);
</ins><span class="cx"> 
</span><span class="cx">     UChar characters[] = { 0x20, 0x61, 0x20e3 };
</span><span class="cx">     size_t charactersLength = WTF_ARRAY_LENGTH(characters);
</span><span class="cx">     TextRun textRun(StringView(characters, charactersLength));
</span><del>-    auto run1 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(spaceWidth, 0) }, { CGPointZero }, { 5 }, { 0 }, CGSizeZero, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 1), true);
-    auto run2 = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 68, 1471 }, { 1, 2 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(1, 2), true);
</del><ins>+    auto run1 = ComplexTextController::ComplexTextRun::create({ FloatSize(spaceWidth, 0) }, { FloatPoint() }, { 5 }, { 0 }, FloatSize(), font.primaryFont(), characters, 0, charactersLength, 0, 1, true);
+    auto run2 = ComplexTextController::ComplexTextRun::create(advances, origins, { 68, 1471 }, { 1, 2 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, 1, 3, true);
</ins><span class="cx">     Vector&lt;Ref&lt;ComplexTextController::ComplexTextRun&gt;&gt; runs;
</span><span class="cx">     runs.append(WTFMove(run1));
</span><span class="cx">     runs.append(WTFMove(run2));
</span><span class="cx">     ComplexTextController controller(font, textRun, runs);
</span><span class="cx"> 
</span><del>-    EXPECT_NEAR(controller.totalWidth(), spaceWidth + 76.347656 + initialAdvance.width, 0.0001);
</del><ins>+    EXPECT_NEAR(controller.totalWidth(), spaceWidth + 76.347656 + initialAdvance.width(), 0.0001);
</ins><span class="cx">     GlyphBuffer glyphBuffer;
</span><span class="cx">     EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
</span><span class="cx">     controller.advance(0, &amp;glyphBuffer);
</span><span class="lines">@@ -183,13 +183,13 @@
</span><span class="cx">     controller.advance(1, &amp;glyphBuffer);
</span><span class="cx">     EXPECT_NEAR(controller.runWidthSoFar(), spaceWidth, 0.0001);
</span><span class="cx">     controller.advance(2, &amp;glyphBuffer);
</span><del>-    EXPECT_NEAR(controller.runWidthSoFar(), spaceWidth + advances[0].width + initialAdvance.width, 0.0001);
</del><ins>+    EXPECT_NEAR(controller.runWidthSoFar(), spaceWidth + advances[0].width() + initialAdvance.width(), 0.0001);
</ins><span class="cx">     controller.advance(3, &amp;glyphBuffer);
</span><del>-    EXPECT_NEAR(controller.runWidthSoFar(), spaceWidth + 76.347656 + initialAdvance.width, 0.0001);
</del><ins>+    EXPECT_NEAR(controller.runWidthSoFar(), spaceWidth + 76.347656 + initialAdvance.width(), 0.0001);
</ins><span class="cx">     EXPECT_NEAR(glyphBuffer.initialAdvance().width(), 0, 0.0001);
</span><span class="cx">     EXPECT_NEAR(glyphBuffer.initialAdvance().height(), 0, 0.0001);
</span><span class="cx">     EXPECT_EQ(glyphBuffer.size(), 3U);
</span><del>-    EXPECT_NEAR(glyphBuffer.advanceAt(0).width(), spaceWidth + initialAdvance.width, 0.0001);
</del><ins>+    EXPECT_NEAR(glyphBuffer.advanceAt(0).width(), spaceWidth + initialAdvance.width(), 0.0001);
</ins><span class="cx">     EXPECT_NEAR(glyphBuffer.advanceAt(1).width(), 53.066406, 0.0001);
</span><span class="cx">     EXPECT_NEAR(glyphBuffer.advanceAt(2).width(), 23.281250, 0.0001);
</span><span class="cx"> }
</span><span class="lines">@@ -203,34 +203,34 @@
</span><span class="cx">     font.update();
</span><span class="cx"> 
</span><span class="cx"> #if USE_LAYOUT_SPECIFIC_ADVANCES
</span><del>-    Vector&lt;CGSize&gt; advances = { CGSizeMake(76.347656, 0.000000), CGSizeMake(0.000000, 0.000000) };
-    Vector&lt;CGPoint&gt; origins = { CGPointZero, CGPointMake(-23.281250, -8.398438) };
</del><ins>+    Vector&lt;FloatSize&gt; advances = { FloatSize(76.347656, 0.000000), FloatSize(0.000000, 0.000000) };
+    Vector&lt;FloatPoint&gt; origins = { FloatPoint(), FloatPoint(-23.281250, -8.398438) };
</ins><span class="cx"> #else
</span><del>-    Vector&lt;CGSize&gt; advances = { CGSizeMake(53.066406, -8.398438), CGSizeMake(23.281250, 8.398438) };
-    Vector&lt;CGPoint&gt; origins = { };
</del><ins>+    Vector&lt;FloatSize&gt; advances = { FloatSize(53.066406, -8.398438), FloatSize(23.281250, 8.398438) };
+    Vector&lt;FloatPoint&gt; origins = { };
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    CGSize initialAdvance = CGSizeMake(28.144531, 0);
</del><ins>+    FloatSize initialAdvance = FloatSize(28.144531, 0);
</ins><span class="cx"> 
</span><span class="cx">     UChar characters[] = { 0x61, 0x20e3 };
</span><span class="cx">     size_t charactersLength = WTF_ARRAY_LENGTH(characters);
</span><span class="cx">     TextRun textRun(StringView(characters, charactersLength));
</span><del>-    auto run = ComplexTextController::ComplexTextRun::createForTesting(advances, origins, { 68, 1471 }, { 0, 1 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 2), true);
</del><ins>+    auto run = ComplexTextController::ComplexTextRun::create(advances, origins, { 68, 1471 }, { 0, 1 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, 0, 2, true);
</ins><span class="cx">     Vector&lt;Ref&lt;ComplexTextController::ComplexTextRun&gt;&gt; runs;
</span><span class="cx">     runs.append(WTFMove(run));
</span><span class="cx">     ComplexTextController controller(font, textRun, runs);
</span><span class="cx"> 
</span><del>-    EXPECT_NEAR(controller.totalWidth(), 76.347656 + initialAdvance.width, 0.0001);
</del><ins>+    EXPECT_NEAR(controller.totalWidth(), 76.347656 + initialAdvance.width(), 0.0001);
</ins><span class="cx">     GlyphBuffer glyphBuffer;
</span><span class="cx">     EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
</span><span class="cx">     controller.advance(0, &amp;glyphBuffer);
</span><span class="cx">     EXPECT_NEAR(controller.runWidthSoFar(), 0, 0.0001);
</span><span class="cx">     controller.advance(1, &amp;glyphBuffer);
</span><del>-    EXPECT_NEAR(controller.runWidthSoFar(), advances[0].width + initialAdvance.width, 0.0001);
</del><ins>+    EXPECT_NEAR(controller.runWidthSoFar(), advances[0].width() + initialAdvance.width(), 0.0001);
</ins><span class="cx">     controller.advance(2, &amp;glyphBuffer);
</span><del>-    EXPECT_NEAR(controller.runWidthSoFar(), 76.347656 + initialAdvance.width, 0.0001);
-    EXPECT_NEAR(glyphBuffer.initialAdvance().width(), initialAdvance.width, 0.0001);
-    EXPECT_NEAR(glyphBuffer.initialAdvance().height(), initialAdvance.height, 0.0001);
</del><ins>+    EXPECT_NEAR(controller.runWidthSoFar(), 76.347656 + initialAdvance.width(), 0.0001);
+    EXPECT_NEAR(glyphBuffer.initialAdvance().width(), initialAdvance.width(), 0.0001);
+    EXPECT_NEAR(glyphBuffer.initialAdvance().height(), initialAdvance.height(), 0.0001);
</ins><span class="cx">     EXPECT_EQ(glyphBuffer.size(), 2U);
</span><span class="cx">     EXPECT_NEAR(glyphBuffer.advanceAt(0).width(), 53.066406, 0.0001);
</span><span class="cx">     EXPECT_NEAR(glyphBuffer.advanceAt(1).width(), 23.281250, 0.0001);
</span><span class="lines">@@ -244,14 +244,14 @@
</span><span class="cx">     FontCascade font(description);
</span><span class="cx">     font.update();
</span><span class="cx"> 
</span><del>-    CGSize initialAdvance = CGSizeMake(4.33996383363472, 12.368896925859);
</del><ins>+    FloatSize initialAdvance = FloatSize(4.33996383363472, 12.368896925859);
</ins><span class="cx"> 
</span><span class="cx">     UChar characters[] = { 0x633, 0x20, 0x627, 0x650 };
</span><span class="cx">     size_t charactersLength = WTF_ARRAY_LENGTH(characters);
</span><span class="cx">     TextRun textRun(StringView(characters, charactersLength));
</span><del>-    auto run1 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(-4.33996383363472, -12.368896925859), CGSizeMake(14.0397830018083, 0) }, { }, { 884, 240 }, { 3, 2 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(2, 2), false);
-    auto run2 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(12.0, 0) }, { }, { 3 }, { 1 }, CGSizeZero, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(1, 1), false);
-    auto run3 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(43.8119349005425, 0) }, { }, { 276 }, { 0 }, CGSizeZero, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 1), false);
</del><ins>+    auto run1 = ComplexTextController::ComplexTextRun::create({ FloatSize(-4.33996383363472, -12.368896925859), FloatSize(14.0397830018083, 0) }, { }, { 884, 240 }, { 3, 2 }, initialAdvance, font.primaryFont(), characters, 0, charactersLength, 2, 4, false);
+    auto run2 = ComplexTextController::ComplexTextRun::create({ FloatSize(12.0, 0) }, { }, { 3 }, { 1 }, FloatSize(), font.primaryFont(), characters, 0, charactersLength, 1, 2, false);
+    auto run3 = ComplexTextController::ComplexTextRun::create({ FloatSize(43.8119349005425, 0) }, { }, { 276 }, { 0 }, FloatSize(), font.primaryFont(), characters, 0, charactersLength, 0, 1, false);
</ins><span class="cx">     Vector&lt;Ref&lt;ComplexTextController::ComplexTextRun&gt;&gt; runs;
</span><span class="cx">     runs.append(WTFMove(run1));
</span><span class="cx">     runs.append(WTFMove(run2));
</span><span class="lines">@@ -272,8 +272,8 @@
</span><span class="cx">     EXPECT_NEAR(controller.runWidthSoFar(), totalWidth, 0.0001);
</span><span class="cx">     controller.advance(4, &amp;glyphBuffer);
</span><span class="cx">     EXPECT_NEAR(controller.runWidthSoFar(), totalWidth, 0.0001);
</span><del>-    EXPECT_NEAR(glyphBuffer.initialAdvance().width(), initialAdvance.width, 0.0001);
-    EXPECT_NEAR(glyphBuffer.initialAdvance().height(), initialAdvance.height, 0.0001);
</del><ins>+    EXPECT_NEAR(glyphBuffer.initialAdvance().width(), initialAdvance.width(), 0.0001);
+    EXPECT_NEAR(glyphBuffer.initialAdvance().height(), initialAdvance.height(), 0.0001);
</ins><span class="cx">     EXPECT_EQ(glyphBuffer.size(), 4U);
</span><span class="cx">     EXPECT_NEAR(glyphBuffer.advanceAt(0).width(), 43.8119349005425, 0.0001);
</span><span class="cx">     EXPECT_NEAR(glyphBuffer.advanceAt(1).width(), 12.0, 0.0001);
</span><span class="lines">@@ -293,7 +293,7 @@
</span><span class="cx">     UChar characters[] = { 'a' };
</span><span class="cx">     size_t charactersLength = WTF_ARRAY_LENGTH(characters);
</span><span class="cx">     TextRun textRun(StringView(characters, charactersLength), 0, 100, ForceLeadingExpansion);
</span><del>-    auto run = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(24, 0) }, { }, { 16 }, { 0 }, CGSizeZero, font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 1), true);
</del><ins>+    auto run = ComplexTextController::ComplexTextRun::create({ FloatSize(24, 0) }, { }, { 16 }, { 0 }, FloatSize(), font.primaryFont(), characters, 0, charactersLength, 0, 1, true);
</ins><span class="cx">     Vector&lt;Ref&lt;ComplexTextController::ComplexTextRun&gt;&gt; runs;
</span><span class="cx">     runs.append(WTFMove(run));
</span><span class="cx">     ComplexTextController controller(font, textRun, runs);
</span><span class="lines">@@ -323,8 +323,8 @@
</span><span class="cx">     UChar characters[] = { 'a', 'b', 'c', 'd' };
</span><span class="cx">     size_t charactersLength = WTF_ARRAY_LENGTH(characters);
</span><span class="cx">     TextRun textRun(StringView(characters, charactersLength));
</span><del>-    auto run1 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(0, 1), CGSizeMake(0, 2) }, { CGPointMake(0, 4), CGPointMake(0, 8) }, { 16, 17 }, { 0, 1 }, CGSizeMake(0, 16), font.primaryFont(), characters, 0, charactersLength, CFRangeMake(0, 2), true);
-    auto run2 = ComplexTextController::ComplexTextRun::createForTesting({ CGSizeMake(0, 32), CGSizeMake(0, 64) }, { CGPointMake(0, 128), CGPointMake(0, 256) }, { 18, 19 }, { 2, 3 }, CGSizeMake(0, 512), font.primaryFont(), characters, 0, charactersLength, CFRangeMake(2, 2), true);
</del><ins>+    auto run1 = ComplexTextController::ComplexTextRun::create({ FloatSize(0, 1), FloatSize(0, 2) }, { FloatPoint(0, 4), FloatPoint(0, 8) }, { 16, 17 }, { 0, 1 }, FloatSize(0, 16), font.primaryFont(), characters, 0, charactersLength, 0, 2, true);
+    auto run2 = ComplexTextController::ComplexTextRun::create({ FloatSize(0, 32), FloatSize(0, 64) }, { FloatPoint(0, 128), FloatPoint(0, 256) }, { 18, 19 }, { 2, 3 }, FloatSize(0, 512), font.primaryFont(), characters, 0, charactersLength, 2, 4, true);
</ins><span class="cx">     Vector&lt;Ref&lt;ComplexTextController::ComplexTextRun&gt;&gt; runs;
</span><span class="cx">     runs.append(WTFMove(run1));
</span><span class="cx">     runs.append(WTFMove(run2));
</span></span></pre>
</div>
</div>

</body>
</html>