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

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

<h3>Log Message</h3>
<pre>Simple line layout: Move FlowContents iterator interface to FlowContentsIterator.
https://bugs.webkit.org/show_bug.cgi?id=140944

Reviewed by Antti Koivisto.

This patch cleans up FlowContents's interface by moving the iterator functionality
to this new FlowContentsIterator class.

No change in functionality.

* CMakeLists.txt:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::LineState::addUncommitted):
(WebCore::SimpleLineLayout::LineState::addUncommittedWhitespace):
(WebCore::SimpleLineLayout::preWrap):
(WebCore::SimpleLineLayout::removeTrailingWhitespace):
(WebCore::SimpleLineLayout::splitFragmentToFitLine):
(WebCore::SimpleLineLayout::firstFragment):
(WebCore::SimpleLineLayout::createLineRuns):
(WebCore::SimpleLineLayout::closeLineEndingAndAdjustRuns):
(WebCore::SimpleLineLayout::splitRunsAtRendererBoundary):
(WebCore::SimpleLineLayout::createTextRuns):
* rendering/SimpleLineLayoutFlowContents.cpp:
(WebCore::SimpleLineLayout::FlowContents::FlowContents):
(WebCore::SimpleLineLayout::FlowContents::Style::Style): Deleted.
(WebCore::SimpleLineLayout::FlowContents::nextTextFragment): Deleted.
(WebCore::SimpleLineLayout::nextBreakablePosition): Deleted.
(WebCore::SimpleLineLayout::FlowContents::findNextBreakablePosition): Deleted.
(WebCore::SimpleLineLayout::findNextNonWhitespace): Deleted.
(WebCore::SimpleLineLayout::FlowContents::findNextNonWhitespacePosition): Deleted.
(WebCore::SimpleLineLayout::FlowContents::textWidth): Deleted.
(WebCore::SimpleLineLayout::FlowContents::runWidth): Deleted.
* rendering/SimpleLineLayoutFlowContents.h:
(WebCore::SimpleLineLayout::FlowContents::Iterator::Iterator):
(WebCore::SimpleLineLayout::FlowContents::Iterator::operator*):
(WebCore::SimpleLineLayout::FlowContents::begin):
(WebCore::SimpleLineLayout::FlowContents::end):
(WebCore::SimpleLineLayout::FlowContents::length):
(WebCore::SimpleLineLayout::FlowContents::Iterator::operator++):
(WebCore::SimpleLineLayout::FlowContents::Iterator::operator==):
(WebCore::SimpleLineLayout::FlowContents::Iterator::operator!=):
(WebCore::SimpleLineLayout::FlowContents::segmentIndexForPosition):
(WebCore::SimpleLineLayout::FlowContents::TextFragment::TextFragment): Deleted.
(WebCore::SimpleLineLayout::FlowContents::TextFragment::isEmpty): Deleted.
(WebCore::SimpleLineLayout::FlowContents::hasOneSegment): Deleted.
(WebCore::SimpleLineLayout::FlowContents::style): Deleted.
(WebCore::SimpleLineLayout::FlowContents::characterAt): Deleted.
(WebCore::SimpleLineLayout::FlowContents::isLineBreak): Deleted.
(WebCore::SimpleLineLayout::FlowContents::isEnd): Deleted.
* rendering/SimpleLineLayoutFlowContentsIterator.cpp: Copied from Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp.
(WebCore::SimpleLineLayout::FlowContentsIterator::Style::Style):
(WebCore::SimpleLineLayout::FlowContentsIterator::FlowContentsIterator):
(WebCore::SimpleLineLayout::FlowContentsIterator::nextTextFragment):
(WebCore::SimpleLineLayout::FlowContentsIterator::textWidth):
(WebCore::SimpleLineLayout::nextBreakablePosition):
(WebCore::SimpleLineLayout::FlowContentsIterator::findNextBreakablePosition):
(WebCore::SimpleLineLayout::findNextNonWhitespace):
(WebCore::SimpleLineLayout::FlowContentsIterator::findNextNonWhitespacePosition):
(WebCore::SimpleLineLayout::FlowContentsIterator::runWidth):
* rendering/SimpleLineLayoutFlowContentsIterator.h: Copied from Source/WebCore/rendering/SimpleLineLayoutFlowContents.h.
(WebCore::SimpleLineLayout::FlowContentsIterator::TextFragment::TextFragment):
(WebCore::SimpleLineLayout::FlowContentsIterator::TextFragment::isEmpty):
(WebCore::SimpleLineLayout::FlowContentsIterator::style):
(WebCore::SimpleLineLayout::FlowContentsIterator::segmentForPosition):
(WebCore::SimpleLineLayout::FlowContentsIterator::characterAt):
(WebCore::SimpleLineLayout::FlowContentsIterator::isLineBreak):
(WebCore::SimpleLineLayout::FlowContentsIterator::isEnd):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxproj">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorerenderingSimpleLineLayoutcpp">trunk/Source/WebCore/rendering/SimpleLineLayout.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingSimpleLineLayoutFlowContentscpp">trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingSimpleLineLayoutFlowContentsh">trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorerenderingSimpleLineLayoutFlowContentsIteratorcpp">trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContentsIterator.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingSimpleLineLayoutFlowContentsIteratorh">trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContentsIterator.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (179283 => 179284)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2015-01-28 21:27:39 UTC (rev 179283)
+++ trunk/Source/WebCore/CMakeLists.txt        2015-01-28 21:37:40 UTC (rev 179284)
</span><span class="lines">@@ -2352,6 +2352,7 @@
</span><span class="cx">     rendering/ScrollBehavior.cpp
</span><span class="cx">     rendering/SimpleLineLayout.cpp
</span><span class="cx">     rendering/SimpleLineLayoutFlowContents.cpp
</span><ins>+    rendering/SimpleLineLayoutFlowContentsIterator.cpp
</ins><span class="cx">     rendering/SimpleLineLayoutFunctions.cpp
</span><span class="cx">     rendering/SimpleLineLayoutResolver.cpp
</span><span class="cx">     rendering/TextAutosizer.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (179283 => 179284)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-01-28 21:27:39 UTC (rev 179283)
+++ trunk/Source/WebCore/ChangeLog        2015-01-28 21:37:40 UTC (rev 179284)
</span><span class="lines">@@ -1,3 +1,76 @@
</span><ins>+2015-01-28  Zalan Bujtas  &lt;zalan@apple.com&gt;
+
+        Simple line layout: Move FlowContents iterator interface to FlowContentsIterator.
+        https://bugs.webkit.org/show_bug.cgi?id=140944
+
+        Reviewed by Antti Koivisto.
+
+        This patch cleans up FlowContents's interface by moving the iterator functionality
+        to this new FlowContentsIterator class.
+
+        No change in functionality.
+
+        * CMakeLists.txt:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        * rendering/SimpleLineLayout.cpp:
+        (WebCore::SimpleLineLayout::LineState::addUncommitted):
+        (WebCore::SimpleLineLayout::LineState::addUncommittedWhitespace):
+        (WebCore::SimpleLineLayout::preWrap):
+        (WebCore::SimpleLineLayout::removeTrailingWhitespace):
+        (WebCore::SimpleLineLayout::splitFragmentToFitLine):
+        (WebCore::SimpleLineLayout::firstFragment):
+        (WebCore::SimpleLineLayout::createLineRuns):
+        (WebCore::SimpleLineLayout::closeLineEndingAndAdjustRuns):
+        (WebCore::SimpleLineLayout::splitRunsAtRendererBoundary):
+        (WebCore::SimpleLineLayout::createTextRuns):
+        * rendering/SimpleLineLayoutFlowContents.cpp:
+        (WebCore::SimpleLineLayout::FlowContents::FlowContents):
+        (WebCore::SimpleLineLayout::FlowContents::Style::Style): Deleted.
+        (WebCore::SimpleLineLayout::FlowContents::nextTextFragment): Deleted.
+        (WebCore::SimpleLineLayout::nextBreakablePosition): Deleted.
+        (WebCore::SimpleLineLayout::FlowContents::findNextBreakablePosition): Deleted.
+        (WebCore::SimpleLineLayout::findNextNonWhitespace): Deleted.
+        (WebCore::SimpleLineLayout::FlowContents::findNextNonWhitespacePosition): Deleted.
+        (WebCore::SimpleLineLayout::FlowContents::textWidth): Deleted.
+        (WebCore::SimpleLineLayout::FlowContents::runWidth): Deleted.
+        * rendering/SimpleLineLayoutFlowContents.h:
+        (WebCore::SimpleLineLayout::FlowContents::Iterator::Iterator):
+        (WebCore::SimpleLineLayout::FlowContents::Iterator::operator*):
+        (WebCore::SimpleLineLayout::FlowContents::begin):
+        (WebCore::SimpleLineLayout::FlowContents::end):
+        (WebCore::SimpleLineLayout::FlowContents::length):
+        (WebCore::SimpleLineLayout::FlowContents::Iterator::operator++):
+        (WebCore::SimpleLineLayout::FlowContents::Iterator::operator==):
+        (WebCore::SimpleLineLayout::FlowContents::Iterator::operator!=):
+        (WebCore::SimpleLineLayout::FlowContents::segmentIndexForPosition):
+        (WebCore::SimpleLineLayout::FlowContents::TextFragment::TextFragment): Deleted.
+        (WebCore::SimpleLineLayout::FlowContents::TextFragment::isEmpty): Deleted.
+        (WebCore::SimpleLineLayout::FlowContents::hasOneSegment): Deleted.
+        (WebCore::SimpleLineLayout::FlowContents::style): Deleted.
+        (WebCore::SimpleLineLayout::FlowContents::characterAt): Deleted.
+        (WebCore::SimpleLineLayout::FlowContents::isLineBreak): Deleted.
+        (WebCore::SimpleLineLayout::FlowContents::isEnd): Deleted.
+        * rendering/SimpleLineLayoutFlowContentsIterator.cpp: Copied from Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp.
+        (WebCore::SimpleLineLayout::FlowContentsIterator::Style::Style):
+        (WebCore::SimpleLineLayout::FlowContentsIterator::FlowContentsIterator):
+        (WebCore::SimpleLineLayout::FlowContentsIterator::nextTextFragment):
+        (WebCore::SimpleLineLayout::FlowContentsIterator::textWidth):
+        (WebCore::SimpleLineLayout::nextBreakablePosition):
+        (WebCore::SimpleLineLayout::FlowContentsIterator::findNextBreakablePosition):
+        (WebCore::SimpleLineLayout::findNextNonWhitespace):
+        (WebCore::SimpleLineLayout::FlowContentsIterator::findNextNonWhitespacePosition):
+        (WebCore::SimpleLineLayout::FlowContentsIterator::runWidth):
+        * rendering/SimpleLineLayoutFlowContentsIterator.h: Copied from Source/WebCore/rendering/SimpleLineLayoutFlowContents.h.
+        (WebCore::SimpleLineLayout::FlowContentsIterator::TextFragment::TextFragment):
+        (WebCore::SimpleLineLayout::FlowContentsIterator::TextFragment::isEmpty):
+        (WebCore::SimpleLineLayout::FlowContentsIterator::style):
+        (WebCore::SimpleLineLayout::FlowContentsIterator::segmentForPosition):
+        (WebCore::SimpleLineLayout::FlowContentsIterator::characterAt):
+        (WebCore::SimpleLineLayout::FlowContentsIterator::isLineBreak):
+        (WebCore::SimpleLineLayout::FlowContentsIterator::isEnd):
+
</ins><span class="cx"> 2015-01-28  Beth Dakin  &lt;bdakin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove Mountain Lion code from WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (179283 => 179284)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2015-01-28 21:27:39 UTC (rev 179283)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2015-01-28 21:37:40 UTC (rev 179284)
</span><span class="lines">@@ -11582,6 +11582,7 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\rendering\SelectionSubtreeRoot.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\rendering\SimpleLineLayout.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\rendering\SimpleLineLayoutFlowContents.cpp&quot; /&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\rendering\SimpleLineLayoutFlowContentsIterator.cpp&quot; /&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\rendering\SimpleLineLayoutFunctions.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\rendering\SimpleLineLayoutResolver.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\rendering\TextPaintStyle.cpp&quot; /&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (179283 => 179284)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2015-01-28 21:27:39 UTC (rev 179283)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2015-01-28 21:37:40 UTC (rev 179284)
</span><span class="lines">@@ -6775,6 +6775,9 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\rendering\SimpleLineLayoutFlowContents.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;rendering&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\rendering\SimpleLineLayoutFlowContentsIterator.cpp&quot;&gt;
+      &lt;Filter&gt;rendering&lt;/Filter&gt;
+    &lt;/ClCompile&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\rendering\SimpleLineLayoutFunctions.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;rendering&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (179283 => 179284)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-01-28 21:27:39 UTC (rev 179283)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-01-28 21:37:40 UTC (rev 179284)
</span><span class="lines">@@ -2096,6 +2096,8 @@
</span><span class="cx">                 580371611A66F00A00BAF519 /* ClipRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5803715F1A66F00A00BAF519 /* ClipRect.cpp */; };
</span><span class="cx">                 580371621A66F00A00BAF519 /* ClipRect.h in Headers */ = {isa = PBXBuildFile; fileRef = 580371601A66F00A00BAF519 /* ClipRect.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 580371641A66F1D300BAF519 /* LayerFragment.h in Headers */ = {isa = PBXBuildFile; fileRef = 580371631A66F1D300BAF519 /* LayerFragment.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                582CB0531A78A14B00AFFCC4 /* SimpleLineLayoutFlowContentsIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 582CB0521A78A14B00AFFCC4 /* SimpleLineLayoutFlowContentsIterator.h */; };
+                582CB0551A78A2B200AFFCC4 /* SimpleLineLayoutFlowContentsIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 582CB0541A78A2B200AFFCC4 /* SimpleLineLayoutFlowContentsIterator.cpp */; };
</ins><span class="cx">                 585D6DFC1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 585D6DFB1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp */; };
</span><span class="cx">                 585D6E031A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 585D6E011A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.cpp */; };
</span><span class="cx">                 585D6E041A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.h in Headers */ = {isa = PBXBuildFile; fileRef = 585D6E021A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.h */; };
</span><span class="lines">@@ -9232,6 +9234,8 @@
</span><span class="cx">                 5803715F1A66F00A00BAF519 /* ClipRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClipRect.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 580371601A66F00A00BAF519 /* ClipRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClipRect.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 580371631A66F1D300BAF519 /* LayerFragment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerFragment.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                582CB0521A78A14B00AFFCC4 /* SimpleLineLayoutFlowContentsIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleLineLayoutFlowContentsIterator.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                582CB0541A78A2B200AFFCC4 /* SimpleLineLayoutFlowContentsIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLineLayoutFlowContentsIterator.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 585D6DFB1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLineLayoutResolver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 585D6E011A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLineLayoutFlowContents.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 585D6E021A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleLineLayoutFlowContents.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -22604,6 +22608,8 @@
</span><span class="cx">                                 E4C91A0D1802343100A17F6D /* TextPaintStyle.h */,
</span><span class="cx">                                 37FC96DA1104ED71003E1FAD /* TrailingFloatsRootInlineBox.h */,
</span><span class="cx">                                 BCA257141293C010007A263D /* VerticalPositionCache.h */,
</span><ins>+                                582CB0521A78A14B00AFFCC4 /* SimpleLineLayoutFlowContentsIterator.h */,
+                                582CB0541A78A2B200AFFCC4 /* SimpleLineLayoutFlowContentsIterator.cpp */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = rendering;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -23543,6 +23549,7 @@
</span><span class="cx">                                 379E61CC126CA5C400B63E8D /* BaseCheckableInputType.h in Headers */,
</span><span class="cx">                                 F5E0C65C1643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.h in Headers */,
</span><span class="cx">                                 C33EE5C514FB49610002095A /* BaseClickableWithKeyInputType.h in Headers */,
</span><ins>+                                582CB0531A78A14B00AFFCC4 /* SimpleLineLayoutFlowContentsIterator.h in Headers */,
</ins><span class="cx">                                 F59C96001255B23F000623C0 /* BaseDateAndTimeInputType.h in Headers */,
</span><span class="cx">                                 F55B3DAE1251F12D003EF269 /* BaseTextInputType.h in Headers */,
</span><span class="cx">                                 FBD6AF8A15EF25DF008B7110 /* BasicShapeFunctions.h in Headers */,
</span><span class="lines">@@ -29506,6 +29513,7 @@
</span><span class="cx">                                 BC2441C40E8B65D00055320F /* ScrollView.cpp in Sources */,
</span><span class="cx">                                 E45390450EAFD637003695C8 /* ScrollViewIOS.mm in Sources */,
</span><span class="cx">                                 9353676B09AED88B00D35CD6 /* ScrollViewMac.mm in Sources */,
</span><ins>+                                582CB0551A78A2B200AFFCC4 /* SimpleLineLayoutFlowContentsIterator.cpp in Sources */,
</ins><span class="cx">                                 F55B3DD11251F12D003EF269 /* SearchInputType.cpp in Sources */,
</span><span class="cx">                                 976F36EA14686225005E93B4 /* SecurityContext.cpp in Sources */,
</span><span class="cx">                                 BCD0E0FA0E972C3500265DEA /* SecurityOrigin.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingSimpleLineLayoutcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/SimpleLineLayout.cpp (179283 => 179284)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SimpleLineLayout.cpp        2015-01-28 21:27:39 UTC (rev 179283)
+++ trunk/Source/WebCore/rendering/SimpleLineLayout.cpp        2015-01-28 21:37:40 UTC (rev 179284)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> #include &quot;RenderView.h&quot;
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><span class="cx"> #include &quot;SimpleLineLayoutFlowContents.h&quot;
</span><ins>+#include &quot;SimpleLineLayoutFlowContentsIterator.h&quot;
</ins><span class="cx"> #include &quot;SimpleLineLayoutFunctions.h&quot;
</span><span class="cx"> #include &quot;Text.h&quot;
</span><span class="cx"> #include &quot;TextPaintStyle.h&quot;
</span><span class="lines">@@ -247,7 +248,7 @@
</span><span class="cx">         m_newUncommittedSegment = true;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void addUncommitted(const FlowContents::TextFragment&amp; fragment)
</del><ins>+    void addUncommitted(const FlowContentsIterator::TextFragment&amp; fragment)
</ins><span class="cx">     {
</span><span class="cx">         // Start a new uncommitted segment.
</span><span class="cx">         if (m_newUncommittedSegment) {
</span><span class="lines">@@ -256,13 +257,13 @@
</span><span class="cx">         }
</span><span class="cx">         uncommittedWidth += fragment.width;
</span><span class="cx">         uncommittedEnd = fragment.end;
</span><del>-        uncomittedTrailingWhitespaceWidth = fragment.type == FlowContents::TextFragment::Whitespace ? fragment.width : 0;
-        uncomittedTrailingWhitespaceLength = fragment.type == FlowContents::TextFragment::Whitespace ? fragment.end - fragment.start  : 0;
</del><ins>+        uncomittedTrailingWhitespaceWidth = fragment.type == FlowContentsIterator::TextFragment::Whitespace ? fragment.width : 0;
+        uncomittedTrailingWhitespaceLength = fragment.type == FlowContentsIterator::TextFragment::Whitespace ? fragment.end - fragment.start  : 0;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     void addUncommittedWhitespace(float whitespaceWidth)
</span><span class="cx">     {
</span><del>-        addUncommitted(FlowContents::TextFragment(uncommittedEnd, uncommittedEnd + 1, whitespaceWidth, true));
</del><ins>+        addUncommitted(FlowContentsIterator::TextFragment(uncommittedEnd, uncommittedEnd + 1, whitespaceWidth, true));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     bool hasWhitespaceOnly() const
</span><span class="lines">@@ -301,25 +302,25 @@
</span><span class="cx">     bool m_firstCharacterFits { false };
</span><span class="cx">     bool m_newUncommittedSegment { true };
</span><span class="cx"> 
</span><del>-    FlowContents::TextFragment overflowedFragment;
</del><ins>+    FlowContentsIterator::TextFragment overflowedFragment;
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     float uncomittedTrailingWhitespaceWidth { 0 };
</span><span class="cx">     unsigned uncomittedTrailingWhitespaceLength { 0 };
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-static bool preWrap(const FlowContents::Style&amp; style)
</del><ins>+static bool preWrap(const FlowContentsIterator::Style&amp; style)
</ins><span class="cx"> {
</span><span class="cx">     return style.wrapLines &amp;&amp; !style.collapseWhitespace;
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-static void removeTrailingWhitespace(LineState&amp; lineState, Layout::RunVector&amp; lineRuns, const FlowContents&amp; flowContents)
</del><ins>+static void removeTrailingWhitespace(LineState&amp; lineState, Layout::RunVector&amp; lineRuns, const FlowContentsIterator&amp; flowContentsIterator)
</ins><span class="cx"> {
</span><span class="cx">     if (!lineState.committedTrailingWhitespaceLength)
</span><span class="cx">         return;
</span><span class="cx">     
</span><span class="cx">     // Remove collapsed whitespace, or non-collapsed pre-wrap whitespace, unless it's the only content on the line -so removing the whitesapce would produce an empty line.
</span><del>-    const auto&amp; style = flowContents.style();
</del><ins>+    const auto&amp; style = flowContentsIterator.style();
</ins><span class="cx">     bool collapseWhitespace = style.collapseWhitespace | preWrap(style);
</span><span class="cx">     if (!collapseWhitespace)
</span><span class="cx">         return;
</span><span class="lines">@@ -345,14 +346,14 @@
</span><span class="cx">     availableWidth = std::max&lt;float&gt;(0, logicalRightOffset - logicalLeftOffset);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static FlowContents::TextFragment splitFragmentToFitLine(FlowContents::TextFragment&amp; fragmentToSplit, float availableWidth, bool keepAtLeastOneCharacter, const FlowContents&amp; flowContents)
</del><ins>+static FlowContentsIterator::TextFragment splitFragmentToFitLine(FlowContentsIterator::TextFragment&amp; fragmentToSplit, float availableWidth, bool keepAtLeastOneCharacter, const FlowContentsIterator&amp; flowContentsIterator)
</ins><span class="cx"> {
</span><span class="cx">     // Fast path for single char fragments.
</span><span class="cx">     if (fragmentToSplit.start + 1 == fragmentToSplit.end) {
</span><span class="cx">         if (keepAtLeastOneCharacter)
</span><del>-            return FlowContents::TextFragment();
</del><ins>+            return FlowContentsIterator::TextFragment();
</ins><span class="cx"> 
</span><del>-        FlowContents::TextFragment fragmentForNextLine(fragmentToSplit);
</del><ins>+        FlowContentsIterator::TextFragment fragmentForNextLine(fragmentToSplit);
</ins><span class="cx">         fragmentToSplit.end = fragmentToSplit.start;
</span><span class="cx">         fragmentToSplit.width = 0;
</span><span class="cx">         return fragmentForNextLine;
</span><span class="lines">@@ -364,7 +365,7 @@
</span><span class="cx">     float width = 0;
</span><span class="cx">     while (left &lt; right) {
</span><span class="cx">         unsigned middle = (left + right) / 2;
</span><del>-        width = flowContents.textWidth(fragmentToSplit.start, middle + 1, 0);
</del><ins>+        width = flowContentsIterator.textWidth(fragmentToSplit.start, middle + 1, 0);
</ins><span class="cx">         if (availableWidth &gt; width)
</span><span class="cx">             left = middle + 1;
</span><span class="cx">         else if (availableWidth &lt; width)
</span><span class="lines">@@ -377,48 +378,48 @@
</span><span class="cx"> 
</span><span class="cx">     if (keepAtLeastOneCharacter &amp;&amp; right == fragmentToSplit.start)
</span><span class="cx">         ++right;
</span><del>-    FlowContents::TextFragment fragmentForNextLine(fragmentToSplit);
</del><ins>+    FlowContentsIterator::TextFragment fragmentForNextLine(fragmentToSplit);
</ins><span class="cx">     fragmentToSplit.end = right;
</span><del>-    fragmentToSplit.width = fragmentToSplit.isEmpty() ? 0 : flowContents.textWidth(fragmentToSplit.start, fragmentToSplit.end, 0);
</del><ins>+    fragmentToSplit.width = fragmentToSplit.isEmpty() ? 0 : flowContentsIterator.textWidth(fragmentToSplit.start, fragmentToSplit.end, 0);
</ins><span class="cx"> 
</span><span class="cx">     fragmentForNextLine.start = fragmentToSplit.end;
</span><span class="cx">     fragmentForNextLine.width -= fragmentToSplit.width;
</span><span class="cx">     return fragmentForNextLine;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static FlowContents::TextFragment firstFragment(FlowContents&amp; flowContents, const LineState&amp; previousLine)
</del><ins>+static FlowContentsIterator::TextFragment firstFragment(FlowContentsIterator&amp; flowContentsIterator, const LineState&amp; previousLine)
</ins><span class="cx"> {
</span><span class="cx">     // Handle overflowed fragment from previous line.
</span><del>-    FlowContents::TextFragment firstFragment = previousLine.overflowedFragment;
-    const auto&amp; style = flowContents.style();
</del><ins>+    FlowContentsIterator::TextFragment firstFragment = previousLine.overflowedFragment;
+    const auto&amp; style = flowContentsIterator.style();
</ins><span class="cx"> 
</span><span class="cx">     if (firstFragment.isEmpty())
</span><del>-        firstFragment = flowContents.nextTextFragment();
</del><ins>+        firstFragment = flowContentsIterator.nextTextFragment();
</ins><span class="cx">     else {
</span><span class="cx">         // Special overflow pre-wrap whitespace handling: ignore the overflowed whitespace if we managed to fit at least one character on the previous line.
</span><span class="cx">         // When the line is too short to fit one character (thought it still stays on the line) we continue with the overflow whitespace content on this line.
</span><del>-        if (firstFragment.type == FlowContents::TextFragment::Whitespace &amp;&amp; preWrap(style) &amp;&amp; previousLine.m_firstCharacterFits) {
-            firstFragment = flowContents.nextTextFragment();
</del><ins>+        if (firstFragment.type == FlowContentsIterator::TextFragment::Whitespace &amp;&amp; preWrap(style) &amp;&amp; previousLine.m_firstCharacterFits) {
+            firstFragment = flowContentsIterator.nextTextFragment();
</ins><span class="cx">             // If skipping the whitespace puts us on a hard newline, skip the newline too as we already wrapped the line.
</span><del>-            if (firstFragment.type == FlowContents::TextFragment::LineBreak)
-                firstFragment = flowContents.nextTextFragment();
</del><ins>+            if (firstFragment.type == FlowContentsIterator::TextFragment::LineBreak)
+                firstFragment = flowContentsIterator.nextTextFragment();
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Check if we need to skip the leading whitespace.
</span><del>-    if (style.collapseWhitespace &amp;&amp; firstFragment.type == FlowContents::TextFragment::Whitespace)
-        firstFragment = flowContents.nextTextFragment();
</del><ins>+    if (style.collapseWhitespace &amp;&amp; firstFragment.type == FlowContentsIterator::TextFragment::Whitespace)
+        firstFragment = flowContentsIterator.nextTextFragment();
</ins><span class="cx">     return firstFragment;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool createLineRuns(LineState&amp; line, const LineState&amp; previousLine, Layout::RunVector&amp; lineRuns, FlowContents&amp; flowContents)
</del><ins>+static bool createLineRuns(LineState&amp; line, const LineState&amp; previousLine, Layout::RunVector&amp; lineRuns, FlowContentsIterator&amp; flowContentsIterator)
</ins><span class="cx"> {
</span><del>-    const auto&amp; style = flowContents.style();
</del><ins>+    const auto&amp; style = flowContentsIterator.style();
</ins><span class="cx">     bool lineCanBeWrapped = style.wrapLines || style.breakWordOnOverflow;
</span><del>-    auto fragment = firstFragment(flowContents, previousLine);
</del><ins>+    auto fragment = firstFragment(flowContentsIterator, previousLine);
</ins><span class="cx">     while (!fragment.isEmpty()) {
</span><span class="cx">         // Hard linebreak.
</span><del>-        if (fragment.type == FlowContents::TextFragment::LineBreak) {
</del><ins>+        if (fragment.type == FlowContentsIterator::TextFragment::LineBreak) {
</ins><span class="cx">             // Add the new line fragment only if there's nothing on the line. (otherwise the extra new line character would show up at the end of the content.)
</span><span class="cx">             if (!line.width())
</span><span class="cx">                 line.addUncommitted(fragment);
</span><span class="lines">@@ -432,10 +433,10 @@
</span><span class="cx">             // 4. Non-whitespace fragment when there's already another fragment on the line gets pushed to the next line.
</span><span class="cx">             bool emptyLine = !line.width();
</span><span class="cx">             // Whitespace fragment.
</span><del>-            if (fragment.type == FlowContents::TextFragment::Whitespace) {
</del><ins>+            if (fragment.type == FlowContentsIterator::TextFragment::Whitespace) {
</ins><span class="cx">                 if (!style.collapseWhitespace) {
</span><span class="cx">                     // Split the fragment; (modified)fragment stays on this line, overflowedFragment is pushed to next line.
</span><del>-                    line.overflowedFragment = splitFragmentToFitLine(fragment, line.availableWidth - line.width(), emptyLine, flowContents);
</del><ins>+                    line.overflowedFragment = splitFragmentToFitLine(fragment, line.availableWidth - line.width(), emptyLine, flowContentsIterator);
</ins><span class="cx">                     line.addUncommitted(fragment);
</span><span class="cx">                 }
</span><span class="cx">                 // When whitespace collapse is on, whitespace that doesn't fit is simply skipped.
</span><span class="lines">@@ -444,7 +445,7 @@
</span><span class="cx">             // Non-whitespace fragment. (!style.wrapLines: bug138102(preserve existing behavior)
</span><span class="cx">             if ((emptyLine &amp;&amp; style.breakWordOnOverflow) || !style.wrapLines) {
</span><span class="cx">                 // Split the fragment; (modified)fragment stays on this line, overflowedFragment is pushed to next line.
</span><del>-                line.overflowedFragment = splitFragmentToFitLine(fragment, line.availableWidth - line.width(), emptyLine, flowContents);
</del><ins>+                line.overflowedFragment = splitFragmentToFitLine(fragment, line.availableWidth - line.width(), emptyLine, flowContentsIterator);
</ins><span class="cx">                 line.addUncommitted(fragment);
</span><span class="cx">                 break;
</span><span class="cx">             }
</span><span class="lines">@@ -465,22 +466,22 @@
</span><span class="cx">         } else
</span><span class="cx">             line.addUncommitted(fragment);
</span><span class="cx">         // Find the next text fragment.
</span><del>-        fragment = flowContents.nextTextFragment(line.width());
</del><ins>+        fragment = flowContentsIterator.nextTextFragment(line.width());
</ins><span class="cx">     }
</span><span class="cx">     line.commitAndCreateRun(lineRuns);
</span><span class="cx">     return fragment.isEmpty() &amp;&amp; line.overflowedFragment.isEmpty();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void closeLineEndingAndAdjustRuns(LineState&amp; line, Layout::RunVector&amp; runs, unsigned previousRunCount, unsigned&amp; lineCount, const FlowContents&amp; flowContents)
</del><ins>+static void closeLineEndingAndAdjustRuns(LineState&amp; line, Layout::RunVector&amp; runs, unsigned previousRunCount, unsigned&amp; lineCount, const FlowContentsIterator&amp; flowContentsIterator)
</ins><span class="cx"> {
</span><span class="cx">     if (previousRunCount == runs.size())
</span><span class="cx">         return;
</span><span class="cx">     ASSERT(runs.size());
</span><del>-    removeTrailingWhitespace(line, runs, flowContents);
</del><ins>+    removeTrailingWhitespace(line, runs, flowContentsIterator);
</ins><span class="cx">     if (!runs.size())
</span><span class="cx">         return;
</span><span class="cx">     // Adjust runs' position by taking line's alignment into account.
</span><del>-    if (float lineLogicalLeft = computeLineLeft(flowContents.style().textAlign, line.availableWidth, line.committedWidth, line.logicalLeftOffset)) {
</del><ins>+    if (float lineLogicalLeft = computeLineLeft(flowContentsIterator.style().textAlign, line.availableWidth, line.committedWidth, line.logicalLeftOffset)) {
</ins><span class="cx">         for (unsigned i = previousRunCount; i &lt; runs.size(); ++i) {
</span><span class="cx">             runs[i].logicalLeft += lineLogicalLeft;
</span><span class="cx">             runs[i].logicalRight += lineLogicalLeft;
</span><span class="lines">@@ -490,24 +491,21 @@
</span><span class="cx">     ++lineCount;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void splitRunsAtRendererBoundary(Layout::RunVector&amp; lineRuns, const FlowContents&amp; flowContents)
</del><ins>+static void splitRunsAtRendererBoundary(Layout::RunVector&amp; lineRuns, const FlowContentsIterator&amp; flowContentsIterator)
</ins><span class="cx"> {
</span><span class="cx">     // FIXME: We should probably split during run construction instead of as a separate pass.
</span><span class="cx">     if (lineRuns.isEmpty())
</span><span class="cx">         return;
</span><del>-    if (flowContents.hasOneSegment())
-        return;
-
</del><span class="cx">     unsigned runIndex = 0;
</span><span class="cx">     do {
</span><span class="cx">         const Run&amp; run = lineRuns.at(runIndex);
</span><span class="cx">         ASSERT(run.start != run.end);
</span><del>-        auto&amp; startSegment = flowContents.segmentForPosition(run.start);
</del><ins>+        auto&amp; startSegment = flowContentsIterator.segmentForPosition(run.start);
</ins><span class="cx">         if (run.end &lt;= startSegment.end)
</span><span class="cx">             continue;
</span><span class="cx">         // This run overlaps multiple renderers. Split it up.
</span><span class="cx">         // Split run at the renderer's boundary and create a new run for the left side, while use the current run as the right side.
</span><del>-        float logicalRightOfLeftRun = run.logicalLeft + flowContents.textWidth(run.start, startSegment.end, run.logicalLeft);
</del><ins>+        float logicalRightOfLeftRun = run.logicalLeft + flowContentsIterator.textWidth(run.start, startSegment.end, run.logicalLeft);
</ins><span class="cx">         lineRuns.insert(runIndex, Run(run.start, startSegment.end, run.logicalLeft, logicalRightOfLeftRun, false));
</span><span class="cx">         Run&amp; rightSideRun = lineRuns.at(runIndex + 1);
</span><span class="cx">         rightSideRun.start = startSegment.end;
</span><span class="lines">@@ -521,7 +519,7 @@
</span><span class="cx">     LayoutUnit lineHeight = lineHeightFromFlow(flow);
</span><span class="cx">     LineState line;
</span><span class="cx">     bool isEndOfContent = false;
</span><del>-    FlowContents flowContents = FlowContents(flow);
</del><ins>+    FlowContentsIterator flowContentsIterator = FlowContentsIterator(flow);
</ins><span class="cx"> 
</span><span class="cx">     do {
</span><span class="cx">         flow.setLogicalHeight(lineHeight * lineCount + borderAndPaddingBefore);
</span><span class="lines">@@ -529,11 +527,12 @@
</span><span class="cx">         unsigned previousRunCount = runs.size();
</span><span class="cx">         line = LineState();
</span><span class="cx">         updateLineConstrains(flow, line.availableWidth, line.logicalLeftOffset);
</span><del>-        isEndOfContent = createLineRuns(line, previousLine, runs, flowContents);
-        closeLineEndingAndAdjustRuns(line, runs, previousRunCount, lineCount, flowContents);
</del><ins>+        isEndOfContent = createLineRuns(line, previousLine, runs, flowContentsIterator);
+        closeLineEndingAndAdjustRuns(line, runs, previousRunCount, lineCount, flowContentsIterator);
</ins><span class="cx">     } while (!isEndOfContent);
</span><span class="cx"> 
</span><del>-    splitRunsAtRendererBoundary(runs, flowContents);
</del><ins>+    if (flow.firstChild() != flow.lastChild())
+        splitRunsAtRendererBoundary(runs, flowContentsIterator);
</ins><span class="cx">     ASSERT(!line.uncommittedWidth);
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingSimpleLineLayoutFlowContentscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp (179283 => 179284)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp        2015-01-28 21:27:39 UTC (rev 179283)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp        2015-01-28 21:37:40 UTC (rev 179284)
</span><span class="lines">@@ -33,19 +33,6 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> namespace SimpleLineLayout {
</span><span class="cx"> 
</span><del>-FlowContents::Style::Style(const RenderStyle&amp; style)
-    : font(style.fontCascade())
-    , textAlign(style.textAlign())
-    , collapseWhitespace(style.collapseWhiteSpace())
-    , preserveNewline(style.preserveNewline())
-    , wrapLines(style.autoWrap())
-    , breakWordOnOverflow(style.overflowWrap() == BreakOverflowWrap &amp;&amp; (wrapLines || preserveNewline))
-    , spaceWidth(font.width(TextRun(&amp;space, 1)))
-    , tabWidth(collapseWhitespace ? 0 : style.tabSize())
-    , locale(style.locale())
-{
-}
-
</del><span class="cx"> static Vector&lt;FlowContents::Segment&gt; initializeSegments(const RenderBlockFlow&amp; flow)
</span><span class="cx"> {
</span><span class="cx">     Vector&lt;FlowContents::Segment, 8&gt; segments;
</span><span class="lines">@@ -59,141 +46,11 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> FlowContents::FlowContents(const RenderBlockFlow&amp; flow)
</span><del>-    : m_style(flow.style())
-    , m_segments(initializeSegments(flow))
-    , m_lineBreakIterator(m_segments[0].text, flow.style().locale())
</del><ins>+    : m_segments(initializeSegments(flow))
</ins><span class="cx">     , m_lastSegmentIndex(0)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-FlowContents::TextFragment FlowContents::nextTextFragment(float xPosition)
-{
-    // A fragment can either be
-    // 1. new line character when preserveNewline is on (not considered as whitespace) or
-    // 2. whitespace (collasped, non-collapsed multi or single) or
-    // 3. non-whitespace characters.
-    // 4. empty, indicating content end.
-    TextFragment fragment;
-    fragment.start = m_position;
-    if (isEnd(fragment.start)) {
-        fragment.end = fragment.start;
-        return fragment;
-    }
-    if (isLineBreak(fragment.start)) {
-        fragment.type = TextFragment::LineBreak;
-        fragment.end = fragment.start + 1;
-        m_position = fragment.end;
-        return fragment;
-    }
-
-    unsigned spaceCount = 0;
-    unsigned whitespaceEnd = findNextNonWhitespacePosition(fragment.start, spaceCount);
-    ASSERT(fragment.start &lt;= whitespaceEnd);
-    if (fragment.start != whitespaceEnd) {
-        fragment.type = TextFragment::Whitespace;
-        fragment.end = whitespaceEnd;
-        bool multipleWhitespace = fragment.start + 1 &lt; fragment.end;
-        fragment.isCollapsed = multipleWhitespace &amp;&amp; m_style.collapseWhitespace;
-        fragment.isBreakable = !fragment.isCollapsed &amp;&amp; multipleWhitespace;
-        if (fragment.isCollapsed)
-            fragment.width = m_style.spaceWidth;
-        else {
-            unsigned fragmentLength = fragment.end - fragment.start;
-            if (fragmentLength == spaceCount)
-                fragment.width = fragmentLength * m_style.spaceWidth;
-            else
-                fragment.width = textWidth(fragment.start, fragment.end, xPosition);
-        }
-        m_position = fragment.end;
-        return fragment;
-    }
-
-    fragment.type = TextFragment::NonWhitespace;
-    fragment.isBreakable = m_style.breakWordOnOverflow;
-    fragment.end = findNextBreakablePosition(fragment.start + 1);
-    fragment.width = textWidth(fragment.start, fragment.end, xPosition);
-    m_position = fragment.end;
-    return fragment;
-}
-
-template &lt;typename CharacterType&gt;
-static unsigned nextBreakablePosition(LazyLineBreakIterator&amp; lineBreakIterator, const FlowContents::Segment&amp; segment, unsigned position)
-{
-    const auto* characters = segment.text.characters&lt;CharacterType&gt;();
-    unsigned segmentLength = segment.end - segment.start;
-    unsigned segmentPosition = position - segment.start;
-    return nextBreakablePositionNonLoosely&lt;CharacterType, NBSPBehavior::IgnoreNBSP&gt;(lineBreakIterator, characters, segmentLength, segmentPosition);
-}
-
-unsigned FlowContents::findNextBreakablePosition(unsigned position) const
-{
-    while (!isEnd(position)) {
-        auto&amp; segment = segmentForPosition(position);
-        if (segment.text.impl() != m_lineBreakIterator.string().impl()) {
-            UChar lastCharacter = segment.start &gt; 0 ? characterAt(segment.start - 1) : 0;
-            UChar secondToLastCharacter = segment.start &gt; 1 ? characterAt(segment.start - 2) : 0;
-            m_lineBreakIterator.setPriorContext(lastCharacter, secondToLastCharacter);
-            m_lineBreakIterator.resetStringAndReleaseIterator(segment.text, m_style.locale, LineBreakIteratorModeUAX14);
-        }
-
-        unsigned breakable = segment.text.is8Bit() ? nextBreakablePosition&lt;LChar&gt;(m_lineBreakIterator, segment, position) : nextBreakablePosition&lt;UChar&gt;(m_lineBreakIterator, segment, position);
-        position = segment.start + breakable;
-        if (position &lt; segment.end)
-            break;
-    }
-    return position;
-}
-
-template &lt;typename CharacterType&gt;
-static bool findNextNonWhitespace(const FlowContents::Segment&amp; segment, const FlowContents::Style&amp; style, unsigned&amp; position, unsigned&amp; spaceCount)
-{
-    const auto* text = segment.text.characters&lt;CharacterType&gt;();
-    for (; position &lt; segment.end; ++position) {
-        auto character = text[position - segment.start];
-        bool isSpace = character == ' ';
-        bool isWhitespace = isSpace || character == '\t' || (!style.preserveNewline &amp;&amp; character == '\n');
-        if (!isWhitespace)
-            return true;
-        if (isSpace)
-            ++spaceCount;
-    }
-    return false;
-}
-
-unsigned FlowContents::findNextNonWhitespacePosition(unsigned position, unsigned&amp; spaceCount) const
-{
-    for (unsigned i = segmentIndexForPosition(position); i &lt; m_segments.size(); ++i) {
-        bool foundNonWhitespace = m_segments[i].text.is8Bit() ? findNextNonWhitespace&lt;LChar&gt;(m_segments[i], m_style, position, spaceCount) :
-            findNextNonWhitespace&lt;UChar&gt;(m_segments[i], m_style, position, spaceCount);
-        if (foundNonWhitespace)
-            break;
-    }
-    return position;
-}
-
-float FlowContents::textWidth(unsigned from, unsigned to, float xPosition) const
-{
-    const auto&amp; fromSegment = segmentForPosition(from);
-
-    if ((m_style.font.isFixedPitch() &amp;&amp; fromSegment.end &gt;= to) || (from == fromSegment.start &amp;&amp; to == fromSegment.end))
-        return fromSegment.renderer.width(from - fromSegment.start, to - from, m_style.font, xPosition, nullptr, nullptr);
-
-    const auto* segment = &amp;fromSegment;
-    float textWidth = 0;
-    unsigned fragmentEnd = 0;
-    while (true) {
-        fragmentEnd = std::min(to, segment-&gt;end);
-        textWidth += segment-&gt;text.is8Bit() ? runWidth&lt;LChar&gt;(segment-&gt;text, from - segment-&gt;start, fragmentEnd - segment-&gt;start, xPosition + textWidth) :
-            runWidth&lt;UChar&gt;(segment-&gt;text, from - segment-&gt;start, fragmentEnd - segment-&gt;start, xPosition + textWidth);
-        if (fragmentEnd == to)
-            break;
-        from = fragmentEnd;
-        segment = &amp;segmentForPosition(fragmentEnd);
-    };
-
-    return textWidth;
-}
-
</del><span class="cx"> unsigned FlowContents::segmentIndexForPositionSlow(unsigned position) const
</span><span class="cx"> {
</span><span class="cx">     auto it = std::lower_bound(m_segments.begin(), m_segments.end(), position, [](const Segment&amp; segment, unsigned position) {
</span><span class="lines">@@ -215,21 +72,5 @@
</span><span class="cx">     return m_segments.last();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-template &lt;typename CharacterType&gt;
-float FlowContents::runWidth(const String&amp; text, unsigned from, unsigned to, float xPosition) const
-{
-    ASSERT(from &lt; to);
-    bool measureWithEndSpace = m_style.collapseWhitespace &amp;&amp; to &lt; text.length() &amp;&amp; text[to] == ' ';
-    if (measureWithEndSpace)
-        ++to;
-    TextRun run(text.characters&lt;CharacterType&gt;() + from, to - from);
-    run.setXPos(xPosition);
-    run.setTabSize(!!m_style.tabWidth, m_style.tabWidth);
-    float width = m_style.font.width(run);
-    if (measureWithEndSpace)
-        width -= m_style.spaceWidth;
-    return width;
</del><span class="cx"> }
</span><del>-
</del><span class="cx"> }
</span><del>-}
</del></span></pre></div>
<a id="trunkSourceWebCorerenderingSimpleLineLayoutFlowContentsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h (179283 => 179284)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h        2015-01-28 21:27:39 UTC (rev 179283)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h        2015-01-28 21:37:40 UTC (rev 179284)
</span><span class="lines">@@ -26,10 +26,7 @@
</span><span class="cx"> #ifndef SimpleLineLayoutFlowContents_h
</span><span class="cx"> #define SimpleLineLayoutFlowContents_h
</span><span class="cx"> 
</span><del>-#include &quot;FontCascade.h&quot;
-#include &quot;RenderStyle.h&quot;
-#include &quot;TextBreakIterator.h&quot;
-#include &quot;break_lines.h&quot;
</del><ins>+#include &quot;RenderText.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> class RenderBlockFlow;
</span><span class="lines">@@ -40,32 +37,6 @@
</span><span class="cx"> public:
</span><span class="cx">     FlowContents(const RenderBlockFlow&amp;);
</span><span class="cx"> 
</span><del>-    struct TextFragment {
-        TextFragment() = default;
-        TextFragment(unsigned textStart, unsigned textEnd, float textWidth, bool isWhitespaceOnly)
-            : start(textStart)
-            , end(textEnd)
-            , type(isWhitespaceOnly ? Whitespace : NonWhitespace)
-            , width(textWidth)
-        {
-        }
-
-        bool isEmpty() const
-        {
-            return start == end;
-        }
-
-        enum Type { LineBreak, Whitespace, NonWhitespace };
-        unsigned start = 0;
-        unsigned end = 0;
-        Type type = NonWhitespace;
-        bool isCollapsed = false;
-        bool isBreakable = false;
-        float width = 0;
-    };
-    TextFragment nextTextFragment(float xPosition = 0);
-    float textWidth(unsigned from, unsigned to, float xPosition) const;
-
</del><span class="cx">     struct Segment {
</span><span class="cx">         unsigned start;
</span><span class="cx">         unsigned end;
</span><span class="lines">@@ -75,64 +46,57 @@
</span><span class="cx">     const Segment&amp; segmentForPosition(unsigned) const;
</span><span class="cx">     const Segment&amp; segmentForRenderer(const RenderText&amp;) const;
</span><span class="cx"> 
</span><del>-    bool hasOneSegment() const { return m_segments.size() == 1; }
-    unsigned length() const { return m_segments.last().end; };
</del><ins>+    class Iterator {
+    public:
+        Iterator(const FlowContents&amp; flowContents, unsigned segmentIndex)
+            : m_flowContents(flowContents)
+            , m_segmentIndex(segmentIndex)
+        {
+        }
</ins><span class="cx"> 
</span><del>-    struct Style {
-        explicit Style(const RenderStyle&amp;);
</del><ins>+        Iterator&amp; operator++();
+        bool operator==(const Iterator&amp; other) const;
+        bool operator!=(const Iterator&amp; other) const;
+        const Segment&amp; operator*() const { return m_flowContents.m_segments[m_segmentIndex]; }
</ins><span class="cx"> 
</span><del>-        const FontCascade&amp; font;
-        ETextAlign textAlign;
-        bool collapseWhitespace;
-        bool preserveNewline;
-        bool wrapLines;
-        bool breakWordOnOverflow;
-        float spaceWidth;
-        unsigned tabWidth;
-        AtomicString locale;
</del><ins>+    private:
+        const FlowContents&amp; m_flowContents;
+        unsigned m_segmentIndex;
</ins><span class="cx">     };
</span><del>-    const Style&amp; style() const { return m_style; }
</del><span class="cx"> 
</span><del>-private:
-    unsigned findNextNonWhitespacePosition(unsigned position, unsigned&amp; spaceCount) const;
-    unsigned findNextBreakablePosition(unsigned position) const;
-    bool isLineBreak(unsigned position) const;
-    bool isEnd(unsigned position) const;
</del><ins>+    Iterator begin() const { return Iterator(*this, 0); }
+    Iterator end() const { return Iterator(*this, m_segments.size()); }
+
+    unsigned length() const { return m_segments.last().end; };
+
</ins><span class="cx">     unsigned segmentIndexForPosition(unsigned position) const;
</span><ins>+
+private:
</ins><span class="cx">     unsigned segmentIndexForPositionSlow(unsigned position) const;
</span><span class="cx"> 
</span><del>-    UChar characterAt(unsigned position) const;
-    template &lt;typename CharacterType&gt; float runWidth(const String&amp;, unsigned from, unsigned to, float xPosition) const;
-
-    const Style m_style;
</del><span class="cx">     const Vector&lt;Segment, 8&gt; m_segments;
</span><span class="cx"> 
</span><del>-    mutable LazyLineBreakIterator m_lineBreakIterator;
</del><span class="cx">     mutable unsigned m_lastSegmentIndex;
</span><del>-    unsigned m_position { 0 };
</del><span class="cx"> };
</span><span class="cx"> 
</span><del>-inline UChar FlowContents::characterAt(unsigned position) const
</del><ins>+inline FlowContents::Iterator&amp; FlowContents::Iterator::operator++()
</ins><span class="cx"> {
</span><del>-    auto&amp; segment = segmentForPosition(position);
-    return segment.text[position - segment.start];
</del><ins>+    ++m_segmentIndex;
+    return *this;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool FlowContents::isLineBreak(unsigned position) const
</del><ins>+inline bool FlowContents::Iterator::operator==(const FlowContents::Iterator&amp; other) const
</ins><span class="cx"> {
</span><del>-    if (isEnd(position))
-        return false;
-    return m_style.preserveNewline &amp;&amp; characterAt(position) == '\n';
</del><ins>+    return m_segmentIndex == other.m_segmentIndex;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline bool FlowContents::isEnd(unsigned position) const
</del><ins>+inline bool FlowContents::Iterator::operator!=(const FlowContents::Iterator&amp; other) const
</ins><span class="cx"> {
</span><del>-    return position &gt;= length();
</del><ins>+    return !(*this == other);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline unsigned FlowContents::segmentIndexForPosition(unsigned position) const
</span><span class="cx"> {
</span><del>-    ASSERT(!isEnd(position));
</del><span class="cx">     auto&amp; lastSegment = m_segments[m_lastSegmentIndex];
</span><span class="cx">     if (lastSegment.start &lt;= position &amp;&amp; position &lt; lastSegment.end)
</span><span class="cx">         return m_lastSegmentIndex;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingSimpleLineLayoutFlowContentsIteratorcppfromrev179283trunkSourceWebCorerenderingSimpleLineLayoutFlowContentscpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContentsIterator.cpp (from rev 179283, trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp) (0 => 179284)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContentsIterator.cpp                                (rev 0)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContentsIterator.cpp        2015-01-28 21:37:40 UTC (rev 179284)
</span><span class="lines">@@ -0,0 +1,201 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;SimpleLineLayoutFlowContentsIterator.h&quot;
+
+#include &quot;RenderBlockFlow.h&quot;
+#include &quot;RenderChildIterator.h&quot;
+#include &quot;RenderText.h&quot;
+#include &quot;SimpleLineLayoutFlowContents.h&quot;
+
+namespace WebCore {
+namespace SimpleLineLayout {
+
+FlowContentsIterator::Style::Style(const RenderStyle&amp; style)
+    : font(style.fontCascade())
+    , textAlign(style.textAlign())
+    , collapseWhitespace(style.collapseWhiteSpace())
+    , preserveNewline(style.preserveNewline())
+    , wrapLines(style.autoWrap())
+    , breakWordOnOverflow(style.overflowWrap() == BreakOverflowWrap &amp;&amp; (wrapLines || preserveNewline))
+    , spaceWidth(font.width(TextRun(&amp;space, 1)))
+    , tabWidth(collapseWhitespace ? 0 : style.tabSize())
+    , locale(style.locale())
+{
+}
+
+FlowContentsIterator::FlowContentsIterator(const RenderBlockFlow&amp; flow)
+    : m_flowContents(flow)
+    , m_lineBreakIterator((*m_flowContents.begin()).text, flow.style().locale())
+    , m_style(flow.style())
+{
+}
+
+FlowContentsIterator::TextFragment FlowContentsIterator::nextTextFragment(float xPosition)
+{
+    // A fragment can either be
+    // 1. new line character when preserveNewline is on (not considered as whitespace) or
+    // 2. whitespace (collasped, non-collapsed multi or single) or
+    // 3. non-whitespace characters.
+    // 4. empty, indicating content end.
+    TextFragment fragment;
+    fragment.start = m_position;
+    if (isEnd(fragment.start)) {
+        fragment.end = fragment.start;
+        return fragment;
+    }
+    if (isLineBreak(fragment.start)) {
+        fragment.type = TextFragment::LineBreak;
+        fragment.end = fragment.start + 1;
+        m_position = fragment.end;
+        return fragment;
+    }
+
+    unsigned spaceCount = 0;
+    unsigned whitespaceEnd = findNextNonWhitespacePosition(fragment.start, spaceCount);
+    ASSERT(fragment.start &lt;= whitespaceEnd);
+    if (fragment.start != whitespaceEnd) {
+        fragment.type = TextFragment::Whitespace;
+        fragment.end = whitespaceEnd;
+        bool multipleWhitespace = fragment.start + 1 &lt; fragment.end;
+        fragment.isCollapsed = multipleWhitespace &amp;&amp; m_style.collapseWhitespace;
+        fragment.isBreakable = !fragment.isCollapsed &amp;&amp; multipleWhitespace;
+        if (fragment.isCollapsed)
+            fragment.width = m_style.spaceWidth;
+        else {
+            unsigned fragmentLength = fragment.end - fragment.start;
+            if (fragmentLength == spaceCount)
+                fragment.width = fragmentLength * m_style.spaceWidth;
+            else
+                fragment.width = textWidth(fragment.start, fragment.end, xPosition);
+        }
+        m_position = fragment.end;
+        return fragment;
+    }
+
+    fragment.type = TextFragment::NonWhitespace;
+    fragment.isBreakable = m_style.breakWordOnOverflow;
+    fragment.end = findNextBreakablePosition(fragment.start + 1);
+    fragment.width = textWidth(fragment.start, fragment.end, xPosition);
+    m_position = fragment.end;
+    return fragment;
+}
+
+float FlowContentsIterator::textWidth(unsigned from, unsigned to, float xPosition) const
+{
+    const auto&amp; fromSegment = m_flowContents.segmentForPosition(from);
+    if ((m_style.font.isFixedPitch() &amp;&amp; fromSegment.end &gt;= to) || (from == fromSegment.start &amp;&amp; to == fromSegment.end))
+        return fromSegment.renderer.width(from - fromSegment.start, to - from, m_style.font, xPosition, nullptr, nullptr);
+
+    const auto* segment = &amp;fromSegment;
+    float textWidth = 0;
+    unsigned fragmentEnd = 0;
+    while (true) {
+        fragmentEnd = std::min(to, segment-&gt;end);
+        textWidth += segment-&gt;text.is8Bit() ? runWidth&lt;LChar&gt;(segment-&gt;text, from - segment-&gt;start, fragmentEnd - segment-&gt;start, xPosition + textWidth) :
+            runWidth&lt;UChar&gt;(segment-&gt;text, from - segment-&gt;start, fragmentEnd - segment-&gt;start, xPosition + textWidth);
+        if (fragmentEnd == to)
+            break;
+        from = fragmentEnd;
+        segment = &amp;m_flowContents.segmentForPosition(fragmentEnd);
+    };
+
+    return textWidth;
+}
+
+template &lt;typename CharacterType&gt;
+static unsigned nextBreakablePosition(LazyLineBreakIterator&amp; lineBreakIterator, const FlowContents::Segment&amp; segment, unsigned position)
+{
+    const auto* characters = segment.text.characters&lt;CharacterType&gt;();
+    unsigned segmentLength = segment.end - segment.start;
+    unsigned segmentPosition = position - segment.start;
+    return nextBreakablePositionNonLoosely&lt;CharacterType, NBSPBehavior::IgnoreNBSP&gt;(lineBreakIterator, characters, segmentLength, segmentPosition);
+}
+
+unsigned FlowContentsIterator::findNextBreakablePosition(unsigned position) const
+{
+    while (!isEnd(position)) {
+        auto&amp; segment = m_flowContents.segmentForPosition(position);
+        if (segment.text.impl() != m_lineBreakIterator.string().impl()) {
+            UChar lastCharacter = segment.start &gt; 0 ? characterAt(segment.start - 1) : 0;
+            UChar secondToLastCharacter = segment.start &gt; 1 ? characterAt(segment.start - 2) : 0;
+            m_lineBreakIterator.setPriorContext(lastCharacter, secondToLastCharacter);
+            m_lineBreakIterator.resetStringAndReleaseIterator(segment.text, m_style.locale, LineBreakIteratorModeUAX14);
+        }
+
+        unsigned breakable = segment.text.is8Bit() ? nextBreakablePosition&lt;LChar&gt;(m_lineBreakIterator, segment, position) : nextBreakablePosition&lt;UChar&gt;(m_lineBreakIterator, segment, position);
+        position = segment.start + breakable;
+        if (position &lt; segment.end)
+            break;
+    }
+    return position;
+}
+
+template &lt;typename CharacterType&gt;
+static bool findNextNonWhitespace(const FlowContents::Segment&amp; segment, const FlowContentsIterator::Style&amp; style, unsigned&amp; position, unsigned&amp; spaceCount)
+{
+    const auto* text = segment.text.characters&lt;CharacterType&gt;();
+    for (; position &lt; segment.end; ++position) {
+        auto character = text[position - segment.start];
+        bool isSpace = character == ' ';
+        bool isWhitespace = isSpace || character == '\t' || (!style.preserveNewline &amp;&amp; character == '\n');
+        if (!isWhitespace)
+            return true;
+        if (isSpace)
+            ++spaceCount;
+    }
+    return false;
+}
+
+unsigned FlowContentsIterator::findNextNonWhitespacePosition(unsigned position, unsigned&amp; spaceCount) const
+{
+    FlowContents::Iterator it(m_flowContents, m_flowContents.segmentIndexForPosition(position));
+    for (auto end = m_flowContents.end(); it != end; ++it) {
+        bool foundNonWhitespace = (*it).text.is8Bit() ? findNextNonWhitespace&lt;LChar&gt;(*it, m_style, position, spaceCount) : findNextNonWhitespace&lt;UChar&gt;(*it, m_style, position, spaceCount);
+        if (foundNonWhitespace)
+            break;
+    }
+    return position;
+}
+
+template &lt;typename CharacterType&gt;
+float FlowContentsIterator::runWidth(const String&amp; text, unsigned from, unsigned to, float xPosition) const
+{
+    ASSERT(from &lt; to);
+    bool measureWithEndSpace = m_style.collapseWhitespace &amp;&amp; to &lt; text.length() &amp;&amp; text[to] == ' ';
+    if (measureWithEndSpace)
+        ++to;
+    TextRun run(text.characters&lt;CharacterType&gt;() + from, to - from);
+    run.setXPos(xPosition);
+    run.setTabSize(!!m_style.tabWidth, m_style.tabWidth);
+    float width = m_style.font.width(run);
+    if (measureWithEndSpace)
+        width -= m_style.spaceWidth;
+    return width;
+}
+
+}
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorerenderingSimpleLineLayoutFlowContentsIteratorhfromrev179283trunkSourceWebCorerenderingSimpleLineLayoutFlowContentsh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContentsIterator.h (from rev 179283, trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h) (0 => 179284)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContentsIterator.h                                (rev 0)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContentsIterator.h        2015-01-28 21:37:40 UTC (rev 179284)
</span><span class="lines">@@ -0,0 +1,121 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SimpleLineLayoutFlowContentsIterator_h
+#define SimpleLineLayoutFlowContentsIterator_h
+
+#include &quot;RenderStyle.h&quot;
+#include &quot;SimpleLineLayoutFlowContents.h&quot;
+#include &quot;TextBreakIterator.h&quot;
+#include &quot;break_lines.h&quot;
+
+namespace WebCore {
+class RenderBlockFlow;
+
+namespace SimpleLineLayout {
+
+class FlowContentsIterator  {
+public:
+    FlowContentsIterator(const RenderBlockFlow&amp;);
+
+    struct TextFragment {
+        TextFragment() = default;
+        TextFragment(unsigned textStart, unsigned textEnd, float textWidth, bool isWhitespaceOnly)
+            : start(textStart)
+            , end(textEnd)
+            , type(isWhitespaceOnly ? Whitespace : NonWhitespace)
+            , width(textWidth)
+        {
+        }
+
+        bool isEmpty() const
+        {
+            return start == end;
+        }
+
+        enum Type { LineBreak, Whitespace, NonWhitespace };
+        unsigned start { 0 };
+        unsigned end  {0 };
+        Type type { NonWhitespace };
+        bool isCollapsed { false };
+        bool isBreakable { false };
+        float width { 0 };
+    };
+    TextFragment nextTextFragment(float xPosition = 0);
+    float textWidth(unsigned from, unsigned to, float xPosition) const;
+
+    struct Style {
+        explicit Style(const RenderStyle&amp;);
+
+        const FontCascade&amp; font;
+        ETextAlign textAlign;
+        bool collapseWhitespace;
+        bool preserveNewline;
+        bool wrapLines;
+        bool breakWordOnOverflow;
+        float spaceWidth;
+        unsigned tabWidth;
+        AtomicString locale;
+    };
+    const Style&amp; style() const { return m_style; }
+    // FIXME: remove splitRunsAtRendererBoundary()
+    const FlowContents::Segment&amp; segmentForPosition(unsigned position) const { return m_flowContents.segmentForPosition(position); };
+
+private:
+    unsigned findNextNonWhitespacePosition(unsigned position, unsigned&amp; spaceCount) const;
+    unsigned findNextBreakablePosition(unsigned position) const;
+    UChar characterAt(unsigned position) const;
+    bool isLineBreak(unsigned position) const;
+    bool isEnd(unsigned position) const;
+    template &lt;typename CharacterType&gt; float runWidth(const String&amp;, unsigned from, unsigned to, float xPosition) const;
+
+    FlowContents m_flowContents;
+    mutable LazyLineBreakIterator m_lineBreakIterator;
+    const Style m_style;
+    unsigned m_position { 0 };
+};
+
+inline UChar FlowContentsIterator::characterAt(unsigned position) const
+{
+    auto&amp; segment = m_flowContents.segmentForPosition(position);
+    return segment.text[position - segment.start];
+}
+
+inline bool FlowContentsIterator::isLineBreak(unsigned position) const
+{
+    if (isEnd(position))
+        return false;
+    return m_style.preserveNewline &amp;&amp; characterAt(position) == '\n';
+}
+
+inline bool FlowContentsIterator::isEnd(unsigned position) const
+{
+    return position &gt;= m_flowContents.length();
+}
+
+}
+}
+
+#endif
</ins></span></pre>
</div>
</div>

</body>
</html>