<!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>[176235] 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/176235">176235</a></dd>
<dt>Author</dt> <dd>zalan@apple.com</dd>
<dt>Date</dt> <dd>2014-11-17 15:17:51 -0800 (Mon, 17 Nov 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Simple line layout: Rename FlowContentIterator and move implementation to SimpleLineLayoutFlowContents.cpp
https://bugs.webkit.org/show_bug.cgi?id=138799

Reviewed by Antti Koivisto.

This is in preparation to support multiple renderers.
The FlowContents class will be used not just when we create runs, but also when we resolve them at painting time.

No change in functionality.

* CMakeLists.txt:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::removeTrailingWhitespace):
(WebCore::SimpleLineLayout::initializeNewLine):
(WebCore::SimpleLineLayout::splitFragmentToFitLine):
(WebCore::SimpleLineLayout::nextFragment):
(WebCore::SimpleLineLayout::createLineRuns):
(WebCore::SimpleLineLayout::closeLineEndingAndAdjustRuns):
(WebCore::SimpleLineLayout::createTextRuns):
(WebCore::SimpleLineLayout::FlowContentIterator::FlowContentIterator): Deleted.
(WebCore::SimpleLineLayout::FlowContentIterator::findNextBreakablePosition): Deleted.
(WebCore::SimpleLineLayout::FlowContentIterator::findNextNonWhitespacePosition): Deleted.
(WebCore::SimpleLineLayout::FlowContentIterator::textWidth): Deleted.
(WebCore::SimpleLineLayout::FlowContentIterator::isNewlineCharacter): Deleted.
(WebCore::SimpleLineLayout::FlowContentIterator::isEndOfContent): Deleted.
(WebCore::SimpleLineLayout::FlowContentIterator::style): Deleted.
(WebCore::SimpleLineLayout::computeLineLeft): Deleted.
* rendering/SimpleLineLayoutFlowContents.cpp: Added.
(WebCore::SimpleLineLayout::FlowContents::FlowContents):
(WebCore::SimpleLineLayout::FlowContents::findNextBreakablePosition):
(WebCore::SimpleLineLayout::FlowContents::findNextNonWhitespacePosition):
(WebCore::SimpleLineLayout::FlowContents::textWidth):
* rendering/SimpleLineLayoutFlowContents.h: Added.
(WebCore::SimpleLineLayout::FlowContents::Style::Style):
(WebCore::SimpleLineLayout::FlowContents::style):
(WebCore::SimpleLineLayout::FlowContents::isNewlineCharacter):
(WebCore::SimpleLineLayout::FlowContents::isEndOfContent):</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>
</ul>

