Simple line layout: Rename FlowContentsIterator to TextFragmentIterator.
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Feb 2015 03:08:33 +0000 (03:08 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Feb 2015 03:08:33 +0000 (03:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=141177

Rubber-stamped by Antti Koivisto

FlowContentsIterator is easy to confuse with FlowContents::Iterator.
TextFragmentIterator reflects the functionality better.

No change in functionality.

* CMakeLists.txt:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::LineState::setOverflowedFragment):
(WebCore::SimpleLineLayout::LineState::overflowedFragment):
(WebCore::SimpleLineLayout::LineState::appendFragment):
(WebCore::SimpleLineLayout::begin):
(WebCore::SimpleLineLayout::end):
(WebCore::SimpleLineLayout::preWrap):
(WebCore::SimpleLineLayout::removeTrailingWhitespace):
(WebCore::SimpleLineLayout::splitFragmentToFitLine):
(WebCore::SimpleLineLayout::firstFragment):
(WebCore::SimpleLineLayout::createLineRuns):
(WebCore::SimpleLineLayout::closeLineEndingAndAdjustRuns):
(WebCore::SimpleLineLayout::splitRunsAtRendererBoundary):
(WebCore::SimpleLineLayout::createTextRuns):
* rendering/SimpleLineLayoutTextFragmentIterator.cpp: Renamed from Source/WebCore/rendering/SimpleLineLayoutFlowContentsIterator.cpp.
(WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
(WebCore::SimpleLineLayout::TextFragmentIterator::TextFragmentIterator):
(WebCore::SimpleLineLayout::TextFragmentIterator::nextTextFragment):
(WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
(WebCore::SimpleLineLayout::nextBreakablePosition):
(WebCore::SimpleLineLayout::TextFragmentIterator::findNextBreakablePosition):
(WebCore::SimpleLineLayout::findNextNonWhitespace):
(WebCore::SimpleLineLayout::TextFragmentIterator::findNextNonWhitespacePosition):
(WebCore::SimpleLineLayout::TextFragmentIterator::runWidth):
* rendering/SimpleLineLayoutTextFragmentIterator.h: Renamed from Source/WebCore/rendering/SimpleLineLayoutFlowContentsIterator.h.
(WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::TextFragment):
(WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::start):
(WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::end):
(WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::width):
(WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::type):
(WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isCollapsed):
(WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isBreakable):
(WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isEmpty):
(WebCore::SimpleLineLayout::TextFragmentIterator::style):
(WebCore::SimpleLineLayout::TextFragmentIterator::segmentForPosition):
(WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::split):
(WebCore::SimpleLineLayout::TextFragmentIterator::characterAt):
(WebCore::SimpleLineLayout::TextFragmentIterator::isLineBreak):
(WebCore::SimpleLineLayout::TextFragmentIterator::isEnd):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179534 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/SimpleLineLayout.cpp
Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp [moved from Source/WebCore/rendering/SimpleLineLayoutFlowContentsIterator.cpp with 93% similarity]
Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h [moved from Source/WebCore/rendering/SimpleLineLayoutFlowContentsIterator.h with 86% similarity]

index d0fd1b9..bae7bea 100644 (file)
@@ -2351,7 +2351,7 @@ set(WebCore_SOURCES
     rendering/ScrollBehavior.cpp
     rendering/SimpleLineLayout.cpp
     rendering/SimpleLineLayoutFlowContents.cpp
-    rendering/SimpleLineLayoutFlowContentsIterator.cpp
+    rendering/SimpleLineLayoutTextFragmentIterator.cpp
     rendering/SimpleLineLayoutFunctions.cpp
     rendering/SimpleLineLayoutResolver.cpp
     rendering/TextAutosizer.cpp
index 7cf23c5..ae303af 100644 (file)
@@ -1,3 +1,59 @@
+2015-02-02  Zalan Bujtas  <zalan@apple.com>
+
+        Simple line layout: Rename FlowContentsIterator to TextFragmentIterator.
+        https://bugs.webkit.org/show_bug.cgi?id=141177
+
+        Rubber-stamped by Antti Koivisto
+
+        FlowContentsIterator is easy to confuse with FlowContents::Iterator.
+        TextFragmentIterator reflects the functionality better.
+
+        No change in functionality.
+
+        * CMakeLists.txt:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        * rendering/SimpleLineLayout.cpp:
+        (WebCore::SimpleLineLayout::LineState::setOverflowedFragment):
+        (WebCore::SimpleLineLayout::LineState::overflowedFragment):
+        (WebCore::SimpleLineLayout::LineState::appendFragment):
+        (WebCore::SimpleLineLayout::begin):
+        (WebCore::SimpleLineLayout::end):
+        (WebCore::SimpleLineLayout::preWrap):
+        (WebCore::SimpleLineLayout::removeTrailingWhitespace):
+        (WebCore::SimpleLineLayout::splitFragmentToFitLine):
+        (WebCore::SimpleLineLayout::firstFragment):
+        (WebCore::SimpleLineLayout::createLineRuns):
+        (WebCore::SimpleLineLayout::closeLineEndingAndAdjustRuns):
+        (WebCore::SimpleLineLayout::splitRunsAtRendererBoundary):
+        (WebCore::SimpleLineLayout::createTextRuns):
+        * rendering/SimpleLineLayoutTextFragmentIterator.cpp: Renamed from Source/WebCore/rendering/SimpleLineLayoutFlowContentsIterator.cpp.
+        (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragmentIterator):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::nextTextFragment):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::textWidth):
+        (WebCore::SimpleLineLayout::nextBreakablePosition):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::findNextBreakablePosition):
+        (WebCore::SimpleLineLayout::findNextNonWhitespace):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::findNextNonWhitespacePosition):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::runWidth):
+        * rendering/SimpleLineLayoutTextFragmentIterator.h: Renamed from Source/WebCore/rendering/SimpleLineLayoutFlowContentsIterator.h.
+        (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::TextFragment):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::start):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::end):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::width):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::type):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isCollapsed):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isBreakable):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::isEmpty):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::style):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::segmentForPosition):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::TextFragment::split):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::characterAt):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::isLineBreak):
+        (WebCore::SimpleLineLayout::TextFragmentIterator::isEnd):
+
 2015-02-02  Chris Dumez  <cdumez@apple.com>
 
         Add diagnostic logging for ResourceResponse's source
