Simple line layout: Move simple line layout RunResolver and LineResolver implementati...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Nov 2014 16:20:18 +0000 (16:20 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 14 Nov 2014 16:20:18 +0000 (16:20 +0000)
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176123 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/rendering/SimpleLineLayoutResolver.cpp [new file with mode: 0644]
Source/WebCore/rendering/SimpleLineLayoutResolver.h

index 176a0d8..f0134a0 100644 (file)
@@ -2351,6 +2351,7 @@ set(WebCore_SOURCES
     rendering/ScrollBehavior.cpp
     rendering/SimpleLineLayout.cpp
     rendering/SimpleLineLayoutFunctions.cpp
+    rendering/SimpleLineLayoutResolver.cpp
     rendering/TextAutosizer.cpp
     rendering/TextPaintStyle.cpp
     rendering/TextPainter.cpp
index 8f7a257..ac1d0e4 100644 (file)
@@ -1,3 +1,45 @@
+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.
+
 2014-11-14  Andrzej Badowski  <a.badowski@samsung.com>
 
         AX: Improve AccessibilityTableCell isColumnHeaderCell function.
index c59584c..6be7bfa 100644 (file)
     <ClCompile Include="..\rendering\SelectionSubtreeRoot.cpp" />
     <ClCompile Include="..\rendering\SimpleLineLayout.cpp" />
     <ClCompile Include="..\rendering\SimpleLineLayoutFunctions.cpp" />
+    <ClCompile Include="..\rendering\SimpleLineLayoutResolver.cpp" />
     <ClCompile Include="..\rendering\TextPaintStyle.cpp" />
     <ClCompile Include="..\rendering\line\LineBreaker.cpp" />
     <ClCompile Include="..\rendering\line\LineInfo.cpp" />
index 52b0fb9..83aac37 100644 (file)
     <ClCompile Include="..\rendering\SimpleLineLayoutFunctions.cpp">
       <Filter>rendering</Filter>
     </ClCompile>
+    <ClCompile Include="..\rendering\SimpleLineLayoutResolver.cpp">
+      <Filter>rendering</Filter>
+    </ClCompile>
     <ClCompile Include="..\css\CSSGridTemplateAreasValue.cpp">
       <Filter>css</Filter>
     </ClCompile>
index 005beb2..c9308bf 100644 (file)
                57B791A414C6A62900F202D1 /* ContentDistributor.h in Headers */ = {isa = PBXBuildFile; fileRef = 57B791A014C6A62900F202D1 /* ContentDistributor.h */; settings = {ATTRIBUTES = (Private, ); }; };
                57CF497414EE36D700ECFF14 /* InsertionPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57CF497214EE36D700ECFF14 /* InsertionPoint.cpp */; };
                57CF497514EE36D700ECFF14 /* InsertionPoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 57CF497314EE36D700ECFF14 /* InsertionPoint.h */; };
+               585D6DFC1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 585D6DFB1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp */; };
                589556ED18D4A44000764B03 /* BorderEdge.h in Headers */ = {isa = PBXBuildFile; fileRef = 589556EC18D4A44000764B03 /* BorderEdge.h */; };
                58AEE2F418D4BCCF0022E7FE /* BorderEdge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 58AEE2F318D4BCCF0022E7FE /* BorderEdge.cpp */; };
                58CD35CB18EB4C3900B9F3AC /* FloatSizeHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 58CD35CA18EB4C3900B9F3AC /* FloatSizeHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
                57B791A014C6A62900F202D1 /* ContentDistributor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentDistributor.h; sourceTree = "<group>"; };
                57CF497214EE36D700ECFF14 /* InsertionPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InsertionPoint.cpp; sourceTree = "<group>"; };
                57CF497314EE36D700ECFF14 /* InsertionPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InsertionPoint.h; sourceTree = "<group>"; };
+               585D6DFB1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLineLayoutResolver.cpp; sourceTree = "<group>"; };
                589556EC18D4A44000764B03 /* BorderEdge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BorderEdge.h; sourceTree = "<group>"; };
                58AEE2F318D4BCCF0022E7FE /* BorderEdge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BorderEdge.cpp; sourceTree = "<group>"; };
                58CD35CA18EB4C3900B9F3AC /* FloatSizeHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FloatSizeHash.h; sourceTree = "<group>"; };
                                E48944A1180B57D800F165D8 /* SimpleLineLayout.h */,
                                E4E9B11A18145692003ACCDF /* SimpleLineLayoutFunctions.cpp */,
                                E4E9B11C1814569C003ACCDF /* SimpleLineLayoutFunctions.h */,