<h3>Added Paths</h3>
<ul>
<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>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (176234 => 176235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2014-11-17 22:36:19 UTC (rev 176234)
+++ trunk/Source/WebCore/CMakeLists.txt        2014-11-17 23:17:51 UTC (rev 176235)
</span><span class="lines">@@ -2350,6 +2350,7 @@
</span><span class="cx">     rendering/SelectionSubtreeRoot.cpp
</span><span class="cx">     rendering/ScrollBehavior.cpp
</span><span class="cx">     rendering/SimpleLineLayout.cpp
</span><ins>+    rendering/SimpleLineLayoutFlowContents.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 (176234 => 176235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-11-17 22:36:19 UTC (rev 176234)
+++ trunk/Source/WebCore/ChangeLog        2014-11-17 23:17:51 UTC (rev 176235)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2014-11-17  Zalan Bujtas  &lt;zalan@apple.com&gt;
+
+        Simple line layout: Rename FlowContentIterator and move implementation to SimpleLineLayoutFlowContents.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=138799
+
+        Reviewed by Antti Koivisto.
+
+        This is in preparation to support multiple renderers.
+        The FlowContents class will be used not just when we create runs, but also when we resolve them at painting time.
+
+        No change in functionality.
+
+        * CMakeLists.txt:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        * rendering/SimpleLineLayout.cpp:
+        (WebCore::SimpleLineLayout::removeTrailingWhitespace):
+        (WebCore::SimpleLineLayout::initializeNewLine):
+        (WebCore::SimpleLineLayout::splitFragmentToFitLine):
+        (WebCore::SimpleLineLayout::nextFragment):
+        (WebCore::SimpleLineLayout::createLineRuns):
+        (WebCore::SimpleLineLayout::closeLineEndingAndAdjustRuns):
+        (WebCore::SimpleLineLayout::createTextRuns):
+        (WebCore::SimpleLineLayout::FlowContentIterator::FlowContentIterator): Deleted.
+        (WebCore::SimpleLineLayout::FlowContentIterator::findNextBreakablePosition): Deleted.
+        (WebCore::SimpleLineLayout::FlowContentIterator::findNextNonWhitespacePosition): Deleted.
+        (WebCore::SimpleLineLayout::FlowContentIterator::textWidth): Deleted.
+        (WebCore::SimpleLineLayout::FlowContentIterator::isNewlineCharacter): Deleted.
+        (WebCore::SimpleLineLayout::FlowContentIterator::isEndOfContent): Deleted.
+        (WebCore::SimpleLineLayout::FlowContentIterator::style): Deleted.
+        (WebCore::SimpleLineLayout::computeLineLeft): Deleted.
+        * rendering/SimpleLineLayoutFlowContents.cpp: Added.
+        (WebCore::SimpleLineLayout::FlowContents::FlowContents):
+        (WebCore::SimpleLineLayout::FlowContents::findNextBreakablePosition):
+        (WebCore::SimpleLineLayout::FlowContents::findNextNonWhitespacePosition):
+        (WebCore::SimpleLineLayout::FlowContents::textWidth):
+        * rendering/SimpleLineLayoutFlowContents.h: Added.
+        (WebCore::SimpleLineLayout::FlowContents::Style::Style):
+        (WebCore::SimpleLineLayout::FlowContents::style):
+        (WebCore::SimpleLineLayout::FlowContents::isNewlineCharacter):
+        (WebCore::SimpleLineLayout::FlowContents::isEndOfContent):
+
</ins><span class="cx"> 2014-11-17  Daniel Bates  &lt;dabates@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r176232.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (176234 => 176235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2014-11-17 22:36:19 UTC (rev 176234)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2014-11-17 23:17:51 UTC (rev 176235)
</span><span class="lines">@@ -11510,6 +11510,7 @@
</span><span class="cx">     &lt;/ClCompile&gt;
</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><ins>+    &lt;ClCompile Include=&quot;..\rendering\SimpleLineLayoutFlowContents.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 (176234 => 176235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2014-11-17 22:36:19 UTC (rev 176234)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2014-11-17 23:17:51 UTC (rev 176235)
</span><span class="lines">@@ -6934,6 +6934,9 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\rendering\SimpleLineLayout.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\SimpleLineLayoutFlowContents.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 (176234 => 176235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-11-17 22:36:19 UTC (rev 176234)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-11-17 23:17:51 UTC (rev 176235)
</span><span class="lines">@@ -2062,6 +2062,8 @@
</span><span class="cx">                 57CF497414EE36D700ECFF14 /* InsertionPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57CF497214EE36D700ECFF14 /* InsertionPoint.cpp */; };
</span><span class="cx">                 57CF497514EE36D700ECFF14 /* InsertionPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 57CF497314EE36D700ECFF14 /* InsertionPoint.h */; };
</span><span class="cx">                 585D6DFC1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 585D6DFB1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp */; };
</span><ins>+                585D6E031A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 585D6E011A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.cpp */; };
+                585D6E041A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.h in Headers */ = {isa = PBXBuildFile; fileRef = 585D6E021A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.h */; };
</ins><span class="cx">                 589556ED18D4A44000764B03 /* BorderEdge.h in Headers */ = {isa = PBXBuildFile; fileRef = 589556EC18D4A44000764B03 /* BorderEdge.h */; };
</span><span class="cx">                 58AEE2F418D4BCCF0022E7FE /* BorderEdge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 58AEE2F318D4BCCF0022E7FE /* BorderEdge.cpp */; };
</span><span class="cx">                 58CD35CB18EB4C3900B9F3AC /* FloatSizeHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 58CD35CA18EB4C3900B9F3AC /* FloatSizeHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -9183,6 +9185,8 @@
</span><span class="cx">                 57CF497214EE36D700ECFF14 /* InsertionPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InsertionPoint.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 57CF497314EE36D700ECFF14 /* InsertionPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InsertionPoint.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 585D6DFB1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLineLayoutResolver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                585D6E011A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLineLayoutFlowContents.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                585D6E021A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleLineLayoutFlowContents.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 589556EC18D4A44000764B03 /* BorderEdge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BorderEdge.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 58AEE2F318D4BCCF0022E7FE /* BorderEdge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BorderEdge.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 58CD35CA18EB4C3900B9F3AC /* FloatSizeHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatSizeHash.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -22500,6 +22504,8 @@
</span><span class="cx">                                 CDCFABBB18C0AE31006F8450 /* SelectionSubtreeRoot.h */,
</span><span class="cx">                                 E48944A0180B57D800F165D8 /* SimpleLineLayout.cpp */,
</span><span class="cx">                                 E48944A1180B57D800F165D8 /* SimpleLineLayout.h */,
</span><ins>+                                585D6E011A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.cpp */,
+                                585D6E021A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.h */,
</ins><span class="cx">                                 E4E9B11A18145692003ACCDF /* SimpleLineLayoutFunctions.cpp */,
</span><span class="cx">                                 E4E9B11C1814569C003ACCDF /* SimpleLineLayoutFunctions.h */,
</span><span class="cx">                                 585D6DFB1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp */,
</span><span class="lines">@@ -25355,6 +25361,7 @@
</span><span class="cx">                                 D3A94A3B122DABAC00A37BBC /* MediaQueryListListener.h in Headers */,
</span><span class="cx">                                 D3AA10F4123A98AA0092152B /* MediaQueryMatcher.h in Headers */,
</span><span class="cx">                                 CEEFCD7A19DB31F7003876D7 /* MediaResourceLoader.h in Headers */,
</span><ins>+                                585D6E041A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.h in Headers */,
</ins><span class="cx">                                 CDBEAEAD19D92B6C00BEBA88 /* MediaSelectionGroupAVFObjC.h in Headers */,
</span><span class="cx">                                 070E09191875EEFC003A1D3C /* MediaSession.h in Headers */,
</span><span class="cx">                                 07F944161864D046005D31CB /* MediaSessionManager.h in Headers */,
</span><span class="lines">@@ -29776,6 +29783,7 @@
</span><span class="cx">                                 F55B3DDB1251F12D003EF269 /* TimeInputType.cpp in Sources */,
</span><span class="cx">                                 7553CFE9108F473F00EA281E /* TimelineRecordFactory.cpp in Sources */,
</span><span class="cx">                                 93309EA4099EB78C0056E581 /* Timer.cpp in Sources */,
</span><ins>+                                585D6E031A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.cpp in Sources */,
</ins><span class="cx">                                 E44613AF0CD6331000FADA75 /* TimeRanges.cpp in Sources */,
</span><span class="cx">                                 A1DE71321861322200734192 /* TouchConstructors.cpp in Sources */,
</span><span class="cx">                                 A1DE712D18612AC100734192 /* TouchEvents.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingSimpleLineLayoutcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/SimpleLineLayout.cpp (176234 => 176235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SimpleLineLayout.cpp        2014-11-17 22:36:19 UTC (rev 176234)
+++ trunk/Source/WebCore/rendering/SimpleLineLayout.cpp        2014-11-17 23:17:51 UTC (rev 176235)
</span><span class="lines">@@ -42,10 +42,10 @@
</span><span class="cx"> #include &quot;RenderTextControl.h&quot;
</span><span class="cx"> #include &quot;RenderView.h&quot;
</span><span class="cx"> #include &quot;Settings.h&quot;
</span><ins>+#include &quot;SimpleLineLayoutFlowContents.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><del>-#include &quot;break_lines.h&quot;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> namespace SimpleLineLayout {
</span><span class="lines">@@ -213,74 +213,6 @@
</span><span class="cx">     unsigned tabWidth;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-class FlowContentIterator {
-public:
-    FlowContentIterator(const RenderBlockFlow&amp; flow)
-        : m_flow(flow)
-        , m_style(flow.style())
-        , m_lineBreakIterator(downcast&lt;RenderText&gt;(*flow.firstChild()).text(), flow.style().locale())
-    {
-    }
-
-    unsigned findNextBreakablePosition(unsigned position)
-    {
-        String string = m_lineBreakIterator.string();
-        return nextBreakablePosition&lt;LChar, false&gt;(m_lineBreakIterator, string.characters8(), string.length(), position);
-    }
-
-    unsigned findNextNonWhitespacePosition(unsigned position, unsigned&amp; spaceCount) const
-    {
-        String string = m_lineBreakIterator.string();
-        unsigned length = string.length();
-        const LChar* text = string.characters8();
-        spaceCount = 0;
-        for (; position &lt; length; ++position) {
-            bool isSpace = text[position] == ' ';
-            if (!(isSpace || text[position] == '\t' || (!m_style.preserveNewline &amp;&amp; text[position] == '\n')))
-                return position;
-            if (isSpace)
-                ++spaceCount;
-        }
-        return length;
-    }
-
-    float textWidth(unsigned from, unsigned to, float xPosition) const
-    {
-        String string = m_lineBreakIterator.string();
-        unsigned length = string.length();
-        if (m_style.font.isFixedPitch() || (!from &amp;&amp; to == length)) {
-            const RenderText&amp; renderer = downcast&lt;RenderText&gt;(*m_flow.firstChild());
-            return renderer.width(from, to - from, m_style.font, xPosition, nullptr, nullptr);
-        }
-
-        TextRun run(string.characters8() + from, to - from);
-        run.setXPos(xPosition);
-        run.setCharactersLength(length - from);
-        run.setTabSize(!!m_style.tabWidth, m_style.tabWidth);
-        ASSERT(run.charactersLength() &gt;= run.length());
-        return m_style.font.width(run);
-    }
-
-    bool isNewlineCharacter(unsigned position) const
-    {
-        ASSERT(m_lineBreakIterator.string().length() &gt; position);
-        return m_lineBreakIterator.string().at(position) == '\n';
-    }
-
-    bool isEndOfContent(unsigned position) const
-    {
-        return position &gt;= m_lineBreakIterator.string().length();
-    }
-
-    const Style&amp; style() const { return m_style; }
-
-private:
-    const RenderBlockFlow&amp; m_flow;
-    Style m_style;
-    LazyLineBreakIterator m_lineBreakIterator;
-};
-
-
</del><span class="cx"> static float computeLineLeft(ETextAlign textAlign, float availableWidth, float committedWidth, float logicalLeftOffset)
</span><span class="cx"> {
</span><span class="cx">     float remainingWidth = availableWidth - committedWidth;
</span><span class="lines">@@ -437,9 +369,9 @@
</span><span class="cx">     TextFragment oveflowedFragment;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-static void removeTrailingWhitespace(LineState&amp; lineState, Layout::RunVector&amp; lineRuns, const FlowContentIterator&amp; contentIterator)
</del><ins>+static void removeTrailingWhitespace(LineState&amp; lineState, Layout::RunVector&amp; lineRuns, const FlowContents&amp; flowContents)
</ins><span class="cx"> {
</span><del>-    const auto&amp; style = contentIterator.style();
</del><ins>+    const auto&amp; style = flowContents.style();
</ins><span class="cx">     bool preWrap = style.wrapLines &amp;&amp; !style.collapseWhitespace;
</span><span class="cx">     // Trailing whitespace gets removed when we either collapse whitespace or pre-wrap is present.
</span><span class="cx">     if (!(style.collapseWhitespace || preWrap)) {
</span><span class="lines">@@ -474,14 +406,14 @@
</span><span class="cx">         lineState.removeCommittedTrailingWhitespace();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (contentIterator.isEndOfContent(lineState.position))
</del><ins>+    if (flowContents.isEndOfContent(lineState.position))
</ins><span class="cx">         return;
</span><span class="cx">     // If we skipped any whitespace and now the line end is a &quot;preserved&quot; newline, skip the newline too as we are wrapping the line here already.
</span><del>-    if (lastPosition != lineState.position &amp;&amp; style.preserveNewline &amp;&amp; contentIterator.isNewlineCharacter(lineState.position))
</del><ins>+    if (lastPosition != lineState.position &amp;&amp; style.preserveNewline &amp;&amp; flowContents.isNewlineCharacter(lineState.position))
</ins><span class="cx">         ++lineState.position;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void initializeNewLine(LineState&amp; lineState, const FlowContentIterator&amp; contentIterator, unsigned lineStartRunIndex)
</del><ins>+static void initializeNewLine(LineState&amp; lineState, const FlowContents&amp; flowContents, unsigned lineStartRunIndex)
</ins><span class="cx"> {
</span><span class="cx">     lineState.lineStartRunIndex = lineStartRunIndex;
</span><span class="cx">     // Skip leading whitespace if collapsing whitespace, unless there's an uncommitted fragment pushed from the previous line.
</span><span class="lines">@@ -493,12 +425,12 @@
</span><span class="cx">             lineState.jumpTo(lineState.oveflowedFragment.start, 0); // Start over with this fragment.
</span><span class="cx">     } else {
</span><span class="cx">         unsigned spaceCount = 0;
</span><del>-        lineState.jumpTo(contentIterator.style().collapseWhitespace ? contentIterator.findNextNonWhitespacePosition(lineState.position, spaceCount) : lineState.position, 0);
</del><ins>+        lineState.jumpTo(flowContents.style().collapseWhitespace ? flowContents.findNextNonWhitespacePosition(lineState.position, spaceCount) : lineState.position, 0);
</ins><span class="cx">     }
</span><span class="cx">     lineState.oveflowedFragment = TextFragment();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static TextFragment splitFragmentToFitLine(TextFragment&amp; fragmentToSplit, float availableWidth, bool keepAtLeastOneCharacter, const FlowContentIterator&amp; contentIterator)
</del><ins>+static TextFragment splitFragmentToFitLine(TextFragment&amp; fragmentToSplit, float availableWidth, bool keepAtLeastOneCharacter, const FlowContents&amp; flowContents)
</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="lines">@@ -517,7 +449,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 = contentIterator.textWidth(fragmentToSplit.start, middle + 1, 0);
</del><ins>+        width = flowContents.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">@@ -532,26 +464,26 @@
</span><span class="cx">         ++right;
</span><span class="cx">     TextFragment fragmentForNextLine(fragmentToSplit);
</span><span class="cx">     fragmentToSplit.end = right;
</span><del>-    fragmentToSplit.width = fragmentToSplit.isEmpty() ? 0 : contentIterator.textWidth(fragmentToSplit.start, right, 0);
</del><ins>+    fragmentToSplit.width = fragmentToSplit.isEmpty() ? 0 : flowContents.textWidth(fragmentToSplit.start, right, 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 TextFragment nextFragment(unsigned previousFragmentEnd, FlowContentIterator&amp; contentIterator, float xPosition)
</del><ins>+static TextFragment nextFragment(unsigned previousFragmentEnd, FlowContents&amp; flowContents, float xPosition)
</ins><span class="cx"> {
</span><span class="cx">     // A fragment can have
</span><span class="cx">     // 1. new line character when preserveNewline is on (not considered as whitespace) or
</span><span class="cx">     // 2. whitespace (collasped, non-collapsed multi or single) or
</span><span class="cx">     // 3. non-whitespace characters.
</span><del>-    const auto&amp; style = contentIterator.style();
</del><ins>+    const auto&amp; style = flowContents.style();
</ins><span class="cx">     TextFragment fragment;
</span><del>-    fragment.mustBreak = style.preserveNewline &amp;&amp; contentIterator.isNewlineCharacter(previousFragmentEnd);
</del><ins>+    fragment.mustBreak = style.preserveNewline &amp;&amp; flowContents.isNewlineCharacter(previousFragmentEnd);
</ins><span class="cx">     unsigned spaceCount = 0;
</span><span class="cx">     unsigned whitespaceEnd = previousFragmentEnd;
</span><span class="cx">     if (!fragment.mustBreak)
</span><del>-        whitespaceEnd = contentIterator.findNextNonWhitespacePosition(previousFragmentEnd, spaceCount);
</del><ins>+        whitespaceEnd = flowContents.findNextNonWhitespacePosition(previousFragmentEnd, spaceCount);
</ins><span class="cx">     fragment.isWhitespaceOnly = previousFragmentEnd &lt; whitespaceEnd;
</span><span class="cx">     fragment.start = previousFragmentEnd;
</span><span class="cx">     if (fragment.isWhitespaceOnly)
</span><span class="lines">@@ -559,7 +491,7 @@
</span><span class="cx">     else if (fragment.mustBreak)
</span><span class="cx">         fragment.end = fragment.start + 1;
</span><span class="cx">     else
</span><del>-        fragment.end = contentIterator.findNextBreakablePosition(previousFragmentEnd + 1);
</del><ins>+        fragment.end = flowContents.findNextBreakablePosition(previousFragmentEnd + 1);
</ins><span class="cx">     bool multiple = fragment.start + 1 &lt; fragment.end;
</span><span class="cx">     fragment.isCollapsedWhitespace = multiple &amp;&amp; fragment.isWhitespaceOnly &amp;&amp; style.collapseWhitespace;
</span><span class="cx">     // Non-collapsed whitespace or just plain words when &quot;break word on overflow&quot; is on can wrap.
</span><span class="lines">@@ -574,17 +506,17 @@
</span><span class="cx">     else if (fragmentLength == spaceCount) // Space only.
</span><span class="cx">         fragment.width = style.spaceWidth * spaceCount;
</span><span class="cx">     else
</span><del>-        fragment.width = contentIterator.textWidth(fragment.start, fragment.end, xPosition);
</del><ins>+        fragment.width = flowContents.textWidth(fragment.start, fragment.end, xPosition);
</ins><span class="cx">     return fragment;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool createLineRuns(LineState&amp; lineState, Layout::RunVector&amp; lineRuns, FlowContentIterator&amp; contentIterator)
</del><ins>+static bool createLineRuns(LineState&amp; lineState, Layout::RunVector&amp; lineRuns, FlowContents&amp; flowContents)
</ins><span class="cx"> {
</span><del>-    const auto&amp; style = contentIterator.style();
</del><ins>+    const auto&amp; style = flowContents.style();
</ins><span class="cx">     bool lineCanBeWrapped = style.wrapLines || style.breakWordOnOverflow;
</span><del>-    while (!contentIterator.isEndOfContent(lineState.position)) {
</del><ins>+    while (!flowContents.isEndOfContent(lineState.position)) {
</ins><span class="cx">         // Find the next text fragment. Start from the end of the previous fragment -current line end.
</span><del>-        TextFragment fragment = nextFragment(lineState.position, contentIterator, lineState.width());
</del><ins>+        TextFragment fragment = nextFragment(lineState.position, flowContents, lineState.width());
</ins><span class="cx">         if ((lineCanBeWrapped &amp;&amp; !lineState.fits(fragment.width)) || fragment.mustBreak) {
</span><span class="cx">             // Overflow wrapping behaviour:
</span><span class="cx">             // 1. Newline character: wraps the line unless it's treated as whitespace.
</span><span class="lines">@@ -606,7 +538,7 @@
</span><span class="cx">             } else if (fragment.isWhitespaceOnly || ((isFirstFragment &amp;&amp; style.breakWordOnOverflow) || !style.wrapLines)) { // !style.wrapLines: bug138102(preserve existing behavior)
</span><span class="cx">                 // Whitespace collapse is off or non-whitespace content. split the fragment; (modified)fragment -&gt; this lineState, oveflowedFragment -&gt; next line.
</span><span class="cx">                 // When this is the only (first) fragment, the first character stays on the line, even if it does not fit.
</span><del>-                lineState.oveflowedFragment = splitFragmentToFitLine(fragment, lineState.availableWidth - lineState.width(), isFirstFragment, contentIterator);
</del><ins>+                lineState.oveflowedFragment = splitFragmentToFitLine(fragment, lineState.availableWidth - lineState.width(), isFirstFragment, flowContents);
</ins><span class="cx">                 if (!fragment.isEmpty()) {
</span><span class="cx">                     // Whitespace fragments can get pushed entirely to the next line.
</span><span class="cx">                     lineState.addUncommitted(fragment);
</span><span class="lines">@@ -631,18 +563,18 @@
</span><span class="cx">             lineState.addUncommitted(fragment);
</span><span class="cx">     }
</span><span class="cx">     lineState.commitAndCreateRun(lineRuns);
</span><del>-    return contentIterator.isEndOfContent(lineState.position) &amp;&amp; lineState.oveflowedFragment.isEmpty();
</del><ins>+    return flowContents.isEndOfContent(lineState.position) &amp;&amp; lineState.oveflowedFragment.isEmpty();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void closeLineEndingAndAdjustRuns(LineState&amp; lineState, Layout::RunVector&amp; lineRuns, unsigned&amp; lineCount, const FlowContentIterator&amp; contentIterator)
</del><ins>+static void closeLineEndingAndAdjustRuns(LineState&amp; lineState, Layout::RunVector&amp; lineRuns, unsigned&amp; lineCount, const FlowContents&amp; flowContents)
</ins><span class="cx"> {
</span><span class="cx">     if (lineState.lineStartRunIndex == lineRuns.size())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     ASSERT(lineRuns.size());
</span><del>-    removeTrailingWhitespace(lineState, lineRuns, contentIterator);
</del><ins>+    removeTrailingWhitespace(lineState, lineRuns, flowContents);
</ins><span class="cx">     // Adjust runs' position by taking line's alignment into account.
</span><del>-    if (float lineLogicalLeft = computeLineLeft(contentIterator.style().textAlign, lineState.availableWidth, lineState.committedWidth, lineState.logicalLeftOffset)) {
</del><ins>+    if (float lineLogicalLeft = computeLineLeft(flowContents.style().textAlign, lineState.availableWidth, lineState.committedWidth, lineState.logicalLeftOffset)) {
</ins><span class="cx">         for (unsigned i = lineState.lineStartRunIndex; i &lt; lineRuns.size(); ++i) {
</span><span class="cx">             lineRuns[i].logicalLeft += lineLogicalLeft;
</span><span class="cx">             lineRuns[i].logicalRight += lineLogicalLeft;
</span><span class="lines">@@ -669,14 +601,14 @@
</span><span class="cx">     LayoutUnit lineHeight = lineHeightFromFlow(flow);
</span><span class="cx">     LineState lineState;
</span><span class="cx">     bool isEndOfContent = false;
</span><del>-    FlowContentIterator contentIterator = FlowContentIterator(flow);
</del><ins>+    FlowContents flowContents = FlowContents(flow);
</ins><span class="cx"> 
</span><span class="cx">     do {
</span><span class="cx">         flow.setLogicalHeight(lineHeight * lineCount + borderAndPaddingBefore);
</span><span class="cx">         updateLineConstrains(flow, lineState.availableWidth, lineState.logicalLeftOffset);
</span><del>-        initializeNewLine(lineState, contentIterator, runs.size());
-        isEndOfContent = createLineRuns(lineState, runs, contentIterator);
-        closeLineEndingAndAdjustRuns(lineState, runs, lineCount, contentIterator);
</del><ins>+        initializeNewLine(lineState, flowContents, runs.size());
+        isEndOfContent = createLineRuns(lineState, runs, flowContents);
+        closeLineEndingAndAdjustRuns(lineState, runs, lineCount, flowContents);
</ins><span class="cx">     } while (!isEndOfContent);
</span><span class="cx">     ASSERT(!lineState.uncommittedWidth);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingSimpleLineLayoutFlowContentscpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp (0 => 176235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp                                (rev 0)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.cpp        2014-11-17 23:17:51 UTC (rev 176235)
</span><span class="lines">@@ -0,0 +1,81 @@
</span><ins>+/*
+ * Copyright (C) 2014 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;SimpleLineLayoutFlowContents.h&quot;
+
+#include &quot;RenderBlockFlow.h&quot;
+
+namespace WebCore {
+namespace SimpleLineLayout {
+
+FlowContents::FlowContents(const RenderBlockFlow&amp; flow)
+    : m_flow(flow)
+    , m_style(flow.style())
+    , m_lineBreakIterator(downcast&lt;RenderText&gt;(*flow.firstChild()).text(), flow.style().locale())
+{
+}
+
+unsigned FlowContents::findNextBreakablePosition(unsigned position)
+{
+    String string = m_lineBreakIterator.string();
+    return nextBreakablePosition&lt;LChar, false&gt;(m_lineBreakIterator, string.characters8(), string.length(), position);
+}
+
+unsigned FlowContents::findNextNonWhitespacePosition(unsigned position, unsigned&amp; spaceCount) const
+{
+    String string = m_lineBreakIterator.string();
+    unsigned length = string.length();
+    const LChar* text = string.characters8();
+    spaceCount = 0;
+    for (; position &lt; length; ++position) {
+        bool isSpace = text[position] == ' ';
+        if (!(isSpace || text[position] == '\t' || (!m_style.preserveNewline &amp;&amp; text[position] == '\n')))
+            return position;
+        if (isSpace)
+            ++spaceCount;
+    }
+    return length;
+}
+
+float FlowContents::textWidth(unsigned from, unsigned to, float xPosition) const
+{
+    String string = m_lineBreakIterator.string();
+    unsigned length = string.length();
+    if (m_style.font.isFixedPitch() || (!from &amp;&amp; to == length)) {
+        const RenderText&amp; renderer = downcast&lt;RenderText&gt;(*m_flow.firstChild());
+        return renderer.width(from, to - from, m_style.font, xPosition, nullptr, nullptr);
+    }
+
+    TextRun run(string.characters8() + from, to - from);
+    run.setXPos(xPosition);
+    run.setCharactersLength(length - from);
+    run.setTabSize(!!m_style.tabWidth, m_style.tabWidth);
+    ASSERT(run.charactersLength() &gt;= run.length());
+    return m_style.font.width(run);
+}
+
+}
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorerenderingSimpleLineLayoutFlowContentsh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h (0 => 176235)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h                                (rev 0)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutFlowContents.h        2014-11-17 23:17:51 UTC (rev 176235)
</span><span class="lines">@@ -0,0 +1,99 @@
</span><ins>+/*
+ * Copyright (C) 2014 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 SimpleLineLayoutFlowContents_h
+#define SimpleLineLayoutFlowContents_h
+
+#include &quot;Font.h&quot;
+#include &quot;RenderStyle.h&quot;
+#include &quot;TextBreakIterator.h&quot;
+#include &quot;break_lines.h&quot;
+
+namespace WebCore {
+class RenderBlockFlow;
+
+namespace SimpleLineLayout {
+
+class FlowContents {
+public:
+    FlowContents(const RenderBlockFlow&amp;);
+
+    unsigned findNextBreakablePosition(unsigned position);
+    unsigned findNextNonWhitespacePosition(unsigned position, unsigned&amp; spaceCount) const;
+
+    float textWidth(unsigned from, unsigned to, float xPosition) const;
+
+    bool isNewlineCharacter(unsigned position) const;
+    bool isEndOfContent(unsigned position) const;
+
+    class Style {
+    public:
+        Style(const RenderStyle&amp; style)
+            : font(style.font())
+            , 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())
+        {
+        }
+
+        const Font&amp; font;
+        ETextAlign textAlign;
+        bool collapseWhitespace;
+        bool preserveNewline;
+        bool wrapLines;
+        bool breakWordOnOverflow;
+        float spaceWidth;
+        unsigned tabWidth;
+    };
+    const Style&amp; style() const { return m_style; }
+
+private:
+    unsigned nextNonWhitespacePosition(unsigned position, unsigned&amp; spaceCount) const;
+    float runWidth(unsigned from, unsigned to, float xPosition) const;
+
+    const RenderBlockFlow&amp; m_flow;
+    Style m_style;
+    LazyLineBreakIterator m_lineBreakIterator;
+};
+
+inline bool FlowContents::isNewlineCharacter(unsigned position) const
+{
+    ASSERT(m_lineBreakIterator.string().length() &gt; position);
+    return m_lineBreakIterator.string().at(position) == '\n';
+}
+
+inline bool FlowContents::isEndOfContent(unsigned position) const
+{
+    return position &gt;= m_lineBreakIterator.string().length();
+}
+
+}
+}
+
+#endif
</ins></span></pre>
</div>
</div>

</body>
</html>