<!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>[176123] 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/176123">176123</a></dd>
<dt>Author</dt> <dd>zalan@apple.com</dd>
<dt>Date</dt> <dd>2014-11-14 08:20:18 -0800 (Fri, 14 Nov 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Simple line layout: Move simple line layout RunResolver and LineResolver implementation to SimpleLineLayoutResolver.cpp
https://bugs.webkit.org/show_bug.cgi?id=138704
Reviewed by Antti Koivisto.
No change in functionality.
* CMakeLists.txt:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* rendering/SimpleLineLayoutResolver.cpp: Added.
(WebCore::SimpleLineLayout::RunResolver::Run::Run):
(WebCore::SimpleLineLayout::RunResolver::Run::rect):
(WebCore::SimpleLineLayout::RunResolver::Run::baseline):
(WebCore::SimpleLineLayout::RunResolver::Run::text):
(WebCore::SimpleLineLayout::RunResolver::Iterator::Iterator):
(WebCore::SimpleLineLayout::RunResolver::Iterator::advance):
(WebCore::SimpleLineLayout::RunResolver::Iterator::advanceLines):
(WebCore::SimpleLineLayout::RunResolver::RunResolver):
(WebCore::SimpleLineLayout::RunResolver::lineIndexForHeight):
(WebCore::SimpleLineLayout::RunResolver::rangeForRect):
(WebCore::SimpleLineLayout::LineResolver::Iterator::Iterator):
(WebCore::SimpleLineLayout::LineResolver::Iterator::operator*):
(WebCore::SimpleLineLayout::LineResolver::LineResolver):
* rendering/SimpleLineLayoutResolver.h:
(WebCore::SimpleLineLayout::RunResolver::Run::Run): Deleted.
(WebCore::SimpleLineLayout::RunResolver::Run::rect): Deleted.
(WebCore::SimpleLineLayout::RunResolver::Run::baseline): Deleted.
(WebCore::SimpleLineLayout::RunResolver::Run::text): Deleted.
(WebCore::SimpleLineLayout::RunResolver::Iterator::Iterator): Deleted.
(WebCore::SimpleLineLayout::RunResolver::Iterator::advance): Deleted.
(WebCore::SimpleLineLayout::RunResolver::Iterator::advanceLines): Deleted.
(WebCore::SimpleLineLayout::RunResolver::RunResolver): Deleted.
(WebCore::SimpleLineLayout::RunResolver::lineIndexForHeight): Deleted.
(WebCore::SimpleLineLayout::RunResolver::rangeForRect): Deleted.
(WebCore::SimpleLineLayout::LineResolver::Iterator::Iterator): Deleted.
(WebCore::SimpleLineLayout::LineResolver::Iterator::operator*): Deleted.
(WebCore::SimpleLineLayout::LineResolver::LineResolver): Deleted.</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="#trunkSourceWebCorerenderingSimpleLineLayoutResolverh">trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorerenderingSimpleLineLayoutResolvercpp">trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (176122 => 176123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2014-11-14 11:27:54 UTC (rev 176122)
+++ trunk/Source/WebCore/CMakeLists.txt        2014-11-14 16:20:18 UTC (rev 176123)
</span><span class="lines">@@ -2351,6 +2351,7 @@
</span><span class="cx"> rendering/ScrollBehavior.cpp
</span><span class="cx"> rendering/SimpleLineLayout.cpp
</span><span class="cx"> rendering/SimpleLineLayoutFunctions.cpp
</span><ins>+ rendering/SimpleLineLayoutResolver.cpp
</ins><span class="cx"> rendering/TextAutosizer.cpp
</span><span class="cx"> rendering/TextPaintStyle.cpp
</span><span class="cx"> rendering/TextPainter.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (176122 => 176123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-11-14 11:27:54 UTC (rev 176122)
+++ trunk/Source/WebCore/ChangeLog        2014-11-14 16:20:18 UTC (rev 176123)
</span><span class="lines">@@ -1,3 +1,45 @@
</span><ins>+2014-11-14 Zalan Bujtas <zalan@apple.com>
+
+ Simple line layout: Move simple line layout RunResolver and LineResolver implementation to SimpleLineLayoutResolver.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=138704
+
+ Reviewed by Antti Koivisto.
+
+ No change in functionality.
+
+ * CMakeLists.txt:
+ * WebCore.vcxproj/WebCore.vcxproj:
+ * WebCore.vcxproj/WebCore.vcxproj.filters:
+ * WebCore.xcodeproj/project.pbxproj:
+ * rendering/SimpleLineLayoutResolver.cpp: Added.
+ (WebCore::SimpleLineLayout::RunResolver::Run::Run):
+ (WebCore::SimpleLineLayout::RunResolver::Run::rect):
+ (WebCore::SimpleLineLayout::RunResolver::Run::baseline):
+ (WebCore::SimpleLineLayout::RunResolver::Run::text):
+ (WebCore::SimpleLineLayout::RunResolver::Iterator::Iterator):
+ (WebCore::SimpleLineLayout::RunResolver::Iterator::advance):
+ (WebCore::SimpleLineLayout::RunResolver::Iterator::advanceLines):
+ (WebCore::SimpleLineLayout::RunResolver::RunResolver):
+ (WebCore::SimpleLineLayout::RunResolver::lineIndexForHeight):
+ (WebCore::SimpleLineLayout::RunResolver::rangeForRect):
+ (WebCore::SimpleLineLayout::LineResolver::Iterator::Iterator):
+ (WebCore::SimpleLineLayout::LineResolver::Iterator::operator*):
+ (WebCore::SimpleLineLayout::LineResolver::LineResolver):
+ * rendering/SimpleLineLayoutResolver.h:
+ (WebCore::SimpleLineLayout::RunResolver::Run::Run): Deleted.
+ (WebCore::SimpleLineLayout::RunResolver::Run::rect): Deleted.
+ (WebCore::SimpleLineLayout::RunResolver::Run::baseline): Deleted.
+ (WebCore::SimpleLineLayout::RunResolver::Run::text): Deleted.
+ (WebCore::SimpleLineLayout::RunResolver::Iterator::Iterator): Deleted.
+ (WebCore::SimpleLineLayout::RunResolver::Iterator::advance): Deleted.
+ (WebCore::SimpleLineLayout::RunResolver::Iterator::advanceLines): Deleted.
+ (WebCore::SimpleLineLayout::RunResolver::RunResolver): Deleted.
+ (WebCore::SimpleLineLayout::RunResolver::lineIndexForHeight): Deleted.
+ (WebCore::SimpleLineLayout::RunResolver::rangeForRect): Deleted.
+ (WebCore::SimpleLineLayout::LineResolver::Iterator::Iterator): Deleted.
+ (WebCore::SimpleLineLayout::LineResolver::Iterator::operator*): Deleted.
+ (WebCore::SimpleLineLayout::LineResolver::LineResolver): Deleted.
+
</ins><span class="cx"> 2014-11-14 Andrzej Badowski <a.badowski@samsung.com>
</span><span class="cx">
</span><span class="cx"> AX: Improve AccessibilityTableCell isColumnHeaderCell function.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (176122 => 176123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2014-11-14 11:27:54 UTC (rev 176122)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2014-11-14 16:20:18 UTC (rev 176123)
</span><span class="lines">@@ -11511,6 +11511,7 @@
</span><span class="cx"> <ClCompile Include="..\rendering\SelectionSubtreeRoot.cpp" />
</span><span class="cx"> <ClCompile Include="..\rendering\SimpleLineLayout.cpp" />
</span><span class="cx"> <ClCompile Include="..\rendering\SimpleLineLayoutFunctions.cpp" />
</span><ins>+ <ClCompile Include="..\rendering\SimpleLineLayoutResolver.cpp" />
</ins><span class="cx"> <ClCompile Include="..\rendering\TextPaintStyle.cpp" />
</span><span class="cx"> <ClCompile Include="..\rendering\line\LineBreaker.cpp" />
</span><span class="cx"> <ClCompile Include="..\rendering\line\LineInfo.cpp" />
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (176122 => 176123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2014-11-14 11:27:54 UTC (rev 176122)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2014-11-14 16:20:18 UTC (rev 176123)
</span><span class="lines">@@ -6937,6 +6937,9 @@
</span><span class="cx"> <ClCompile Include="..\rendering\SimpleLineLayoutFunctions.cpp">
</span><span class="cx"> <Filter>rendering</Filter>
</span><span class="cx"> </ClCompile>
</span><ins>+ <ClCompile Include="..\rendering\SimpleLineLayoutResolver.cpp">
+ <Filter>rendering</Filter>
+ </ClCompile>
</ins><span class="cx"> <ClCompile Include="..\css\CSSGridTemplateAreasValue.cpp">
</span><span class="cx"> <Filter>css</Filter>
</span><span class="cx"> </ClCompile>
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (176122 => 176123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-11-14 11:27:54 UTC (rev 176122)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-11-14 16:20:18 UTC (rev 176123)
</span><span class="lines">@@ -2058,6 +2058,7 @@
</span><span class="cx">                 57B791A414C6A62900F202D1 /* ContentDistributor.h in Headers */ = {isa = PBXBuildFile; fileRef = 57B791A014C6A62900F202D1 /* ContentDistributor.h */; settings = {ATTRIBUTES = (Private, ); }; };
</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><ins>+                585D6DFC1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 585D6DFB1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp */; };
</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">@@ -9171,6 +9172,7 @@
</span><span class="cx">                 57B791A014C6A62900F202D1 /* ContentDistributor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentDistributor.h; sourceTree = "<group>"; };
</span><span class="cx">                 57CF497214EE36D700ECFF14 /* InsertionPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InsertionPoint.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 57CF497314EE36D700ECFF14 /* InsertionPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InsertionPoint.h; sourceTree = "<group>"; };
</span><ins>+                585D6DFB1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLineLayoutResolver.cpp; sourceTree = "<group>"; };
</ins><span class="cx">                 589556EC18D4A44000764B03 /* BorderEdge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BorderEdge.h; sourceTree = "<group>"; };
</span><span class="cx">                 58AEE2F318D4BCCF0022E7FE /* BorderEdge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BorderEdge.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 58CD35CA18EB4C3900B9F3AC /* FloatSizeHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatSizeHash.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -22481,6 +22483,7 @@
</span><span class="cx">                                 E48944A1180B57D800F165D8 /* SimpleLineLayout.h */,
</span><span class="cx">                                 E4E9B11A18145692003ACCDF /* SimpleLineLayoutFunctions.cpp */,
</span><span class="cx">                                 E4E9B11C1814569C003ACCDF /* SimpleLineLayoutFunctions.h */,
</span><ins>+                                585D6DFB1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp */,
</ins><span class="cx">                                 E4E9B1181810916F003ACCDF /* SimpleLineLayoutResolver.h */,
</span><span class="cx">                                 A8CFF04C0A154F09000A4234 /* TableLayout.h */,
</span><span class="cx">                                 0F54DCE31881051D003EEDBB /* TextAutoSizing.cpp */,
</span><span class="lines">@@ -28413,6 +28416,7 @@
</span><span class="cx">                                 E1ADED470E76B8DD004A1A5E /* JSMessagePortCustom.cpp in Sources */,
</span><span class="cx">                                 A86629D209DA2B48009633A5 /* JSMouseEvent.cpp in Sources */,
</span><span class="cx">                                 C6F420A216B7164E0052A9F2 /* JSMutationCallback.cpp in Sources */,
</span><ins>+                                585D6DFC1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp in Sources */,
</ins><span class="cx">                                 65DF31FB09D1CC60000BE325 /* JSMutationEvent.cpp in Sources */,
</span><span class="cx">                                 C6F0902C14327D4F00685849 /* JSMutationObserver.cpp in Sources */,
</span><span class="cx">                                 C6F0917F143A2BB900685849 /* JSMutationObserverCustom.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingSimpleLineLayoutResolvercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp (0 => 176123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp         (rev 0)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp        2014-11-14 16:20:18 UTC (rev 176123)
</span><span class="lines">@@ -0,0 +1,161 @@
</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 "config.h"
+#include "SimpleLineLayoutResolver.h"
+
+#include "RenderBlockFlow.h"
+#include "RenderText.h"
+#include "SimpleLineLayoutFunctions.h"
+
+namespace WebCore {
+namespace SimpleLineLayout {
+
+RunResolver::Run::Run(const Iterator& iterator)
+ : m_iterator(iterator)
+{
+}
+
+LayoutRect RunResolver::Run::rect() const
+{
+ auto& resolver = m_iterator.resolver();
+ auto& run = m_iterator.simpleRun();
+
+ float baselinePosition = resolver.m_lineHeight * m_iterator.lineIndex() + resolver.m_baseline;
+ LayoutPoint linePosition(LayoutUnit::fromFloatFloor(run.logicalLeft), roundToInt(baselinePosition - resolver.m_ascent + resolver.m_borderAndPaddingBefore));
+ LayoutSize lineSize(LayoutUnit::fromFloatCeil(run.logicalRight) - LayoutUnit::fromFloatFloor(run.logicalLeft), resolver.m_ascent + resolver.m_descent);
+ return LayoutRect(linePosition, lineSize);
+}
+
+FloatPoint RunResolver::Run::baseline() const
+{
+ auto& resolver = m_iterator.resolver();
+ auto& run = m_iterator.simpleRun();
+
+ float baselinePosition = resolver.m_lineHeight * m_iterator.lineIndex() + resolver.m_baseline;
+ return FloatPoint(run.logicalLeft, roundToInt(baselinePosition + resolver.m_borderAndPaddingBefore));
+}
+
+StringView RunResolver::Run::text() const
+{
+ auto& resolver = m_iterator.resolver();
+ auto& run = m_iterator.simpleRun();
+ return StringView(resolver.m_string).substring(run.start, run.end - run.start);
+}
+
+RunResolver::Iterator::Iterator(const RunResolver& resolver, unsigned runIndex, unsigned lineIndex)
+ : m_resolver(resolver)
+ , m_runIndex(runIndex)
+ , m_lineIndex(lineIndex)
+{
+}
+
+RunResolver::Iterator& RunResolver::Iterator::advance()
+{
+ if (simpleRun().isEndOfLine)
+ ++m_lineIndex;
+ ++m_runIndex;
+ return *this;
+}
+
+RunResolver::Iterator& RunResolver::Iterator::advanceLines(unsigned lineCount)
+{
+ unsigned runCount = m_resolver.m_layout.runCount();
+ if (runCount == m_resolver.m_layout.lineCount()) {
+ m_runIndex = std::min(runCount, m_runIndex + lineCount);
+ m_lineIndex = m_runIndex;
+ return *this;
+ }
+ unsigned target = m_lineIndex + lineCount;
+ while (m_lineIndex < target && m_runIndex < runCount)
+ advance();
+
+ return *this;
+}
+
+RunResolver::RunResolver(const RenderBlockFlow& flow, const Layout& layout)
+ : m_layout(layout)
+ , m_string(downcast<RenderText>(*flow.firstChild()).text())
+ , m_lineHeight(lineHeightFromFlow(flow))
+ , m_baseline(baselineFromFlow(flow))
+ , m_borderAndPaddingBefore(flow.borderAndPaddingBefore())
+ , m_ascent(flow.style().font().fontMetrics().ascent())
+ , m_descent(flow.style().font().fontMetrics().descent())
+{
+}
+
+unsigned RunResolver::lineIndexForHeight(LayoutUnit height, IndexType type) const
+{
+ ASSERT(m_lineHeight);
+ float y = height - m_borderAndPaddingBefore;
+ // Lines may overlap, adjust to get the first or last line at this height.
+ if (type == IndexType::First)
+ y += m_lineHeight - (m_baseline + m_descent);
+ else
+ y -= m_baseline - m_ascent;
+ y = std::max<float>(y, 0);
+ return std::min<unsigned>(y / m_lineHeight, m_layout.lineCount() - 1);
+}
+
+Range<RunResolver::Iterator> RunResolver::rangeForRect(const LayoutRect& rect) const
+{
+ if (!m_lineHeight)
+ return Range<Iterator>(begin(), end());
+
+ unsigned firstLine = lineIndexForHeight(rect.y(), IndexType::First);
+ unsigned lastLine = std::max(firstLine, lineIndexForHeight(rect.maxY(), IndexType::Last));
+
+ auto rangeBegin = begin().advanceLines(firstLine);
+ if (rangeBegin == end())
+ return Range<Iterator>(end(), end());
+ auto rangeEnd = rangeBegin;
+ ASSERT(lastLine >= firstLine);
+ rangeEnd.advanceLines(lastLine - firstLine + 1);
+ return Range<Iterator>(rangeBegin, rangeEnd);
+}
+
+LineResolver::Iterator::Iterator(RunResolver::Iterator runIterator)
+ : m_runIterator(runIterator)
+{
+}
+
+const LayoutRect LineResolver::Iterator::operator*() const
+{
+ unsigned currentLine = m_runIterator.lineIndex();
+ auto it = m_runIterator;
+ LayoutRect rect = (*it).rect();
+ while (it.advance().lineIndex() == currentLine)
+ rect.unite((*it).rect());
+
+ return rect;
+}
+
+LineResolver::LineResolver(const RenderBlockFlow& flow, const Layout& layout)
+ : m_runResolver(flow, layout)
+{
+}
+
+}
+}
</ins></span></pre></div>
<a id="trunkSourceWebCorerenderingSimpleLineLayoutResolverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.h (176122 => 176123)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.h        2014-11-14 11:27:54 UTC (rev 176122)
+++ trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.h        2014-11-14 16:20:18 UTC (rev 176123)
</span><span class="lines">@@ -147,11 +147,6 @@
</span><span class="cx"> RunResolver runResolver(const RenderBlockFlow&, const Layout&);
</span><span class="cx"> LineResolver lineResolver(const RenderBlockFlow&, const Layout&);
</span><span class="cx">
</span><del>-inline RunResolver::Run::Run(const Iterator& iterator)
- : m_iterator(iterator)
-{
-}
-
</del><span class="cx"> inline unsigned RunResolver::Run::start() const
</span><span class="cx"> {
</span><span class="cx"> return m_iterator.simpleRun().start;
</span><span class="lines">@@ -162,45 +157,11 @@
</span><span class="cx"> return m_iterator.simpleRun().end;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-inline LayoutRect RunResolver::Run::rect() const
-{
- auto& resolver = m_iterator.resolver();
- auto& run = m_iterator.simpleRun();
-
- float baselinePosition = resolver.m_lineHeight * m_iterator.lineIndex() + resolver.m_baseline;
- LayoutPoint linePosition(LayoutUnit::fromFloatFloor(run.logicalLeft), roundToInt(baselinePosition - resolver.m_ascent + resolver.m_borderAndPaddingBefore));
- LayoutSize lineSize(LayoutUnit::fromFloatCeil(run.logicalRight) - LayoutUnit::fromFloatFloor(run.logicalLeft), resolver.m_ascent + resolver.m_descent);
- return LayoutRect(linePosition, lineSize);
-}
-
-inline FloatPoint RunResolver::Run::baseline() const
-{
- auto& resolver = m_iterator.resolver();
- auto& run = m_iterator.simpleRun();
-
- float baselinePosition = resolver.m_lineHeight * m_iterator.lineIndex() + resolver.m_baseline;
- return FloatPoint(run.logicalLeft, roundToInt(baselinePosition + resolver.m_borderAndPaddingBefore));
-}
-
-inline StringView RunResolver::Run::text() const
-{
- auto& resolver = m_iterator.resolver();
- auto& run = m_iterator.simpleRun();
- return StringView(resolver.m_string).substring(run.start, run.end - run.start);
-}
-
</del><span class="cx"> inline unsigned RunResolver::Run::lineIndex() const
</span><span class="cx"> {
</span><span class="cx"> return m_iterator.lineIndex();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-inline RunResolver::Iterator::Iterator(const RunResolver& resolver, unsigned runIndex, unsigned lineIndex)
- : m_resolver(resolver)
- , m_runIndex(runIndex)
- , m_lineIndex(lineIndex)
-{
-}
-
</del><span class="cx"> inline RunResolver::Iterator& RunResolver::Iterator::operator++()
</span><span class="cx"> {
</span><span class="cx"> return advance();
</span><span class="lines">@@ -222,45 +183,11 @@
</span><span class="cx"> return Run(*this);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-inline RunResolver::Iterator& RunResolver::Iterator::advance()
-{
- if (simpleRun().isEndOfLine)
- ++m_lineIndex;
- ++m_runIndex;
- return *this;
-}
-
-inline RunResolver::Iterator& RunResolver::Iterator::advanceLines(unsigned lineCount)
-{
- unsigned runCount = m_resolver.m_layout.runCount();
- if (runCount == m_resolver.m_layout.lineCount()) {
- m_runIndex = std::min(runCount, m_runIndex + lineCount);
- m_lineIndex = m_runIndex;
- return *this;
- }
- unsigned target = m_lineIndex + lineCount;
- while (m_lineIndex < target && m_runIndex < runCount)
- advance();
-
- return *this;
-}
-
</del><span class="cx"> inline const SimpleLineLayout::Run& RunResolver::Iterator::simpleRun() const
</span><span class="cx"> {
</span><span class="cx"> return m_resolver.m_layout.runAt(m_runIndex);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-inline RunResolver::RunResolver(const RenderBlockFlow& flow, const Layout& layout)
- : m_layout(layout)
- , m_string(downcast<RenderText>(*flow.firstChild()).text())
- , m_lineHeight(lineHeightFromFlow(flow))
- , m_baseline(baselineFromFlow(flow))
- , m_borderAndPaddingBefore(flow.borderAndPaddingBefore())
- , m_ascent(flow.style().font().fontMetrics().ascent())
- , m_descent(flow.style().font().fontMetrics().descent())
-{
-}
-
</del><span class="cx"> inline RunResolver::Iterator RunResolver::begin() const
</span><span class="cx"> {
</span><span class="cx"> return Iterator(*this, 0, 0);
</span><span class="lines">@@ -271,41 +198,6 @@
</span><span class="cx"> return Iterator(*this, m_layout.runCount(), m_layout.lineCount());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-inline unsigned RunResolver::lineIndexForHeight(LayoutUnit height, IndexType type) const
-{
- ASSERT(m_lineHeight);
- float y = height - m_borderAndPaddingBefore;
- // Lines may overlap, adjust to get the first or last line at this height.
- if (type == IndexType::First)
- y += m_lineHeight - (m_baseline + m_descent);
- else
- y -= m_baseline - m_ascent;
- y = std::max<float>(y, 0);
- return std::min<unsigned>(y / m_lineHeight, m_layout.lineCount() - 1);
-}
-
-inline Range<RunResolver::Iterator> RunResolver::rangeForRect(const LayoutRect& rect) const
-{
- if (!m_lineHeight)
- return Range<Iterator>(begin(), end());
-
- unsigned firstLine = lineIndexForHeight(rect.y(), IndexType::First);
- unsigned lastLine = std::max(firstLine, lineIndexForHeight(rect.maxY(), IndexType::Last));
-
- auto rangeBegin = begin().advanceLines(firstLine);
- if (rangeBegin == end())
- return Range<Iterator>(end(), end());
- auto rangeEnd = rangeBegin;
- ASSERT(lastLine >= firstLine);
- rangeEnd.advanceLines(lastLine - firstLine + 1);
- return Range<Iterator>(rangeBegin, rangeEnd);
-}
-
-inline LineResolver::Iterator::Iterator(RunResolver::Iterator runIterator)
- : m_runIterator(runIterator)
-{
-}
-
</del><span class="cx"> inline LineResolver::Iterator& LineResolver::Iterator::operator++()
</span><span class="cx"> {
</span><span class="cx"> m_runIterator.advanceLines(1);
</span><span class="lines">@@ -322,22 +214,6 @@
</span><span class="cx"> return m_runIterator != other.m_runIterator;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-inline const LayoutRect LineResolver::Iterator::operator*() const
-{
- unsigned currentLine = m_runIterator.lineIndex();
- auto it = m_runIterator;
- LayoutRect rect = (*it).rect();
- while (it.advance().lineIndex() == currentLine)
- rect.unite((*it).rect());
-
- return rect;
-}
-
-inline LineResolver::LineResolver(const RenderBlockFlow& flow, const Layout& layout)
- : m_runResolver(flow, layout)
-{
-}
-
</del><span class="cx"> inline LineResolver::Iterator LineResolver::begin() const
</span><span class="cx"> {
</span><span class="cx"> return Iterator(m_runResolver.begin());
</span></span></pre>
</div>
</div>
</body>
</html>