index f860018..847a9ce 100644 (file)
     <ClCompile Include="..\rendering\SelectionSubtreeRoot.cpp" />
     <ClCompile Include="..\rendering\SimpleLineLayout.cpp" />
     <ClCompile Include="..\rendering\SimpleLineLayoutFlowContents.cpp" />
-    <ClCompile Include="..\rendering\SimpleLineLayoutFlowContentsIterator.cpp" />
+    <ClCompile Include="..\rendering\SimpleLineLayoutTextFragmentIterator.cpp" />
     <ClCompile Include="..\rendering\SimpleLineLayoutFunctions.cpp" />
     <ClCompile Include="..\rendering\SimpleLineLayoutResolver.cpp" />
     <ClCompile Include="..\rendering\TextPaintStyle.cpp" />
index 6d405ac..7328ce9 100644 (file)
     <ClCompile Include="..\rendering\SimpleLineLayoutFlowContents.cpp">
       <Filter>rendering</Filter>
     </ClCompile>
-    <ClCompile Include="..\rendering\SimpleLineLayoutFlowContentsIterator.cpp">
+    <ClCompile Include="..\rendering\SimpleLineLayoutTextFragmentIterator.cpp">
       <Filter>rendering</Filter>
     </ClCompile>
     <ClCompile Include="..\rendering\SimpleLineLayoutFunctions.cpp">
index d04b049..ec2d8c5 100644 (file)
                580371611A66F00A00BAF519 /* ClipRect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5803715F1A66F00A00BAF519 /* ClipRect.cpp */; };
                580371621A66F00A00BAF519 /* ClipRect.h in Headers */ = {isa = PBXBuildFile; fileRef = 580371601A66F00A00BAF519 /* ClipRect.h */; settings = {ATTRIBUTES = (Private, ); }; };
                580371641A66F1D300BAF519 /* LayerFragment.h in Headers */ = {isa = PBXBuildFile; fileRef = 580371631A66F1D300BAF519 /* LayerFragment.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               582CB0531A78A14B00AFFCC4 /* SimpleLineLayoutFlowContentsIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 582CB0521A78A14B00AFFCC4 /* SimpleLineLayoutFlowContentsIterator.h */; };