+                               585D6DFB1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp */,
                                E4E9B1181810916F003ACCDF /* SimpleLineLayoutResolver.h */,
                                A8CFF04C0A154F09000A4234 /* TableLayout.h */,
                                0F54DCE31881051D003EEDBB /* TextAutoSizing.cpp */,
                                E1ADED470E76B8DD004A1A5E /* JSMessagePortCustom.cpp in Sources */,
                                A86629D209DA2B48009633A5 /* JSMouseEvent.cpp in Sources */,
                                C6F420A216B7164E0052A9F2 /* JSMutationCallback.cpp in Sources */,
+                               585D6DFC1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp in Sources */,
                                65DF31FB09D1CC60000BE325 /* JSMutationEvent.cpp in Sources */,
                                C6F0902C14327D4F00685849 /* JSMutationObserver.cpp in Sources */,
                                C6F0917F143A2BB900685849 /* JSMutationObserverCustom.cpp in Sources */,
diff --git a/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp b/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp
new file mode 100644 (file)
index 0000000..ccb4528
--- /dev/null
@@ -0,0 +1,161 @@
+/*
+ * 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)
+{
+}
+
+}
+}
index bd923ad..9227319 100644 (file)
@@ -147,11 +147,6 @@ private:
 RunResolver runResolver(const RenderBlockFlow&, const Layout&);
 LineResolver lineResolver(const RenderBlockFlow&, const Layout&);
 
-inline RunResolver::Run::Run(const Iterator& iterator)
-    : m_iterator(iterator)
-{
-}
-
 inline unsigned RunResolver::Run::start() const
 {
     return m_iterator.simpleRun().start;
@@ -162,45 +157,11 @@ inline unsigned RunResolver::Run::end() const
     return m_iterator.simpleRun().end;
 }
 
-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);
-}
-
 inline unsigned RunResolver::Run::lineIndex() const
 {
     return m_iterator.lineIndex();
 }
 
-inline RunResolver::Iterator::Iterator(const RunResolver& resolver, unsigned runIndex, unsigned lineIndex)
-    : m_resolver(resolver)
-    , m_runIndex(runIndex)
-    , m_lineIndex(lineIndex)
-{
-}
-
 inline RunResolver::Iterator& RunResolver::Iterator::operator++()
 {
     return advance();
@@ -222,45 +183,11 @@ inline RunResolver::Run RunResolver::Iterator::operator*() const
     return Run(*this);
 }
 
-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;
-}
-
 inline const SimpleLineLayout::Run& RunResolver::Iterator::simpleRun() const
 {
     return m_resolver.m_layout.runAt(m_runIndex);
 }
 
-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())
-{
-}
-
 inline RunResolver::Iterator RunResolver::begin() const
 {
     return Iterator(*this, 0, 0);
@@ -271,41 +198,6 @@ inline RunResolver::Iterator RunResolver::end() const
     return Iterator(*this, m_layout.runCount(), m_layout.lineCount());
 }
 
-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)
-{
-}
-
 inline LineResolver::Iterator& LineResolver::Iterator::operator++()
 {
     m_runIterator.advanceLines(1);
@@ -322,22 +214,6 @@ inline bool LineResolver::Iterator::operator!=(const Iterator& other) const
     return m_runIterator != other.m_runIterator;
 }
 
-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)
-{
-}
-
 inline LineResolver::Iterator LineResolver::begin() const
 {
     return Iterator(m_runResolver.begin());