-               582CB0551A78A2B200AFFCC4 /* SimpleLineLayoutFlowContentsIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 582CB0541A78A2B200AFFCC4 /* SimpleLineLayoutFlowContentsIterator.cpp */; };
+               582CB0531A78A14B00AFFCC4 /* SimpleLineLayoutTextFragmentIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 582CB0521A78A14B00AFFCC4 /* SimpleLineLayoutTextFragmentIterator.h */; };
+               582CB0551A78A2B200AFFCC4 /* SimpleLineLayoutTextFragmentIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 582CB0541A78A2B200AFFCC4 /* SimpleLineLayoutTextFragmentIterator.cpp */; };
                585D6DFC1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 585D6DFB1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp */; };
                585D6E031A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 585D6E011A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.cpp */; };
                585D6E041A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.h in Headers */ = {isa = PBXBuildFile; fileRef = 585D6E021A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.h */; };
                5803715F1A66F00A00BAF519 /* ClipRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ClipRect.cpp; sourceTree = "<group>"; };
                580371601A66F00A00BAF519 /* ClipRect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClipRect.h; sourceTree = "<group>"; };
                580371631A66F1D300BAF519 /* LayerFragment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayerFragment.h; sourceTree = "<group>"; };
-               582CB0521A78A14B00AFFCC4 /* SimpleLineLayoutFlowContentsIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleLineLayoutFlowContentsIterator.h; sourceTree = "<group>"; };
-               582CB0541A78A2B200AFFCC4 /* SimpleLineLayoutFlowContentsIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLineLayoutFlowContentsIterator.cpp; sourceTree = "<group>"; };
+               582CB0521A78A14B00AFFCC4 /* SimpleLineLayoutTextFragmentIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleLineLayoutTextFragmentIterator.h; sourceTree = "<group>"; };
+               582CB0541A78A2B200AFFCC4 /* SimpleLineLayoutTextFragmentIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLineLayoutTextFragmentIterator.cpp; sourceTree = "<group>"; };
                585D6DFB1A15355600FA4F12 /* SimpleLineLayoutResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLineLayoutResolver.cpp; sourceTree = "<group>"; };
                585D6E011A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleLineLayoutFlowContents.cpp; sourceTree = "<group>"; };
                585D6E021A1A792E00FA4F12 /* SimpleLineLayoutFlowContents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleLineLayoutFlowContents.h; sourceTree = "<group>"; };
                                E4C91A0D1802343100A17F6D /* TextPaintStyle.h */,
                                37FC96DA1104ED71003E1FAD /* TrailingFloatsRootInlineBox.h */,
                                BCA257141293C010007A263D /* VerticalPositionCache.h */,
-                               582CB0521A78A14B00AFFCC4 /* SimpleLineLayoutFlowContentsIterator.h */,
-                               582CB0541A78A2B200AFFCC4 /* SimpleLineLayoutFlowContentsIterator.cpp */,
+                               582CB0521A78A14B00AFFCC4 /* SimpleLineLayoutTextFragmentIterator.h */,
+                               582CB0541A78A2B200AFFCC4 /* SimpleLineLayoutTextFragmentIterator.cpp */,
                        );
                        path = rendering;
                        sourceTree = "<group>";
                                379E61CC126CA5C400B63E8D /* BaseCheckableInputType.h in Headers */,
                                F5E0C65C1643C42C00D6CB69 /* BaseChooserOnlyDateAndTimeInputType.h in Headers */,
                                C33EE5C514FB49610002095A /* BaseClickableWithKeyInputType.h in Headers */,
-                               582CB0531A78A14B00AFFCC4 /* SimpleLineLayoutFlowContentsIterator.h in Headers */,
+                               582CB0531A78A14B00AFFCC4 /* SimpleLineLayoutTextFragmentIterator.h in Headers */,
                                F59C96001255B23F000623C0 /* BaseDateAndTimeInputType.h in Headers */,
                                F55B3DAE1251F12D003EF269 /* BaseTextInputType.h in Headers */,
                                FBD6AF8A15EF25DF008B7110 /* BasicShapeFunctions.h in Headers */,
                                BC2441C40E8B65D00055320F /* ScrollView.cpp in Sources */,
                                E45390450EAFD637003695C8 /* ScrollViewIOS.mm in Sources */,
                                9353676B09AED88B00D35CD6 /* ScrollViewMac.mm in Sources */,
-                               582CB0551A78A2B200AFFCC4 /* SimpleLineLayoutFlowContentsIterator.cpp in Sources */,
+                               582CB0551A78A2B200AFFCC4 /* SimpleLineLayoutTextFragmentIterator.cpp in Sources */,
                                F55B3DD11251F12D003EF269 /* SearchInputType.cpp in Sources */,
                                976F36EA14686225005E93B4 /* SecurityContext.cpp in Sources */,
                                BCD0E0FA0E972C3500265DEA /* SecurityOrigin.cpp in Sources */,
index aba48b6..9d0749d 100644 (file)
@@ -44,8 +44,8 @@
 #include "RenderView.h"
 #include "Settings.h"
 #include "SimpleLineLayoutFlowContents.h"
-#include "SimpleLineLayoutFlowContentsIterator.h"
 #include "SimpleLineLayoutFunctions.h"
+#include "SimpleLineLayoutTextFragmentIterator.h"
 #include "Text.h"
 #include "TextPaintStyle.h"
 
@@ -231,18 +231,18 @@ class LineState {
 public:
     void setAvailableWidth(float width) { m_availableWidth = width; }
     void setLogicalLeftOffset(float offset) { m_logicalLeftOffset = offset; }
-    void setOverflowedFragment(const FlowContentsIterator::TextFragment& fragment) { m_overflowedFragment = fragment; }
+    void setOverflowedFragment(const TextFragmentIterator::TextFragment& fragment) { m_overflowedFragment = fragment; }
 
     float availableWidth() const { return m_availableWidth; }
     float logicalLeftOffset() const { return m_logicalLeftOffset; }
-    const FlowContentsIterator::TextFragment& overflowedFragment() const { return m_overflowedFragment; }
+    const TextFragmentIterator::TextFragment& overflowedFragment() const { return m_overflowedFragment; }
     bool hasTrailingWhitespace() const { return m_trailingWhitespaceLength; }
     bool isWhitespaceOnly() const { return m_trailingWhitespaceWidth && m_runsWidth == m_trailingWhitespaceWidth; }
     bool fits(float extra) const { return m_availableWidth >= m_runsWidth + extra; }
     bool firstCharacterFits() const { return m_firstCharacterFits; }
     float width() const { return m_runsWidth; }
 
-    void appendFragment(const FlowContentsIterator::TextFragment& fragment, Layout::RunVector& runs)
+    void appendFragment(const TextFragmentIterator::TextFragment& fragment, Layout::RunVector& runs)
     {
         // Adjust end position while collapsing.
         unsigned endPosition = fragment.isCollapsed() ? fragment.start() + 1 : fragment.end();
@@ -258,7 +258,7 @@ public:
         m_createNewRun = fragment.isCollapsed();
         m_runsWidth += fragment.width();
 
-        if (fragment.type() == FlowContentsIterator::TextFragment::Whitespace) {
+        if (fragment.type() == TextFragmentIterator::TextFragment::Whitespace) {
             m_trailingWhitespaceLength += endPosition - fragment.start();
             m_trailingWhitespaceWidth += fragment.width();
         } else {
@@ -287,7 +287,7 @@ public:
 private:
     float m_availableWidth { 0 };
     float m_logicalLeftOffset { 0 };
-    FlowContentsIterator::TextFragment m_overflowedFragment;
+    TextFragmentIterator::TextFragment m_overflowedFragment;
     float m_runsWidth { 0 };
     bool m_createNewRun { true };
     float m_trailingWhitespaceWidth { 0 }; // Use this to remove trailing whitespace without re-mesuring the text.
@@ -317,21 +317,21 @@ private:
     unsigned m_fragmentIndex { 0 };
 };
 
-static FragmentForwardIterator begin(const FlowContentsIterator::TextFragment& fragment)  { return FragmentForwardIterator(fragment.start()); }
-static FragmentForwardIterator end(const FlowContentsIterator::TextFragment& fragment)  { return FragmentForwardIterator(fragment.end()); }
+static FragmentForwardIterator begin(const TextFragmentIterator::TextFragment& fragment)  { return FragmentForwardIterator(fragment.start()); }
+static FragmentForwardIterator end(const TextFragmentIterator::TextFragment& fragment)  { return FragmentForwardIterator(fragment.end()); }
 
-static bool preWrap(const FlowContentsIterator::Style& style)
+static bool preWrap(const TextFragmentIterator::Style& style)
 {
     return style.wrapLines && !style.collapseWhitespace;
 }
     
-static void removeTrailingWhitespace(LineState& lineState, Layout::RunVector& runs, const FlowContentsIterator& flowContentsIterator)
+static void removeTrailingWhitespace(LineState& lineState, Layout::RunVector& runs, const TextFragmentIterator& textFragmentIterator)
 {
     if (!lineState.hasTrailingWhitespace())
         return;
     
     // Remove collapsed whitespace, or non-collapsed pre-wrap whitespace, unless it's the only content on the line -so removing the whitesapce would produce an empty line.
-    const auto& style = flowContentsIterator.style();
+    const auto& style = textFragmentIterator.style();
     bool collapseWhitespace = style.collapseWhitespace | preWrap(style);
     if (!collapseWhitespace)
         return;
@@ -351,53 +351,53 @@ static void updateLineConstrains(const RenderBlockFlow& flow, LineState& line)
     line.setAvailableWidth(std::max<float>(0, logicalRightOffset - line.logicalLeftOffset()));
 }
 
-static FlowContentsIterator::TextFragment splitFragmentToFitLine(FlowContentsIterator::TextFragment& fragmentToSplit, float availableWidth, bool keepAtLeastOneCharacter, const FlowContentsIterator& flowContentsIterator)
+static TextFragmentIterator::TextFragment splitFragmentToFitLine(TextFragmentIterator::TextFragment& fragmentToSplit, float availableWidth, bool keepAtLeastOneCharacter, const TextFragmentIterator& textFragmentIterator)
 {
     // FIXME: add surrogate pair support.
     unsigned start = fragmentToSplit.start();
-    auto it = std::upper_bound(begin(fragmentToSplit), end(fragmentToSplit), availableWidth, [&flowContentsIterator, start](float availableWidth, unsigned index) {
+    auto it = std::upper_bound(begin(fragmentToSplit), end(fragmentToSplit), availableWidth, [&textFragmentIterator, start](float availableWidth, unsigned index) {
         // FIXME: use the actual left position of the line (instead of 0) to calculated width. It might give false width for tab characters.
-        return availableWidth < flowContentsIterator.textWidth(start, index + 1, 0);
+        return availableWidth < textFragmentIterator.textWidth(start, index + 1, 0);
     });
     unsigned splitPosition = (*it);
     if (keepAtLeastOneCharacter && splitPosition == fragmentToSplit.start())
         ++splitPosition;
-    return fragmentToSplit.split(splitPosition, flowContentsIterator);
+    return fragmentToSplit.split(splitPosition, textFragmentIterator);
 }
 
-static FlowContentsIterator::TextFragment firstFragment(FlowContentsIterator& flowContentsIterator, const LineState& previousLine)
+static TextFragmentIterator::TextFragment firstFragment(TextFragmentIterator& textFragmentIterator, const LineState& previousLine)
 {
     // Handle overflowed fragment from previous line.
-    FlowContentsIterator::TextFragment firstFragment(previousLine.overflowedFragment());
-    const auto& style = flowContentsIterator.style();
+    TextFragmentIterator::TextFragment firstFragment(previousLine.overflowedFragment());
+    const auto& style = textFragmentIterator.style();
 
     if (firstFragment.isEmpty())
-        firstFragment = flowContentsIterator.nextTextFragment();
+        firstFragment = textFragmentIterator.nextTextFragment();
     else {
         // Special overflow pre-wrap whitespace handling: ignore the overflowed whitespace if we managed to fit at least one character on the previous line.
         // When the line is too short to fit one character (thought it still stays on the line) we continue with the overflow whitespace content on this line.
-        if (firstFragment.type() == FlowContentsIterator::TextFragment::Whitespace && preWrap(style) && previousLine.firstCharacterFits()) {
-            firstFragment = flowContentsIterator.nextTextFragment();
+        if (firstFragment.type() == TextFragmentIterator::TextFragment::Whitespace && preWrap(style) && previousLine.firstCharacterFits()) {
+            firstFragment = textFragmentIterator.nextTextFragment();
             // If skipping the whitespace puts us on a hard newline, skip the newline too as we already wrapped the line.
-            if (firstFragment.type() == FlowContentsIterator::TextFragment::LineBreak)
-                firstFragment = flowContentsIterator.nextTextFragment();
+            if (firstFragment.type() == TextFragmentIterator::TextFragment::LineBreak)
+                firstFragment = textFragmentIterator.nextTextFragment();
         }
     }
 
     // Check if we need to skip the leading whitespace.
-    if (style.collapseWhitespace && firstFragment.type() == FlowContentsIterator::TextFragment::Whitespace)
-        firstFragment = flowContentsIterator.nextTextFragment();
+    if (style.collapseWhitespace && firstFragment.type() == TextFragmentIterator::TextFragment::Whitespace)
+        firstFragment = textFragmentIterator.nextTextFragment();
     return firstFragment;
 }
 
-static bool createLineRuns(LineState& line, const LineState& previousLine, Layout::RunVector& runs, FlowContentsIterator& flowContentsIterator)
+static bool createLineRuns(LineState& line, const LineState& previousLine, Layout::RunVector& runs, TextFragmentIterator& textFragmentIterator)
 {
-    const auto& style = flowContentsIterator.style();
+    const auto& style = textFragmentIterator.style();
     bool lineCanBeWrapped = style.wrapLines || style.breakWordOnOverflow;
-    auto fragment = firstFragment(flowContentsIterator, previousLine);
-    while (fragment.type() != FlowContentsIterator::TextFragment::ContentEnd) {
+    auto fragment = firstFragment(textFragmentIterator, previousLine);
+    while (fragment.type() != TextFragmentIterator::TextFragment::ContentEnd) {
         // Hard linebreak.
-        if (fragment.type() == FlowContentsIterator::TextFragment::LineBreak) {
+        if (fragment.type() == TextFragmentIterator::TextFragment::LineBreak) {
             // Add the new line fragment only if there's nothing on the line. (otherwise the extra new line character would show up at the end of the content.)
             if (!line.width())
                 line.appendFragment(fragment, runs);
@@ -411,10 +411,10 @@ static bool createLineRuns(LineState& line, const LineState& previousLine, Layou
             // 4. Non-whitespace fragment when there's already another fragment on the line gets pushed to the next line.
             bool emptyLine = !line.width();
             // Whitespace fragment.
-            if (fragment.type() == FlowContentsIterator::TextFragment::Whitespace) {
+            if (fragment.type() == TextFragmentIterator::TextFragment::Whitespace) {
                 if (!style.collapseWhitespace) {
                     // Split the fragment; (modified)fragment stays on this line, overflowedFragment is pushed to next line.
-                    line.setOverflowedFragment(splitFragmentToFitLine(fragment, line.availableWidth() - line.width(), emptyLine, flowContentsIterator));
+                    line.setOverflowedFragment(splitFragmentToFitLine(fragment, line.availableWidth() - line.width(), emptyLine, textFragmentIterator));
                     line.appendFragment(fragment, runs);
                 }
                 // When whitespace collapse is on, whitespace that doesn't fit is simply skipped.
@@ -423,7 +423,7 @@ static bool createLineRuns(LineState& line, const LineState& previousLine, Layou
             // Non-whitespace fragment. (!style.wrapLines: bug138102(preserve existing behavior)
             if ((emptyLine && style.breakWordOnOverflow) || !style.wrapLines) {
                 // Split the fragment; (modified)fragment stays on this line, overflowedFragment is pushed to next line.
-                line.setOverflowedFragment(splitFragmentToFitLine(fragment, line.availableWidth() - line.width(), emptyLine, flowContentsIterator));
+                line.setOverflowedFragment(splitFragmentToFitLine(fragment, line.availableWidth() - line.width(), emptyLine, textFragmentIterator));
                 line.appendFragment(fragment, runs);
                 break;
             }
@@ -438,21 +438,21 @@ static bool createLineRuns(LineState& line, const LineState& previousLine, Layou
         }
         line.appendFragment(fragment, runs);
         // Find the next text fragment.
-        fragment = flowContentsIterator.nextTextFragment(line.width());
+        fragment = textFragmentIterator.nextTextFragment(line.width());
     }
-    return fragment.type() == FlowContentsIterator::TextFragment::ContentEnd && line.overflowedFragment().isEmpty();
+    return fragment.type() == TextFragmentIterator::TextFragment::ContentEnd && line.overflowedFragment().isEmpty();
 }
 
-static void closeLineEndingAndAdjustRuns(LineState& line, Layout::RunVector& runs, unsigned previousRunCount, unsigned& lineCount, const FlowContentsIterator& flowContentsIterator)
+static void closeLineEndingAndAdjustRuns(LineState& line, Layout::RunVector& runs, unsigned previousRunCount, unsigned& lineCount, const TextFragmentIterator& textFragmentIterator)
 {
     if (previousRunCount == runs.size())
         return;
     ASSERT(runs.size());
-    removeTrailingWhitespace(line, runs, flowContentsIterator);
+    removeTrailingWhitespace(line, runs, textFragmentIterator);
     if (!runs.size())
         return;
     // Adjust runs' position by taking line's alignment into account.
-    if (float lineLogicalLeft = computeLineLeft(flowContentsIterator.style().textAlign, line.availableWidth(), line.width(), line.logicalLeftOffset())) {
+    if (float lineLogicalLeft = computeLineLeft(textFragmentIterator.style().textAlign, line.availableWidth(), line.width(), line.logicalLeftOffset())) {
         for (unsigned i = previousRunCount; i < runs.size(); ++i) {
             runs[i].logicalLeft += lineLogicalLeft;
             runs[i].logicalRight += lineLogicalLeft;
@@ -462,7 +462,7 @@ static void closeLineEndingAndAdjustRuns(LineState& line, Layout::RunVector& run
     ++lineCount;
 }
 
-static void splitRunsAtRendererBoundary(Layout::RunVector& lineRuns, const FlowContentsIterator& flowContentsIterator)
+static void splitRunsAtRendererBoundary(Layout::RunVector& lineRuns, const TextFragmentIterator& textFragmentIterator)
 {
     // FIXME: We should probably split during run construction instead of as a separate pass.
     if (lineRuns.isEmpty())
@@ -471,12 +471,12 @@ static void splitRunsAtRendererBoundary(Layout::RunVector& lineRuns, const FlowC
     do {
         const Run& run = lineRuns.at(runIndex);
         ASSERT(run.start != run.end);
-        auto& startSegment = flowContentsIterator.segmentForPosition(run.start);
+        auto& startSegment = textFragmentIterator.segmentForPosition(run.start);
         if (run.end <= startSegment.end)
             continue;
         // This run overlaps multiple renderers. Split it up.
         // Split run at the renderer's boundary and create a new run for the left side, while use the current run as the right side.
-        float logicalRightOfLeftRun = run.logicalLeft + flowContentsIterator.textWidth(run.start, startSegment.end, run.logicalLeft);
+        float logicalRightOfLeftRun = run.logicalLeft + textFragmentIterator.textWidth(run.start, startSegment.end, run.logicalLeft);
         lineRuns.insert(runIndex, Run(run.start, startSegment.end, run.logicalLeft, logicalRightOfLeftRun, false));
         Run& rightSideRun = lineRuns.at(runIndex + 1);
         rightSideRun.start = startSegment.end;
@@ -490,7 +490,7 @@ static void createTextRuns(Layout::RunVector& runs, RenderBlockFlow& flow, unsig
     LayoutUnit lineHeight = lineHeightFromFlow(flow);
     LineState line;
     bool isEndOfContent = false;
-    FlowContentsIterator flowContentsIterator = FlowContentsIterator(flow);
+    TextFragmentIterator textFragmentIterator = TextFragmentIterator(flow);
 
     do {
         flow.setLogicalHeight(lineHeight * lineCount + borderAndPaddingBefore);
@@ -498,12 +498,12 @@ static void createTextRuns(Layout::RunVector& runs, RenderBlockFlow& flow, unsig
         unsigned previousRunCount = runs.size();
         line = LineState();
         updateLineConstrains(flow, line);
-        isEndOfContent = createLineRuns(line, previousLine, runs, flowContentsIterator);
-        closeLineEndingAndAdjustRuns(line, runs, previousRunCount, lineCount, flowContentsIterator);
+        isEndOfContent = createLineRuns(line, previousLine, runs, textFragmentIterator);
+        closeLineEndingAndAdjustRuns(line, runs, previousRunCount, lineCount, textFragmentIterator);
     } while (!isEndOfContent);
 
     if (flow.firstChild() != flow.lastChild())
-        splitRunsAtRendererBoundary(runs, flowContentsIterator);
+        splitRunsAtRendererBoundary(runs, textFragmentIterator);
 }
 
 std::unique_ptr<Layout> create(RenderBlockFlow& flow)
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "SimpleLineLayoutFlowContentsIterator.h"
+#include "SimpleLineLayoutTextFragmentIterator.h"
 
 #include "RenderBlockFlow.h"
 #include "RenderChildIterator.h"
@@ -34,7 +34,7 @@
 namespace WebCore {
 namespace SimpleLineLayout {
 
-FlowContentsIterator::Style::Style(const RenderStyle& style)
+TextFragmentIterator::Style::Style(const RenderStyle& style)
     : font(style.fontCascade())
     , textAlign(style.textAlign())
     , collapseWhitespace(style.collapseWhiteSpace())
@@ -47,14 +47,14 @@ FlowContentsIterator::Style::Style(const RenderStyle& style)
 {
 }
 
-FlowContentsIterator::FlowContentsIterator(const RenderBlockFlow& flow)
+TextFragmentIterator::TextFragmentIterator(const RenderBlockFlow& flow)
     : m_flowContents(flow)
     , m_lineBreakIterator((*m_flowContents.begin()).text, flow.style().locale())
     , m_style(flow.style())
 {
 }
 
-FlowContentsIterator::TextFragment FlowContentsIterator::nextTextFragment(float xPosition)
+TextFragmentIterator::TextFragment TextFragmentIterator::nextTextFragment(float xPosition)
 {
     // A fragment can either be
     // 1. new line character when preserveNewline is on (not considered as whitespace) or
@@ -91,7 +91,7 @@ FlowContentsIterator::TextFragment FlowContentsIterator::nextTextFragment(float
     return TextFragment(startPosition, endPosition, textWidth(startPosition, endPosition, xPosition), TextFragment::NonWhitespace, false, m_style.breakWordOnOverflow);
 }
 
-float FlowContentsIterator::textWidth(unsigned from, unsigned to, float xPosition) const
+float TextFragmentIterator::textWidth(unsigned from, unsigned to, float xPosition) const
 {
     const auto& fromSegment = m_flowContents.segmentForPosition(from);
     if ((m_style.font.isFixedPitch() && fromSegment.end >= to) || (from == fromSegment.start && to == fromSegment.end))
@@ -122,7 +122,7 @@ static unsigned nextBreakablePosition(LazyLineBreakIterator& lineBreakIterator,
     return nextBreakablePositionNonLoosely<CharacterType, NBSPBehavior::IgnoreNBSP>(lineBreakIterator, characters, segmentLength, segmentPosition);
 }
 
-unsigned FlowContentsIterator::findNextBreakablePosition(unsigned position) const
+unsigned TextFragmentIterator::findNextBreakablePosition(unsigned position) const
 {
     while (!isEnd(position)) {
         auto& segment = m_flowContents.segmentForPosition(position);
@@ -142,7 +142,7 @@ unsigned FlowContentsIterator::findNextBreakablePosition(unsigned position) cons
 }
 
 template <typename CharacterType>
-static bool findNextNonWhitespace(const FlowContents::Segment& segment, const FlowContentsIterator::Style& style, unsigned& position, unsigned& spaceCount)
+static bool findNextNonWhitespace(const FlowContents::Segment& segment, const TextFragmentIterator::Style& style, unsigned& position, unsigned& spaceCount)
 {
     const auto* text = segment.text.characters<CharacterType>();
     for (; position < segment.end; ++position) {
@@ -157,7 +157,7 @@ static bool findNextNonWhitespace(const FlowContents::Segment& segment, const Fl
     return false;
 }
 
-unsigned FlowContentsIterator::findNextNonWhitespacePosition(unsigned position, unsigned& spaceCount) const
+unsigned TextFragmentIterator::findNextNonWhitespacePosition(unsigned position, unsigned& spaceCount) const
 {
     FlowContents::Iterator it(m_flowContents, m_flowContents.segmentIndexForPosition(position));
     for (auto end = m_flowContents.end(); it != end; ++it) {
@@ -169,7 +169,7 @@ unsigned FlowContentsIterator::findNextNonWhitespacePosition(unsigned position,
 }
 
 template <typename CharacterType>
-float FlowContentsIterator::runWidth(const String& text, unsigned from, unsigned to, float xPosition) const
+float TextFragmentIterator::runWidth(const String& text, unsigned from, unsigned to, float xPosition) const
 {
     ASSERT(from <= to);
     if (from == to)
@@ -23,8 +23,8 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef SimpleLineLayoutFlowContentsIterator_h
-#define SimpleLineLayoutFlowContentsIterator_h
+#ifndef SimpleLineLayoutTextFragmentIterator_h
+#define SimpleLineLayoutTextFragmentIterator_h
 
 #include "RenderStyle.h"
 #include "SimpleLineLayoutFlowContents.h"
@@ -36,9 +36,9 @@ class RenderBlockFlow;
 
 namespace SimpleLineLayout {
 
-class FlowContentsIterator  {
+class TextFragmentIterator  {
 public:
-    FlowContentsIterator(const RenderBlockFlow&);
+    TextFragmentIterator(const RenderBlockFlow&);
     class TextFragment {
     public:
         enum Type { ContentEnd, LineBreak, Whitespace, NonWhitespace };
@@ -61,7 +61,7 @@ public:
         bool isBreakable() const { return m_isBreakable; }
 
         bool isEmpty() const { return start() == end(); }
-        TextFragment split(unsigned splitPosition, const FlowContentsIterator&);
+        TextFragment split(unsigned splitPosition, const TextFragmentIterator&);
 
     private:
         unsigned m_start { 0 };
@@ -105,13 +105,13 @@ private:
     unsigned m_position { 0 };
 };
 
-inline FlowContentsIterator::TextFragment FlowContentsIterator::TextFragment::split(unsigned splitPosition, const FlowContentsIterator& flowContentsIterator)
+inline TextFragmentIterator::TextFragment TextFragmentIterator::TextFragment::split(unsigned splitPosition, const TextFragmentIterator& textFragmentIterator)
 {
-    auto updateFragmentProperties = [&flowContentsIterator] (TextFragment& fragment)
+    auto updateFragmentProperties = [&textFragmentIterator] (TextFragment& fragment)
     {
         fragment.m_width = 0;
         if (fragment.start() != fragment.end())
-            fragment.m_width = flowContentsIterator.textWidth(fragment.start(), fragment.end(), 0);
+            fragment.m_width = textFragmentIterator.textWidth(fragment.start(), fragment.end(), 0);
         if (fragment.start() + 1 > fragment.end())
             return;
         fragment.m_isCollapsed = false;
@@ -127,20 +127,20 @@ inline FlowContentsIterator::TextFragment FlowContentsIterator::TextFragment::sp
     return newFragment;
 }
 
-inline UChar FlowContentsIterator::characterAt(unsigned position) const
+inline UChar TextFragmentIterator::characterAt(unsigned position) const
 {
     auto& segment = m_flowContents.segmentForPosition(position);
     return segment.text[position - segment.start];
 }
 
-inline bool FlowContentsIterator::isLineBreak(unsigned position) const
+inline bool TextFragmentIterator::isLineBreak(unsigned position) const
 {
     if (isEnd(position))
         return false;
     return m_style.preserveNewline && characterAt(position) == '\n';
 }
 
-inline bool FlowContentsIterator::isEnd(unsigned position) const
+inline bool TextFragmentIterator::isEnd(unsigned position) const
 {
     return position >= m_flowContents.length();
 }