Title: [267697] trunk/Source/WebCore
Revision
267697
Author
[email protected]
Date
2020-09-28 06:42:33 -0700 (Mon, 28 Sep 2020)

Log Message

[LFC][Integration] Move run iterator to LayoutIntegration namespace
https://bugs.webkit.org/show_bug.cgi?id=217046

Reviewed by Zalan Bujtas.

Also use name 'Modern' for LFC and 'Legacy' for the old inline tree path.

Also rename box->run for more consistent terminology.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* dom/Position.cpp:
(WebCore::Position::upstream const):
(WebCore::Position::downstream const):
* editing/TextIterator.cpp:
(WebCore::TextIterator::advance):
(WebCore::TextIterator::handleTextNode):
(WebCore::TextIterator::handleTextRun):
(WebCore::TextIterator::handleTextNodeFirstLetter):
(WebCore::TextIterator::handleTextBox): Deleted.
* editing/TextIterator.h:
* layout/integration/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::textRunsFor const):
(WebCore::LayoutIntegration::LineLayout::elementRunFor const):
(WebCore::LayoutIntegration::LineLayout::paint):
(WebCore::LayoutIntegration::LineLayout::textBoxesFor const): Deleted.
(WebCore::LayoutIntegration::LineLayout::elementBoxFor const): Deleted.
* layout/integration/LayoutIntegrationLineLayout.h:
* layout/integration/LayoutIntegrationRunIterator.cpp: Renamed from Source/WebCore/rendering/line/LineLayoutTraversal.cpp.
(WebCore::LayoutIntegration::TextRunIterator::TextRunIterator):
(WebCore::LayoutIntegration::TextRunIterator::traverseNextInVisualOrder):
(WebCore::LayoutIntegration::TextRunIterator::traverseNextInTextOrder):
(WebCore::LayoutIntegration::TextRunIterator::operator== const):
(WebCore::LayoutIntegration::TextRunIterator::atEnd const):
(WebCore::LayoutIntegration::firstTextRunFor):
(WebCore::LayoutIntegration::firstTextRunInTextOrderFor):
(WebCore::LayoutIntegration::textRunsFor):
(WebCore::LayoutIntegration::ElementRunIterator::ElementRunIterator):
(WebCore::LayoutIntegration::ElementRunIterator::atEnd const):
(WebCore::LayoutIntegration::elementRunFor):
* layout/integration/LayoutIntegrationRunIterator.h: Renamed from Source/WebCore/rendering/line/LineLayoutTraversal.h.
(WebCore::LayoutIntegration::TextRunIterator::TextRunIterator):
(WebCore::LayoutIntegration::TextRunIterator::operator++):
(WebCore::LayoutIntegration::TextRunIterator::operator!= const):
(WebCore::LayoutIntegration::TextRunIterator::operator* const):
(WebCore::LayoutIntegration::TextRunIterator::operator-> const):
(WebCore::LayoutIntegration::ElementRunIterator::ElementRunIterator):
(WebCore::LayoutIntegration::ElementRunIterator::operator* const):
(WebCore::LayoutIntegration::ElementRunIterator::operator-> const):
(WebCore::LayoutIntegration::TextRunRange::TextRunRange):
(WebCore::LayoutIntegration::TextRunRange::begin const):
(WebCore::LayoutIntegration::Run::Run):
(WebCore::LayoutIntegration::Run::rect const):
(WebCore::LayoutIntegration::Run::baseline const):
(WebCore::LayoutIntegration::Run::isLeftToRightDirection const):
(WebCore::LayoutIntegration::Run::isHorizontal const):
(WebCore::LayoutIntegration::Run::dirOverride const):
(WebCore::LayoutIntegration::Run::isLineBreak const):
(WebCore::LayoutIntegration::Run::useLineBreakBoxRenderTreeDumpQuirk const):
(WebCore::LayoutIntegration::TextRun::hasHyphen const):
(WebCore::LayoutIntegration::TextRun::TextRun):
(WebCore::LayoutIntegration::TextRun::text const):
(WebCore::LayoutIntegration::TextRun::localStartOffset const):
(WebCore::LayoutIntegration::TextRun::localEndOffset const):
(WebCore::LayoutIntegration::TextRun::length const):
(WebCore::LayoutIntegration::TextRun::isLastOnLine const):
(WebCore::LayoutIntegration::TextRun::isLast const):
* layout/integration/LayoutIntegrationRunIteratorLegacyPath.h: Renamed from Source/WebCore/rendering/line/LineLayoutTraversalComplexPath.h.
(WebCore::LayoutIntegration::LegacyPath::LegacyPath):
(WebCore::LayoutIntegration::LegacyPath::operator== const):
(WebCore::LayoutIntegration::LegacyPath::nextInlineTextBoxInTextOrder const):
* layout/integration/LayoutIntegrationRunIteratorModernPath.h: Renamed from Source/WebCore/rendering/line/LineLayoutTraversalDisplayRunPath.h.
(WebCore::LayoutIntegration::ModernPath::ModernPath):
(WebCore::LayoutIntegration::ModernPath::operator== const):
(WebCore::LayoutIntegration::ModernPath::rect const):
* rendering/RenderLineBreak.cpp:
(WebCore::RenderLineBreak::linesBoundingBox const):
(WebCore::RenderLineBreak::boundingBoxForRenderTreeDump const):
(WebCore::RenderLineBreak::absoluteRects const):
(WebCore::RenderLineBreak::absoluteQuads const):
* rendering/RenderText.cpp:
(WebCore::RenderText::absoluteRects const):
(WebCore::collectAbsoluteQuadsForNonComplexPaths):
(WebCore::RenderText::firstRunLocation const):
(WebCore::RenderText::linesBoundingBox const):
(WebCore::RenderText::caretMinOffset const):
(WebCore::RenderText::caretMaxOffset const):
(WebCore::RenderText::countRenderedCharacterOffsetsUntil const):
(WebCore::containsOffset):
(WebCore::RenderText::hasRenderedText const):
* rendering/RenderTreeAsText.cpp:
(WebCore::RenderTreeAsText::writeRenderObject):
(WebCore::writeTextRun):
(WebCore::write):
(WebCore::writeTextBox): Deleted.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (267696 => 267697)


--- trunk/Source/WebCore/ChangeLog	2020-09-28 12:25:01 UTC (rev 267696)
+++ trunk/Source/WebCore/ChangeLog	2020-09-28 13:42:33 UTC (rev 267697)
@@ -1,3 +1,101 @@
+2020-09-28  Antti Koivisto  <[email protected]>
+
+        [LFC][Integration] Move run iterator to LayoutIntegration namespace
+        https://bugs.webkit.org/show_bug.cgi?id=217046
+
+        Reviewed by Zalan Bujtas.
+
+        Also use name 'Modern' for LFC and 'Legacy' for the old inline tree path.
+
+        Also rename box->run for more consistent terminology.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * dom/Position.cpp:
+        (WebCore::Position::upstream const):
+        (WebCore::Position::downstream const):
+        * editing/TextIterator.cpp:
+        (WebCore::TextIterator::advance):
+        (WebCore::TextIterator::handleTextNode):
+        (WebCore::TextIterator::handleTextRun):
+        (WebCore::TextIterator::handleTextNodeFirstLetter):
+        (WebCore::TextIterator::handleTextBox): Deleted.
+        * editing/TextIterator.h:
+        * layout/integration/LayoutIntegrationLineLayout.cpp:
+        (WebCore::LayoutIntegration::LineLayout::textRunsFor const):
+        (WebCore::LayoutIntegration::LineLayout::elementRunFor const):
+        (WebCore::LayoutIntegration::LineLayout::paint):
+        (WebCore::LayoutIntegration::LineLayout::textBoxesFor const): Deleted.
+        (WebCore::LayoutIntegration::LineLayout::elementBoxFor const): Deleted.
+        * layout/integration/LayoutIntegrationLineLayout.h:
+        * layout/integration/LayoutIntegrationRunIterator.cpp: Renamed from Source/WebCore/rendering/line/LineLayoutTraversal.cpp.
+        (WebCore::LayoutIntegration::TextRunIterator::TextRunIterator):
+        (WebCore::LayoutIntegration::TextRunIterator::traverseNextInVisualOrder):
+        (WebCore::LayoutIntegration::TextRunIterator::traverseNextInTextOrder):
+        (WebCore::LayoutIntegration::TextRunIterator::operator== const):
+        (WebCore::LayoutIntegration::TextRunIterator::atEnd const):
+        (WebCore::LayoutIntegration::firstTextRunFor):
+        (WebCore::LayoutIntegration::firstTextRunInTextOrderFor):
+        (WebCore::LayoutIntegration::textRunsFor):
+        (WebCore::LayoutIntegration::ElementRunIterator::ElementRunIterator):
+        (WebCore::LayoutIntegration::ElementRunIterator::atEnd const):
+        (WebCore::LayoutIntegration::elementRunFor):
+        * layout/integration/LayoutIntegrationRunIterator.h: Renamed from Source/WebCore/rendering/line/LineLayoutTraversal.h.
+        (WebCore::LayoutIntegration::TextRunIterator::TextRunIterator):
+        (WebCore::LayoutIntegration::TextRunIterator::operator++):
+        (WebCore::LayoutIntegration::TextRunIterator::operator!= const):
+        (WebCore::LayoutIntegration::TextRunIterator::operator* const):
+        (WebCore::LayoutIntegration::TextRunIterator::operator-> const):
+        (WebCore::LayoutIntegration::ElementRunIterator::ElementRunIterator):
+        (WebCore::LayoutIntegration::ElementRunIterator::operator* const):
+        (WebCore::LayoutIntegration::ElementRunIterator::operator-> const):
+        (WebCore::LayoutIntegration::TextRunRange::TextRunRange):
+        (WebCore::LayoutIntegration::TextRunRange::begin const):
+        (WebCore::LayoutIntegration::Run::Run):
+        (WebCore::LayoutIntegration::Run::rect const):
+        (WebCore::LayoutIntegration::Run::baseline const):
+        (WebCore::LayoutIntegration::Run::isLeftToRightDirection const):
+        (WebCore::LayoutIntegration::Run::isHorizontal const):
+        (WebCore::LayoutIntegration::Run::dirOverride const):
+        (WebCore::LayoutIntegration::Run::isLineBreak const):
+        (WebCore::LayoutIntegration::Run::useLineBreakBoxRenderTreeDumpQuirk const):
+        (WebCore::LayoutIntegration::TextRun::hasHyphen const):
+        (WebCore::LayoutIntegration::TextRun::TextRun):
+        (WebCore::LayoutIntegration::TextRun::text const):
+        (WebCore::LayoutIntegration::TextRun::localStartOffset const):
+        (WebCore::LayoutIntegration::TextRun::localEndOffset const):
+        (WebCore::LayoutIntegration::TextRun::length const):
+        (WebCore::LayoutIntegration::TextRun::isLastOnLine const):
+        (WebCore::LayoutIntegration::TextRun::isLast const):
+        * layout/integration/LayoutIntegrationRunIteratorLegacyPath.h: Renamed from Source/WebCore/rendering/line/LineLayoutTraversalComplexPath.h.
+        (WebCore::LayoutIntegration::LegacyPath::LegacyPath):
+        (WebCore::LayoutIntegration::LegacyPath::operator== const):
+        (WebCore::LayoutIntegration::LegacyPath::nextInlineTextBoxInTextOrder const):
+        * layout/integration/LayoutIntegrationRunIteratorModernPath.h: Renamed from Source/WebCore/rendering/line/LineLayoutTraversalDisplayRunPath.h.
+        (WebCore::LayoutIntegration::ModernPath::ModernPath):
+        (WebCore::LayoutIntegration::ModernPath::operator== const):
+        (WebCore::LayoutIntegration::ModernPath::rect const):
+        * rendering/RenderLineBreak.cpp:
+        (WebCore::RenderLineBreak::linesBoundingBox const):
+        (WebCore::RenderLineBreak::boundingBoxForRenderTreeDump const):
+        (WebCore::RenderLineBreak::absoluteRects const):
+        (WebCore::RenderLineBreak::absoluteQuads const):
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::absoluteRects const):
+        (WebCore::collectAbsoluteQuadsForNonComplexPaths):
+        (WebCore::RenderText::firstRunLocation const):
+        (WebCore::RenderText::linesBoundingBox const):
+        (WebCore::RenderText::caretMinOffset const):
+        (WebCore::RenderText::caretMaxOffset const):
+        (WebCore::RenderText::countRenderedCharacterOffsetsUntil const):
+        (WebCore::containsOffset):
+        (WebCore::RenderText::hasRenderedText const):
+        * rendering/RenderTreeAsText.cpp:
+        (WebCore::RenderTreeAsText::writeRenderObject):
+        (WebCore::writeTextRun):
+        (WebCore::write):
+        (WebCore::writeTextBox): Deleted.
+
 2020-09-24  Simon Fraser  <[email protected]>
 
         WebKitLegacy should call Page::finalizeRenderingUpdate()

Modified: trunk/Source/WebCore/Headers.cmake (267696 => 267697)


--- trunk/Source/WebCore/Headers.cmake	2020-09-28 12:25:01 UTC (rev 267696)
+++ trunk/Source/WebCore/Headers.cmake	2020-09-28 13:42:33 UTC (rev 267697)
@@ -714,6 +714,10 @@
 
     layout/inlineformatting/InlineRect.h
 
+    layout/integration/LayoutIntegrationRunIterator.h
+    layout/integration/LayoutIntegrationRunIteratorLegacyPath.h
+    layout/integration/LayoutIntegrationRunIteratorModernPath.h
+
     layout/layouttree/LayoutBox.h
 
     loader/AdClickAttribution.h
@@ -1427,9 +1431,6 @@
     rendering/RootInlineBox.h
     rendering/ScrollAlignment.h
 
-    rendering/line/LineLayoutTraversal.h
-    rendering/line/LineLayoutTraversalComplexPath.h
-    rendering/line/LineLayoutTraversalDisplayRunPath.h
     rendering/line/LineWidth.h
     rendering/line/TrailingObjects.h
 

Modified: trunk/Source/WebCore/Sources.txt (267696 => 267697)


--- trunk/Source/WebCore/Sources.txt	2020-09-28 12:25:01 UTC (rev 267696)
+++ trunk/Source/WebCore/Sources.txt	2020-09-28 13:42:33 UTC (rev 267697)
@@ -1468,6 +1468,7 @@
 layout/integration/LayoutIntegrationCoverage.cpp
 layout/integration/LayoutIntegrationLineLayout.cpp
 layout/integration/LayoutIntegrationPagination.cpp
+layout/integration/LayoutIntegrationRunIterator.cpp
 layout/invalidation/InvalidationContext.cpp
 layout/invalidation/InvalidationState.cpp
 layout/layouttree/LayoutBox.cpp
@@ -2216,7 +2217,6 @@
 rendering/TrailingFloatsRootInlineBox.cpp
 rendering/line/LineBreaker.cpp
 rendering/line/LineInfo.cpp
-rendering/line/LineLayoutTraversal.cpp
 rendering/line/LineWidth.cpp
 rendering/line/TrailingObjects.cpp
 rendering/mathml/MathMLStyle.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (267696 => 267697)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-09-28 12:25:01 UTC (rev 267696)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-09-28 13:42:33 UTC (rev 267697)
@@ -4985,7 +4985,6 @@
 		E4295FA412B0614E00D1ACE0 /* ResourceLoadPriority.h in Headers */ = {isa = PBXBuildFile; fileRef = E4295FA312B0614E00D1ACE0 /* ResourceLoadPriority.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E42E76DC1C7AF77600E3614D /* StyleUpdate.h in Headers */ = {isa = PBXBuildFile; fileRef = E42E76DB1C7AF77600E3614D /* StyleUpdate.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E43105BB16750F1600DB2FB8 /* NodeTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = E43105BA16750F1600DB2FB8 /* NodeTraversal.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		E4343D252392779000EBBB66 /* LineLayoutTraversalComplexPath.h in Headers */ = {isa = PBXBuildFile; fileRef = E4343D242392778F00EBBB66 /* LineLayoutTraversalComplexPath.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E43A023B17EB370A004CDD25 /* RenderElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E43A023A17EB370A004CDD25 /* RenderElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E43AF8E71AC5B7EC00CA717E /* CacheValidation.h in Headers */ = {isa = PBXBuildFile; fileRef = E43AF8E51AC5B7DD00CA717E /* CacheValidation.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E440AA961C68420800A265CC /* ElementAndTextDescendantIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E440AA951C68420800A265CC /* ElementAndTextDescendantIterator.h */; };
@@ -5008,7 +5007,6 @@
 		E44614520CD68A3500FADA75 /* RenderVideo.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B41E340CBFB60900AF2ECE /* RenderVideo.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E44B4BB4141650D7002B1D8B /* SelectorChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = E44B4BB2141650D7002B1D8B /* SelectorChecker.h */; };
 		E44FA1851BCA6B5A0091B6EF /* ComposedTreeIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E44FA1841BCA6B5A0091B6EF /* ComposedTreeIterator.h */; };
-		E451C628239293EC00993190 /* LineLayoutTraversalDisplayRunPath.h in Headers */ = {isa = PBXBuildFile; fileRef = E451C627239293EB00993190 /* LineLayoutTraversalDisplayRunPath.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E451C6312394027900993190 /* LayoutUnits.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F73918C2106CEDD006AF262 /* LayoutUnits.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E451C6322394031A00993190 /* MarginTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 6FE7AA2621C37B6300296DCD /* MarginTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E451C6342394058F00993190 /* DisplayInlineContent.h in Headers */ = {isa = PBXBuildFile; fileRef = E451C6332394058E00993190 /* DisplayInlineContent.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -5037,10 +5035,12 @@
 		E47C39331FE6E10800BBBC6B /* RenderTreeBuilderMultiColumn.h in Headers */ = {isa = PBXBuildFile; fileRef = E47C39271FE6E0DC00BBBC6B /* RenderTreeBuilderMultiColumn.h */; };
 		E47E276516036ED200EE2AFB /* ExtensionStyleSheets.h in Headers */ = {isa = PBXBuildFile; fileRef = E47E276416036ED200EE2AFB /* ExtensionStyleSheets.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E48137B91DB3B526005C59BF /* StyleValidity.h in Headers */ = {isa = PBXBuildFile; fileRef = E48137B81DB3B526005C59BF /* StyleValidity.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		E484A33E23055325009ADE6A /* LineLayoutTraversal.h in Headers */ = {isa = PBXBuildFile; fileRef = E484A33B23055303009ADE6A /* LineLayoutTraversal.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E4863CFE23842E9E00972158 /* RuleData.h in Headers */ = {isa = PBXBuildFile; fileRef = E4863CFD23842E9E00972158 /* RuleData.h */; };
 		E4946EAF156E64DD00D3297F /* StyleRuleImport.h in Headers */ = {isa = PBXBuildFile; fileRef = E4946EAD156E64DD00D3297F /* StyleRuleImport.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E49BD9FA131FD2ED003C56F0 /* CSSValuePool.h in Headers */ = {isa = PBXBuildFile; fileRef = E49BD9F9131FD2ED003C56F0 /* CSSValuePool.h */; };
+		E4A664CC2521D4AF007081DC /* LayoutIntegrationRunIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A664C62521B778007081DC /* LayoutIntegrationRunIterator.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		E4A664CE2521D4C9007081DC /* LayoutIntegrationRunIteratorModernPath.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A664C42521B777007081DC /* LayoutIntegrationRunIteratorModernPath.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		E4A664CF2521D4E2007081DC /* LayoutIntegrationRunIteratorLegacyPath.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A664C52521B778007081DC /* LayoutIntegrationRunIteratorLegacyPath.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E4A7995220EE4B1400C19568 /* CSSParserContext.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A7994E20EE4AE100C19568 /* CSSParserContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E4A814D41C6DEC4000BF85AC /* ClassChangeInvalidation.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A814D31C6DEC4000BF85AC /* ClassChangeInvalidation.h */; };
 		E4A814DA1C70E10D00BF85AC /* AttributeChangeInvalidation.h in Headers */ = {isa = PBXBuildFile; fileRef = E4A814D91C70E10D00BF85AC /* AttributeChangeInvalidation.h */; };
@@ -15853,7 +15853,6 @@
 		E43105BA16750F1600DB2FB8 /* NodeTraversal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeTraversal.h; sourceTree = "<group>"; };
 		E4312AB524B3265600678349 /* LayoutIntegrationPagination.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutIntegrationPagination.cpp; sourceTree = "<group>"; };
 		E4312AB724B3265600678349 /* LayoutIntegrationPagination.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutIntegrationPagination.h; sourceTree = "<group>"; };
-		E4343D242392778F00EBBB66 /* LineLayoutTraversalComplexPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineLayoutTraversalComplexPath.h; sourceTree = "<group>"; };
 		E43A023A17EB370A004CDD25 /* RenderElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderElement.h; sourceTree = "<group>"; };
 		E43A023C17EB3713004CDD25 /* RenderElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderElement.cpp; sourceTree = "<group>"; };
 		E43AF8E41AC5B7DD00CA717E /* CacheValidation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CacheValidation.cpp; sourceTree = "<group>"; };
@@ -15891,7 +15890,6 @@
 		E44EE3A717576E5500EEE8CF /* FontGenericFamilies.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FontGenericFamilies.h; sourceTree = "<group>"; };
 		E44FA1841BCA6B5A0091B6EF /* ComposedTreeIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ComposedTreeIterator.h; sourceTree = "<group>"; };
 		E44FA1861BCA91560091B6EF /* ComposedTreeIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ComposedTreeIterator.cpp; sourceTree = "<group>"; };
-		E451C627239293EB00993190 /* LineLayoutTraversalDisplayRunPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineLayoutTraversalDisplayRunPath.h; sourceTree = "<group>"; };
 		E451C6332394058E00993190 /* DisplayInlineContent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayInlineContent.h; sourceTree = "<group>"; };
 		E45322A9140CE267005A0F92 /* SelectorQuery.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectorQuery.cpp; sourceTree = "<group>"; };
 		E45322AA140CE267005A0F92 /* SelectorQuery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectorQuery.h; sourceTree = "<group>"; };
@@ -15940,8 +15938,6 @@
 		E47E276416036ED200EE2AFB /* ExtensionStyleSheets.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtensionStyleSheets.h; sourceTree = "<group>"; };
 		E47E276716036EDC00EE2AFB /* ExtensionStyleSheets.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExtensionStyleSheets.cpp; sourceTree = "<group>"; };
 		E48137B81DB3B526005C59BF /* StyleValidity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleValidity.h; sourceTree = "<group>"; };
-		E484A33B23055303009ADE6A /* LineLayoutTraversal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LineLayoutTraversal.h; sourceTree = "<group>"; };
-		E484A33D23055303009ADE6A /* LineLayoutTraversal.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LineLayoutTraversal.cpp; sourceTree = "<group>"; };
 		E4863CFA23842E8700972158 /* RuleData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RuleData.cpp; sourceTree = "<group>"; };
 		E4863CFD23842E9E00972158 /* RuleData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RuleData.h; sourceTree = "<group>"; };
 		E4946EAC156E64DD00D3297F /* StyleRuleImport.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleRuleImport.cpp; sourceTree = "<group>"; };
@@ -15952,6 +15948,10 @@
 		E4A007841B820ED3002C5A6E /* DataURLDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DataURLDecoder.cpp; sourceTree = "<group>"; };
 		E4A1822F1F13BE5800FEF698 /* StyleInvalidationFunctions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StyleInvalidationFunctions.h; sourceTree = "<group>"; };
 		E4A1AC7822FAFD500017B75B /* ComplexLineLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ComplexLineLayout.h; sourceTree = "<group>"; };
+		E4A664C42521B777007081DC /* LayoutIntegrationRunIteratorModernPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutIntegrationRunIteratorModernPath.h; sourceTree = "<group>"; };
+		E4A664C52521B778007081DC /* LayoutIntegrationRunIteratorLegacyPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutIntegrationRunIteratorLegacyPath.h; sourceTree = "<group>"; };
+		E4A664C62521B778007081DC /* LayoutIntegrationRunIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutIntegrationRunIterator.h; sourceTree = "<group>"; };
+		E4A664C72521B779007081DC /* LayoutIntegrationRunIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutIntegrationRunIterator.cpp; sourceTree = "<group>"; };
 		E4A7994E20EE4AE100C19568 /* CSSParserContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSSParserContext.h; path = parser/CSSParserContext.h; sourceTree = "<group>"; };
 		E4A7995020EE4AE200C19568 /* CSSParserContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CSSParserContext.cpp; path = parser/CSSParserContext.cpp; sourceTree = "<group>"; };
 		E4A814D31C6DEC4000BF85AC /* ClassChangeInvalidation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ClassChangeInvalidation.h; sourceTree = "<group>"; };
@@ -28495,6 +28495,10 @@
 		E4FB4B1E2395356F003C336A /* integration */ = {
 			isa = PBXGroup;
 			children = (
+				E4A664C72521B779007081DC /* LayoutIntegrationRunIterator.cpp */,
+				E4A664C62521B778007081DC /* LayoutIntegrationRunIterator.h */,
+				E4A664C52521B778007081DC /* LayoutIntegrationRunIteratorLegacyPath.h */,
+				E4A664C42521B777007081DC /* LayoutIntegrationRunIteratorModernPath.h */,
 				E418025623D454B500FFB071 /* LayoutIntegrationBoxTree.cpp */,
 				E418025323D4549A00FFB071 /* LayoutIntegrationBoxTree.h */,
 				E403B79F251B118B0019E800 /* LayoutIntegrationCoverage.cpp */,
@@ -30244,10 +30248,6 @@
 				FFB698CE1833F17600158A31 /* LineInfo.h */,
 				FFEFAB2D183BCB6F00514534 /* LineInlineHeaders.h */,
 				FFEFAB2918380DA000514534 /* LineLayoutState.h */,
-				E484A33D23055303009ADE6A /* LineLayoutTraversal.cpp */,
-				E484A33B23055303009ADE6A /* LineLayoutTraversal.h */,
-				E4343D242392778F00EBBB66 /* LineLayoutTraversalComplexPath.h */,
-				E451C627239293EB00993190 /* LineLayoutTraversalDisplayRunPath.h */,
 				FFDBC046183D27B700407109 /* LineWidth.cpp */,
 				FFDBC045183D27B700407109 /* LineWidth.h */,
 				FFAC30FD184FB145008C4F1E /* TrailingObjects.cpp */,
@@ -32447,6 +32447,7 @@
 				07969DB017D14151007FF842 /* JSRTCDTMFSender.h in Headers */,
 				07969DB217D14151007FF842 /* JSRTCDTMFToneChangeEvent.h in Headers */,
 				07969DB617D14151007FF842 /* JSRTCIceCandidate.h in Headers */,
+				E4A664CE2521D4C9007081DC /* LayoutIntegrationRunIteratorModernPath.h in Headers */,
 				316DCB4C1E7910A6001B5F87 /* JSRTCIceConnectionState.h in Headers */,
 				316DCB4E1E7910A6001B5F87 /* JSRTCIceGatheringState.h in Headers */,
 				073794EC19EE341E00E5A045 /* JSRTCIceServer.h in Headers */,
@@ -32492,6 +32493,7 @@
 				B59DD6A511902A62007E9684 /* JSSQLStatementCallback.h in Headers */,
 				B59DD6A911902A71007E9684 /* JSSQLStatementErrorCallback.h in Headers */,
 				BC82432A0D0CE8A200460C8F /* JSSQLTransaction.h in Headers */,
+				E4A664CC2521D4AF007081DC /* LayoutIntegrationRunIterator.h in Headers */,
 				B59DD69D11902A42007E9684 /* JSSQLTransactionCallback.h in Headers */,
 				B59DD6A111902A52007E9684 /* JSSQLTransactionErrorCallback.h in Headers */,
 				A86629D309DA2B48009633A7 /* JSStaticRange.h in Headers */,
@@ -32827,9 +32829,6 @@
 				B22279650D00BF220071B782 /* LinearGradientAttributes.h in Headers */,
 				AB31C91E10AE1B8E000C7B92 /* LineClampValue.h in Headers */,
 				FFEFAB2A18380DA000514534 /* LineLayoutState.h in Headers */,
-				E484A33E23055325009ADE6A /* LineLayoutTraversal.h in Headers */,
-				E4343D252392779000EBBB66 /* LineLayoutTraversalComplexPath.h in Headers */,
-				E451C628239293EC00993190 /* LineLayoutTraversalDisplayRunPath.h in Headers */,
 				FFDBC047183D27B700407109 /* LineWidth.h in Headers */,
 				CBA9DC0B1DF44DF40005675C /* LinkHeader.h in Headers */,
 				5143B2631DDD15200014FAC6 /* LinkIcon.h in Headers */,
@@ -32964,6 +32963,7 @@
 				C96F5EC81B5872260091EA9D /* MediaSessionInterruptionProvider.h in Headers */,
 				C96F5EC51B5872260091EA9D /* MediaSessionInterruptionProviderMac.h in Headers */,
 				C90F65561B2253BE002163A1 /* MediaSessionManager.h in Headers */,
+				E4A664CF2521D4E2007081DC /* LayoutIntegrationRunIteratorLegacyPath.h in Headers */,
 				417F7AEF2139BF6F00FBA7EC /* MediaSessionManagerCocoa.h in Headers */,
 				07638A991884487200E15A1B /* MediaSessionManagerIOS.h in Headers */,
 				C9D851F01B39DC780085062E /* MediaSessionMetadata.h in Headers */,

Modified: trunk/Source/WebCore/dom/Position.cpp (267696 => 267697)


--- trunk/Source/WebCore/dom/Position.cpp	2020-09-28 12:25:01 UTC (rev 267696)
+++ trunk/Source/WebCore/dom/Position.cpp	2020-09-28 13:42:33 UTC (rev 267697)
@@ -38,7 +38,7 @@
 #include "InlineElementBox.h"
 #include "InlineIterator.h"
 #include "InlineTextBox.h"
-#include "LineLayoutTraversal.h"
+#include "LayoutIntegrationRunIterator.h"
 #include "Logging.h"
 #include "NodeTraversal.h"
 #include "PositionIterator.h"
@@ -728,8 +728,8 @@
         if (is<RenderText>(*renderer)) {
             auto& textRenderer = downcast<RenderText>(*renderer);
 
-            auto firstTextBox = LineLayoutTraversal::firstTextBoxInTextOrderFor(textRenderer);
-            if (!firstTextBox)
+            auto firstTextRun = LayoutIntegration::firstTextRunInTextOrderFor(textRenderer);
+            if (!firstTextRun)
                 continue;
 
             if (&currentNode != startNode) {
@@ -742,14 +742,14 @@
             }
 
             unsigned textOffset = currentPosition.offsetInLeafNode();
-            for (auto box = firstTextBox; box; box.traverseNextInTextOrder()) {
-                if (textOffset <= box->localEndOffset()) {
-                    if (textOffset > box->localStartOffset())
+            for (auto run = firstTextRun; run; run.traverseNextInTextOrder()) {
+                if (textOffset <= run->localEndOffset()) {
+                    if (textOffset > run->localStartOffset())
                         return currentPosition;
                     continue;
                 }
 
-                if (textOffset == box->localEndOffset() + 1 && box->isLastOnLine() && !box->isLast())
+                if (textOffset == run->localEndOffset() + 1 && run->isLastOnLine() && !run->isLast())
                     return currentPosition;
             }
         }
@@ -835,8 +835,8 @@
         if (is<RenderText>(*renderer)) {
             auto& textRenderer = downcast<RenderText>(*renderer);
 
-            auto firstTextBox = LineLayoutTraversal::firstTextBoxInTextOrderFor(textRenderer);
-            if (!firstTextBox)
+            auto firstTextRun = LayoutIntegration::firstTextRunInTextOrderFor(textRenderer);
+            if (!firstTextRun)
                 continue;
 
             if (&currentNode != startNode) {
@@ -845,17 +845,17 @@
             }
 
             unsigned textOffset = currentPosition.offsetInLeafNode();
-            for (auto box = firstTextBox; box; box.traverseNextInTextOrder()) {
-                if (!box->length() && textOffset == box->localStartOffset())
+            for (auto run = firstTextRun; run; run.traverseNextInTextOrder()) {
+                if (!run->length() && textOffset == run->localStartOffset())
                     return currentPosition;
 
-                if (textOffset < box->localEndOffset()) {
-                    if (textOffset >= box->localStartOffset())
+                if (textOffset < run->localEndOffset()) {
+                    if (textOffset >= run->localStartOffset())
                         return currentPosition;
                     continue;
                 }
 
-                if (textOffset == box->localEndOffset() && box->isLastOnLine() && !box->isLast())
+                if (textOffset == run->localEndOffset() && run->isLastOnLine() && !run->isLast())
                     return currentPosition;
             }
         }

Modified: trunk/Source/WebCore/editing/TextIterator.cpp (267696 => 267697)


--- trunk/Source/WebCore/editing/TextIterator.cpp	2020-09-28 12:25:01 UTC (rev 267696)
+++ trunk/Source/WebCore/editing/TextIterator.cpp	2020-09-28 13:42:33 UTC (rev 267697)
@@ -437,15 +437,15 @@
         return;
     }
 
-    if (!m_textBox && m_remainingTextBox) {
-        m_textBox = m_remainingTextBox;
-        m_remainingTextBox = { };
+    if (!m_textRun && m_remainingTextRun) {
+        m_textRun = m_remainingTextRun;
+        m_remainingTextRun = { };
         m_firstLetterText = { };
         m_offset = 0;
     }
     // handle remembered text box
-    if (m_textBox) {
-        handleTextBox();
+    if (m_textRun) {
+        handleTextRun();
         if (m_positionNode)
             return;
     }
@@ -563,7 +563,7 @@
                 String firstLetter = m_firstLetterText->text();
                 emitText(textNode, *m_firstLetterText, m_offset, m_offset + firstLetter.length());
                 m_firstLetterText = nullptr;
-                m_textBox = { };
+                m_textRun = { };
                 return false;
             }
         }
@@ -580,13 +580,13 @@
         return true;
     }
 
-    m_textBox = LineLayoutTraversal::firstTextBoxInTextOrderFor(renderer);
+    m_textRun = LayoutIntegration::firstTextRunInTextOrderFor(renderer);
 
     bool shouldHandleFirstLetter = !m_handledFirstLetter && is<RenderTextFragment>(renderer) && !m_offset;
     if (shouldHandleFirstLetter)
         handleTextNodeFirstLetter(downcast<RenderTextFragment>(renderer));
 
-    if (!m_textBox && rendererText.length() && !shouldHandleFirstLetter) {
+    if (!m_textRun && rendererText.length() && !shouldHandleFirstLetter) {
         if (renderer.style().visibility() != Visibility::Visible && !(m_behavior & TextIteratorIgnoresStyleVisibility))
             return false;
         m_lastTextNodeEndedWithCollapsedSpace = true; // entire block is collapsed space
@@ -593,31 +593,31 @@
         return true;
     }
 
-    handleTextBox();
+    handleTextRun();
     return true;
 }
 
-void TextIterator::handleTextBox()
+void TextIterator::handleTextRun()
 {    
     Text& textNode = downcast<Text>(*m_node);
 
     auto& renderer = m_firstLetterText ? *m_firstLetterText : *textNode.renderer();
     if (renderer.style().visibility() != Visibility::Visible && !(m_behavior & TextIteratorIgnoresStyleVisibility)) {
-        m_textBox = { };
+        m_textRun = { };
         return;
     }
 
-    auto firstTextBox = LineLayoutTraversal::firstTextBoxInTextOrderFor(renderer);
+    auto firstTextRun = LayoutIntegration::firstTextRunInTextOrderFor(renderer);
 
     String rendererText = renderer.text();
     unsigned start = m_offset;
     unsigned end = (&textNode == m_endContainer) ? static_cast<unsigned>(m_endOffset) : UINT_MAX;
-    while (m_textBox) {
-        unsigned textBoxStart = m_textBox->localStartOffset();
-        unsigned runStart = std::max(textBoxStart, start);
+    while (m_textRun) {
+        unsigned textRunStart = m_textRun->localStartOffset();
+        unsigned runStart = std::max(textRunStart, start);
 
         // Check for collapsed space at the start of this run.
-        bool needSpace = m_lastTextNodeEndedWithCollapsedSpace || (m_textBox == firstTextBox && textBoxStart == runStart && runStart);
+        bool needSpace = m_lastTextNodeEndedWithCollapsedSpace || (m_textRun == firstTextRun && textRunStart == runStart && runStart);
         if (needSpace && !renderer.style().isCollapsibleWhiteSpace(m_lastCharacter) && m_lastCharacter) {
             if (m_lastTextNode == &textNode && runStart && rendererText[runStart - 1] == ' ') {
                 unsigned spaceRunStart = runStart - 1;
@@ -628,12 +628,12 @@
                 emitCharacter(' ', textNode, nullptr, runStart, runStart);
             return;
         }
-        unsigned textBoxEnd = textBoxStart + m_textBox->length();
-        unsigned runEnd = std::min(textBoxEnd, end);
+        unsigned textRunEnd = textRunStart + m_textRun->length();
+        unsigned runEnd = std::min(textRunEnd, end);
         
-        // Determine what the next text box will be, but don't advance yet
-        auto nextTextBox = m_textBox;
-        nextTextBox.traverseNextInTextOrder();
+        // Determine what the next text run will be, but don't advance yet
+        auto nextTextRun = m_textRun;
+        nextTextRun.traverseNextInTextOrder();
 
         if (runStart < runEnd) {
             auto isNewlineOrTab = [&](UChar character) {
@@ -652,8 +652,8 @@
                         break;
                 }
                 if (subrunEnd == runEnd && (m_behavior & TextIteratorBehavesAsIfNodesFollowing)) {
-                    bool lastSpaceCollapsedByNextNonTextBox = !nextTextBox && rendererText.length() > subrunEnd && rendererText[subrunEnd] == ' ';
-                    if (lastSpaceCollapsedByNextNonTextBox)
+                    bool lastSpaceCollapsedByNextNonTextRun = !nextTextRun && rendererText.length() > subrunEnd && rendererText[subrunEnd] == ' ';
+                    if (lastSpaceCollapsedByNextNonTextRun)
                         ++subrunEnd; // runEnd stopped before last space. Increment by one to restore the space.
                 }
                 m_offset = subrunEnd;
@@ -662,25 +662,25 @@
 
             // If we are doing a subrun that doesn't go to the end of the text box,
             // come back again to finish handling this text box; don't advance to the next one.
-            if (static_cast<unsigned>(m_positionEndOffset) < textBoxEnd)
+            if (static_cast<unsigned>(m_positionEndOffset) < textRunEnd)
                 return;
 
             // Advance and return
-            unsigned nextRunStart = nextTextBox ? nextTextBox->localStartOffset() : rendererText.length();
+            unsigned nextRunStart = nextTextRun ? nextTextRun->localStartOffset() : rendererText.length();
             if (nextRunStart > runEnd)
                 m_lastTextNodeEndedWithCollapsedSpace = true; // collapsed space between runs or at the end
-            m_textBox = nextTextBox;
+            m_textRun = nextTextRun;
             return;
         }
         // Advance and continue
-        m_textBox = nextTextBox;
+        m_textRun = nextTextRun;
     }
-    if (!m_textBox && m_remainingTextBox) {
-        m_textBox = m_remainingTextBox;
-        m_remainingTextBox = { };
+    if (!m_textRun && m_remainingTextRun) {
+        m_textRun = m_remainingTextRun;
+        m_remainingTextRun = { };
         m_firstLetterText = { };
         m_offset = 0;
-        handleTextBox();
+        handleTextRun();
     }
 }
 
@@ -700,8 +700,8 @@
             return;
         if (auto* firstLetterText = firstRenderTextInFirstLetter(firstLetter)) {
             m_handledFirstLetter = true;
-            m_remainingTextBox = m_textBox;
-            m_textBox = LineLayoutTraversal::firstTextBoxInTextOrderFor(*firstLetterText);
+            m_remainingTextRun = m_textRun;
+            m_textRun = LayoutIntegration::firstTextRunInTextOrderFor(*firstLetterText);
             m_firstLetterText = firstLetterText;
         }
     }

Modified: trunk/Source/WebCore/editing/TextIterator.h (267696 => 267697)


--- trunk/Source/WebCore/editing/TextIterator.h	2020-09-28 12:25:01 UTC (rev 267696)
+++ trunk/Source/WebCore/editing/TextIterator.h	2020-09-28 13:42:33 UTC (rev 267697)
@@ -27,7 +27,7 @@
 
 #include "CharacterRange.h"
 #include "FindOptions.h"
-#include "LineLayoutTraversal.h"
+#include "LayoutIntegrationRunIterator.h"
 #include "SimpleRange.h"
 #include "TextIteratorBehavior.h"
 #include <wtf/Vector.h>
@@ -116,7 +116,7 @@
     bool handleTextNode();
     bool handleReplacedElement();
     bool handleNonTextNode();
-    void handleTextBox();
+    void handleTextRun();
     void handleTextNodeFirstLetter(RenderTextFragment&);
     void emitCharacter(UChar, Node& characterNode, Node* offsetBaseNode, int textStartOffset, int textEndOffset);
     void emitText(Text& textNode, RenderText&, int textStartOffset, int textEndOffset);
@@ -149,10 +149,10 @@
 
     // Used when there is still some pending text from the current node; when these are false and null, we go back to normal iterating.
     Node* m_nodeForAdditionalNewline { nullptr };
-    LineLayoutTraversal::TextBoxIterator m_textBox;
+    LayoutIntegration::TextRunIterator m_textRun;
 
     // Used when iterating over :first-letter text to save pointer to remaining text box.
-    LineLayoutTraversal::TextBoxIterator m_remainingTextBox;
+    LayoutIntegration::TextRunIterator m_remainingTextRun;
 
     // Used to point to RenderText object for :first-letter.
     RenderText* m_firstLetterText { nullptr };

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp (267696 => 267697)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-09-28 12:25:01 UTC (rev 267696)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.cpp	2020-09-28 13:42:33 UTC (rev 267697)
@@ -294,7 +294,7 @@
     return *m_displayInlineContent;
 }
 
-LineLayoutTraversal::TextBoxIterator LineLayout::textBoxesFor(const RenderText& renderText) const
+LayoutIntegration::TextRunIterator LineLayout::textRunsFor(const RenderText& renderText) const
 {
     auto* inlineContent = displayInlineContent();
     if (!inlineContent)
@@ -316,10 +316,10 @@
     if (!firstIndex)
         return { };
 
-    return { LineLayoutTraversal::DisplayRunPath(*inlineContent, *firstIndex, lastIndex + 1) };
+    return { LayoutIntegration::ModernPath(*inlineContent, *firstIndex, lastIndex + 1) };
 }
 
-LineLayoutTraversal::ElementBoxIterator LineLayout::elementBoxFor(const RenderLineBreak& renderLineBreak) const
+LayoutIntegration::ElementRunIterator LineLayout::elementRunFor(const RenderLineBreak& renderLineBreak) const
 {
     auto* inlineContent = displayInlineContent();
     if (!inlineContent)
@@ -330,7 +330,7 @@
     for (size_t i = 0; i < inlineContent->runs.size(); ++i) {
         auto& run =  inlineContent->runs[i];
         if (&run.layoutBox() == layoutBox)
-            return { LineLayoutTraversal::DisplayRunPath(*inlineContent, i, i + 1) };
+            return { LayoutIntegration::ModernPath(*inlineContent, i, i + 1) };
     }
 
     return { };
@@ -393,7 +393,7 @@
         // TextRun expects the xPos to be adjusted with the aligment offset (e.g. when the line is center aligned
         // and the run starts at 100px, due to the horizontal aligment, the xpos is supposed to be at 0px).
         auto xPos = rect.x() - (line.rect().x() + line.horizontalAlignmentOffset());
-        TextRun textRun { !textWithHyphen.isEmpty() ? textWithHyphen : textContent.content(), xPos, expansion.horizontalExpansion, expansion.behavior };
+        WebCore::TextRun textRun { !textWithHyphen.isEmpty() ? textWithHyphen : textContent.content(), xPos, expansion.horizontalExpansion, expansion.behavior };
         textRun.setTabSize(!style.collapseWhiteSpace(), style.tabSize());
         FloatPoint textOrigin { rect.x() + paintOffset.x(), roundToDevicePixel(baseline, deviceScaleFactor) };
 

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h (267696 => 267697)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h	2020-09-28 12:25:01 UTC (rev 267696)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLineLayout.h	2020-09-28 13:42:33 UTC (rev 267697)
@@ -28,9 +28,9 @@
 #if ENABLE(LAYOUT_FORMATTING_CONTEXT)
 
 #include "LayoutIntegrationBoxTree.h"
+#include "LayoutIntegrationRunIterator.h"
 #include "LayoutPoint.h"
 #include "LayoutState.h"
-#include "LineLayoutTraversal.h"
 #include "RenderObjectEnums.h"
 
 namespace WebCore {
@@ -77,8 +77,8 @@
     void paint(PaintInfo&, const LayoutPoint& paintOffset);
     bool hitTest(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint& accumulatedOffset, HitTestAction);
 
-    LineLayoutTraversal::TextBoxIterator textBoxesFor(const RenderText&) const;
-    LineLayoutTraversal::ElementBoxIterator elementBoxFor(const RenderLineBreak&) const;
+    TextRunIterator textRunsFor(const RenderText&) const;
+    ElementRunIterator elementRunFor(const RenderLineBreak&) const;
 
     static void releaseCaches(RenderView&);
 

Copied: trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.cpp (from rev 267696, trunk/Source/WebCore/rendering/line/LineLayoutTraversal.cpp) (0 => 267697)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.cpp	                        (rev 0)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.cpp	2020-09-28 13:42:33 UTC (rev 267697)
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2019 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 "LayoutIntegrationRunIterator.h"
+
+#include "LayoutIntegrationLineLayout.h"
+#include "RenderBlockFlow.h"
+#include "RenderLineBreak.h"
+
+namespace WebCore {
+namespace LayoutIntegration {
+
+TextRunIterator::TextRunIterator(Run::PathVariant&& pathVariant)
+    : m_textRun(WTFMove(pathVariant))
+{
+}
+
+TextRunIterator& TextRunIterator::traverseNextInVisualOrder()
+{
+    WTF::switchOn(m_textRun.m_pathVariant, [](auto& path) {
+        path.traverseNextTextRunInVisualOrder();
+    });
+    return *this;
+}
+
+TextRunIterator& TextRunIterator::traverseNextInTextOrder()
+{
+    WTF::switchOn(m_textRun.m_pathVariant, [](auto& path) {
+        path.traverseNextTextRunInTextOrder();
+    });
+    return *this;
+}
+
+bool TextRunIterator::operator==(const TextRunIterator& other) const
+{
+    if (m_textRun.m_pathVariant.index() != other.m_textRun.m_pathVariant.index())
+        return false;
+
+    return WTF::switchOn(m_textRun.m_pathVariant, [&](const auto& path) {
+        return path == WTF::get<std::decay_t<decltype(path)>>(other.m_textRun.m_pathVariant);
+    });
+}
+
+bool TextRunIterator::atEnd() const
+{
+    return WTF::switchOn(m_textRun.m_pathVariant, [](auto& path) {
+        return path.atEnd();
+    });
+}
+
+static const RenderBlockFlow* lineLayoutSystemFlowForRenderer(const RenderObject& renderer)
+{
+    // In currently supported cases the renderer is always direct child of the flow.
+    if (!is<RenderBlockFlow>(*renderer.parent()))
+        return nullptr;
+    return downcast<RenderBlockFlow>(renderer.parent());
+}
+
+TextRunIterator firstTextRunFor(const RenderText& text)
+{
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+    if (auto* flow = lineLayoutSystemFlowForRenderer(text)) {
+        if (auto* layoutFormattingContextLineLayout = flow->layoutFormattingContextLineLayout())
+            return layoutFormattingContextLineLayout->textRunsFor(text);
+    }
+#endif
+
+    return { LegacyPath { text.firstTextBox() } };
+}
+
+TextRunIterator firstTextRunInTextOrderFor(const RenderText& text)
+{
+    if (text.firstTextBox() && text.containsReversedText()) {
+        Vector<const InlineTextBox*> sortedTextBoxes;
+        for (auto* textBox = text.firstTextBox(); textBox; textBox = textBox->nextTextBox())
+            sortedTextBoxes.append(textBox);
+        std::sort(sortedTextBoxes.begin(), sortedTextBoxes.end(), InlineTextBox::compareByStart);
+        auto* first = sortedTextBoxes[0];
+        return { LegacyPath { first, WTFMove(sortedTextBoxes), 0 } };
+    }
+
+    return firstTextRunFor(text);
+}
+
+TextRunRange textRunsFor(const RenderText& text)
+{
+    return { firstTextRunFor(text) };
+}
+
+ElementRunIterator::ElementRunIterator(Run::PathVariant&& pathVariant)
+    : m_run(WTFMove(pathVariant))
+{
+}
+
+bool ElementRunIterator::atEnd() const
+{
+    return WTF::switchOn(m_run.m_pathVariant, [](auto& path) {
+        return path.atEnd();
+    });
+}
+
+ElementRunIterator elementRunFor(const RenderLineBreak& renderElement)
+{
+    if (auto* flow = lineLayoutSystemFlowForRenderer(renderElement)) {
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+        if (auto* layoutFormattingContextLineLayout = flow->layoutFormattingContextLineLayout())
+            return layoutFormattingContextLineLayout->elementRunFor(renderElement);
+#endif
+    }
+
+    return { LegacyPath(renderElement.inlineBoxWrapper()) };
+}
+
+}
+}

Copied: trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.h (from rev 267696, trunk/Source/WebCore/rendering/line/LineLayoutTraversal.h) (0 => 267697)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.h	                        (rev 0)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIterator.h	2020-09-28 13:42:33 UTC (rev 267697)
@@ -0,0 +1,262 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+#pragma once
+
+#include "InlineElementBox.h"
+#include "LayoutIntegrationRunIteratorLegacyPath.h"
+#include "LayoutIntegrationRunIteratorModernPath.h"
+#include <wtf/Variant.h>
+
+namespace WebCore {
+
+class RenderLineBreak;
+class RenderText;
+
+namespace LayoutIntegration {
+
+class ElementRunIterator;
+class TextRunIterator;
+
+struct EndIterator { };
+
+class Run {
+public:
+    using PathVariant = Variant<
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+        ModernPath,
+#endif
+        LegacyPath
+    >;
+
+    Run(PathVariant&&);
+
+    FloatRect rect() const;
+
+    float baseline() const;
+
+    bool isLeftToRightDirection() const;
+    bool isHorizontal() const;
+    bool dirOverride() const;
+    bool isLineBreak() const;
+    bool useLineBreakBoxRenderTreeDumpQuirk() const;
+
+protected:
+    friend class ElementRunIterator;
+    friend class TextRunIterator;
+
+    PathVariant m_pathVariant;
+};
+
+class TextRun : public Run {
+public:
+    TextRun(PathVariant&&);
+
+    bool hasHyphen() const;
+    StringView text() const;
+
+    // These offsets are relative to the text renderer (not flow).
+    unsigned localStartOffset() const;
+    unsigned localEndOffset() const;
+    unsigned length() const;
+
+    bool isLastOnLine() const;
+    bool isLast() const;
+};
+
+class TextRunIterator {
+public:
+    TextRunIterator() : m_textRun(LegacyPath { nullptr, { } }) { };
+    TextRunIterator(Run::PathVariant&&);
+
+    TextRunIterator& operator++() { return traverseNextInVisualOrder(); }
+    TextRunIterator& traverseNextInVisualOrder();
+    TextRunIterator& traverseNextInTextOrder();
+
+    explicit operator bool() const { return !atEnd(); }
+
+    bool operator==(const TextRunIterator&) const;
+    bool operator!=(const TextRunIterator& other) const { return !(*this == other); }
+
+    bool operator==(EndIterator) const { return atEnd(); }
+    bool operator!=(EndIterator) const { return !atEnd(); }
+
+    const TextRun& operator*() const { return m_textRun; }
+    const TextRun* operator->() const { return &m_textRun; }
+
+    bool atEnd() const;
+
+private:
+    TextRun m_textRun;
+};
+
+class ElementRunIterator {
+public:
+    ElementRunIterator() : m_run(LegacyPath { nullptr, { } }) { };
+    ElementRunIterator(Run::PathVariant&&);
+
+    explicit operator bool() const { return !atEnd(); }
+
+    const Run& operator*() const { return m_run; }
+    const Run* operator->() const { return &m_run; }
+
+    bool atEnd() const;
+
+private:
+    Run m_run;
+};
+
+class TextRunRange {
+public:
+    TextRunRange(TextRunIterator begin)
+        : m_begin(begin)
+    {
+    }
+
+    TextRunIterator begin() const { return m_begin; }
+    EndIterator end() const { return { }; }
+
+private:
+    TextRunIterator m_begin;
+};
+
+TextRunIterator firstTextRunFor(const RenderText&);
+TextRunIterator firstTextRunInTextOrderFor(const RenderText&);
+TextRunRange textRunsFor(const RenderText&);
+ElementRunIterator elementRunFor(const RenderLineBreak&);
+
+// -----------------------------------------------
+
+inline Run::Run(PathVariant&& path)
+    : m_pathVariant(WTFMove(path))
+{
+}
+
+inline FloatRect Run::rect() const
+{
+    return WTF::switchOn(m_pathVariant, [](auto& path) {
+        return path.rect();
+    });
+}
+
+inline float Run::baseline() const
+{
+    return WTF::switchOn(m_pathVariant, [](auto& path) {
+        return path.baseline();
+    });
+}
+
+inline bool Run::isLeftToRightDirection() const
+{
+    return WTF::switchOn(m_pathVariant, [](auto& path) {
+        return path.isLeftToRightDirection();
+    });
+}
+
+inline bool Run::isHorizontal() const
+{
+    return WTF::switchOn(m_pathVariant, [](auto& path) {
+        return path.isHorizontal();
+    });
+}
+
+inline bool Run::dirOverride() const
+{
+    return WTF::switchOn(m_pathVariant, [](auto& path) {
+        return path.dirOverride();
+    });
+}
+
+inline bool Run::isLineBreak() const
+{
+    return WTF::switchOn(m_pathVariant, [](auto& path) {
+        return path.isLineBreak();
+    });
+}
+
+inline bool Run::useLineBreakBoxRenderTreeDumpQuirk() const
+{
+    return WTF::switchOn(m_pathVariant, [](auto& path) {
+        return path.useLineBreakBoxRenderTreeDumpQuirk();
+    });
+}
+
+inline bool TextRun::hasHyphen() const
+{
+    return WTF::switchOn(m_pathVariant, [](auto& path) {
+        return path.hasHyphen();
+    });
+}
+
+inline TextRun::TextRun(PathVariant&& path)
+    : Run(WTFMove(path))
+{
+}
+
+inline StringView TextRun::text() const
+{
+    return WTF::switchOn(m_pathVariant, [](auto& path) {
+        return path.text();
+    });
+}
+
+inline unsigned TextRun::localStartOffset() const
+{
+    return WTF::switchOn(m_pathVariant, [](auto& path) {
+        return path.localStartOffset();
+    });
+}
+
+inline unsigned TextRun::localEndOffset() const
+{
+    return WTF::switchOn(m_pathVariant, [](auto& path) {
+        return path.localEndOffset();
+    });
+}
+
+inline unsigned TextRun::length() const
+{
+    return WTF::switchOn(m_pathVariant, [](auto& path) {
+        return path.length();
+    });
+}
+
+inline bool TextRun::isLastOnLine() const
+{
+    return WTF::switchOn(m_pathVariant, [](auto& path) {
+        return path.isLastOnLine();
+    });
+}
+
+inline bool TextRun::isLast() const
+{
+    return WTF::switchOn(m_pathVariant, [](auto& path) {
+        return path.isLast();
+    });
+}
+
+
+}
+}

Copied: trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorLegacyPath.h (from rev 267696, trunk/Source/WebCore/rendering/line/LineLayoutTraversalComplexPath.h) (0 => 267697)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorLegacyPath.h	                        (rev 0)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorLegacyPath.h	2020-09-28 13:42:33 UTC (rev 267697)
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+#pragma once
+
+#include "InlineTextBox.h"
+#include "RenderText.h"
+#include <wtf/Vector.h>
+
+namespace WebCore {
+namespace LayoutIntegration {
+
+class LegacyPath {
+public:
+    LegacyPath(const InlineBox* inlineBox, Vector<const InlineTextBox*>&& sortedInlineTextBoxes = { }, size_t sortedInlineTextBoxIndex = 0)
+        : m_inlineBox(inlineBox)
+        , m_sortedInlineTextBoxes(WTFMove(sortedInlineTextBoxes))
+        , m_sortedInlineTextBoxIndex(sortedInlineTextBoxIndex)
+    { }
+
+    FloatRect rect() const { return m_inlineBox->frameRect(); }
+
+    bool isLeftToRightDirection() const { return m_inlineBox->isLeftToRightDirection(); }
+    bool isHorizontal() const { return m_inlineBox->isHorizontal(); }
+    bool dirOverride() const { return m_inlineBox->dirOverride(); }
+    bool isLineBreak() const { return m_inlineBox->isLineBreak(); }
+    float baseline() const { return m_inlineBox->baselinePosition(AlphabeticBaseline); }
+
+    bool useLineBreakBoxRenderTreeDumpQuirk() const
+    {
+        return !m_inlineBox->behavesLikeText();
+    }
+
+    bool hasHyphen() const { return inlineTextBox()->hasHyphen(); }
+    StringView text() const { return StringView(inlineTextBox()->renderer().text()).substring(inlineTextBox()->start(), inlineTextBox()->len()); }
+    unsigned localStartOffset() const { return inlineTextBox()->start(); }
+    unsigned localEndOffset() const { return inlineTextBox()->end(); }
+    unsigned length() const { return inlineTextBox()->len(); }
+
+    inline bool isLastOnLine() const
+    {
+        auto* next = nextInlineTextBoxInTextOrder();
+        return !next || &inlineTextBox()->root() != &next->root();
+    }
+    inline bool isLast() const { return !nextInlineTextBoxInTextOrder(); };
+
+    void traverseNextTextRunInVisualOrder() { m_inlineBox = inlineTextBox()->nextTextBox(); }
+    void traverseNextTextRunInTextOrder()
+    {
+        m_inlineBox = nextInlineTextBoxInTextOrder();
+        if (!m_sortedInlineTextBoxes.isEmpty())
+            ++m_sortedInlineTextBoxIndex;
+    }
+
+    bool operator==(const LegacyPath& other) const { return m_inlineBox == other.m_inlineBox; }
+    bool atEnd() const { return !m_inlineBox; }
+
+private:
+    const InlineTextBox* inlineTextBox() const { return downcast<InlineTextBox>(m_inlineBox); }
+    const InlineTextBox* nextInlineTextBoxInTextOrder() const;
+
+    const InlineBox* m_inlineBox;
+    Vector<const InlineTextBox*> m_sortedInlineTextBoxes;
+    size_t m_sortedInlineTextBoxIndex { 0 };
+};
+
+inline const InlineTextBox* LegacyPath::nextInlineTextBoxInTextOrder() const
+{
+    if (!m_sortedInlineTextBoxes.isEmpty()) {
+        if (m_sortedInlineTextBoxIndex + 1 < m_sortedInlineTextBoxes.size())
+            return m_sortedInlineTextBoxes[m_sortedInlineTextBoxIndex + 1];
+        return nullptr;
+    }
+    return inlineTextBox()->nextTextBox();
+}
+
+}
+}

Copied: trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h (from rev 267696, trunk/Source/WebCore/rendering/line/LineLayoutTraversalDisplayRunPath.h) (0 => 267697)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h	                        (rev 0)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationRunIteratorModernPath.h	2020-09-28 13:42:33 UTC (rev 267697)
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2019 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.
+ */
+
+#pragma once
+
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+
+#include "DisplayInlineContent.h"
+
+namespace WebCore {
+
+namespace LayoutIntegration {
+
+static FloatPoint linePosition(float left, float top)
+{
+    return FloatPoint(left, roundf(top));
+}
+
+class ModernPath {
+public:
+    ModernPath(const Display::InlineContent& inlineContent, size_t startIndex, size_t endIndex)
+        : m_inlineContent(&inlineContent)
+        , m_endIndex(endIndex)
+        , m_runIndex(startIndex)
+    { }
+    ModernPath(ModernPath&&) = default;
+    ModernPath(const ModernPath&) = default;
+    ModernPath& operator=(const ModernPath&) = default;
+    ModernPath& operator=(ModernPath&&) = default;
+
+    FloatRect rect() const;
+
+    float baseline() const { return line().baseline(); }
+
+    bool isLeftToRightDirection() const { return true; }
+    bool isHorizontal() const { return true; }
+    bool dirOverride() const { return false; }
+    bool isLineBreak() const { return run().isLineBreak(); }
+
+    bool useLineBreakBoxRenderTreeDumpQuirk() const
+    {
+        if (!m_runIndex)
+            return false;
+        auto& previous = runs()[m_runIndex - 1];
+        return previous.lineIndex() == run().lineIndex();
+    }
+
+    bool hasHyphen() const { return run().textContent()->needsHyphen(); }
+    StringView text() const { return run().textContent()->content(); }
+    unsigned localStartOffset() const { return run().textContent()->start(); }
+    unsigned localEndOffset() const { return run().textContent()->end(); }
+    unsigned length() const { return run().textContent()->length(); }
+
+    bool isLastOnLine() const
+    {
+        if (isLast())
+            return true;
+        auto& next = runs()[m_runIndex + 1];
+        return run().lineIndex() != next.lineIndex();
+    }
+    bool isLast() const
+    {
+        return m_runIndex + 1 == m_endIndex;
+    };
+
+    void traverseNextTextRunInVisualOrder()
+    {
+        ASSERT(!atEnd());
+        ++m_runIndex;
+    }
+    void traverseNextTextRunInTextOrder() {  traverseNextTextRunInVisualOrder(); }
+
+    bool operator==(const ModernPath& other) const { return m_inlineContent == other.m_inlineContent && m_runIndex == other.m_runIndex; }
+    bool atEnd() const { return m_runIndex == m_endIndex; }
+
+private:
+    const Display::InlineContent::Runs& runs() const { return m_inlineContent->runs; }
+    const Display::Run& run() const { return runs()[m_runIndex]; }
+    const Display::Line& line() const { return m_inlineContent->lineForRun(run()); }
+
+    RefPtr<const Display::InlineContent> m_inlineContent;
+    size_t m_endIndex { 0 };
+    size_t m_runIndex { 0 };
+};
+
+inline FloatRect ModernPath::rect() const
+{
+    auto rect = run().rect();
+    auto position = linePosition(rect.x(), rect.y());
+    return { position, rect.size() };
+}
+
+}
+}
+
+#endif

Modified: trunk/Source/WebCore/rendering/RenderLineBreak.cpp (267696 => 267697)


--- trunk/Source/WebCore/rendering/RenderLineBreak.cpp	2020-09-28 12:25:01 UTC (rev 267696)
+++ trunk/Source/WebCore/rendering/RenderLineBreak.cpp	2020-09-28 13:42:33 UTC (rev 267697)
@@ -27,7 +27,7 @@
 #include "HTMLElement.h"
 #include "HTMLWBRElement.h"
 #include "InlineElementBox.h"
-#include "LineLayoutTraversal.h"
+#include "LayoutIntegrationRunIterator.h"
 #include "LogicalSelectionOffsetCaches.h"
 #include "RenderBlock.h"
 #include "RenderView.h"
@@ -170,7 +170,7 @@
 
 IntRect RenderLineBreak::linesBoundingBox() const
 {
-    auto box = LineLayoutTraversal::elementBoxFor(*this);
+    auto box = LayoutIntegration::elementRunFor(*this);
     if (!box)
         return { };
 
@@ -179,7 +179,7 @@
 
 IntRect RenderLineBreak::boundingBoxForRenderTreeDump() const
 {
-    auto box = LineLayoutTraversal::elementBoxFor(*this);
+    auto box = LayoutIntegration::elementRunFor(*this);
     if (!box)
         return { };
 
@@ -201,7 +201,7 @@
 
 void RenderLineBreak::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const
 {
-    auto box = LineLayoutTraversal::elementBoxFor(*this);
+    auto box = LayoutIntegration::elementRunFor(*this);
     if (!box)
         return;
 
@@ -211,7 +211,7 @@
 
 void RenderLineBreak::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const
 {
-    auto box = LineLayoutTraversal::elementBoxFor(*this);
+    auto box = LayoutIntegration::elementRunFor(*this);
     if (!box)
         return;
 

Modified: trunk/Source/WebCore/rendering/RenderText.cpp (267696 => 267697)


--- trunk/Source/WebCore/rendering/RenderText.cpp	2020-09-28 12:25:01 UTC (rev 267696)
+++ trunk/Source/WebCore/rendering/RenderText.cpp	2020-09-28 13:42:33 UTC (rev 267697)
@@ -37,7 +37,7 @@
 #include "HTMLParserIdioms.h"
 #include "Hyphenation.h"
 #include "InlineTextBox.h"
-#include "LineLayoutTraversal.h"
+#include "LayoutIntegrationRunIterator.h"
 #include "Range.h"
 #include "RenderBlock.h"
 #include "RenderCombineText.h"
@@ -303,8 +303,8 @@
 
 void RenderText::absoluteRects(Vector<IntRect>& rects, const LayoutPoint& accumulatedOffset) const
 {
-    for (auto& box : LineLayoutTraversal::textBoxesFor(*this)) {
-        auto rect = box.rect();
+    for (auto& run : LayoutIntegration::textRunsFor(*this)) {
+        auto rect = run.rect();
         rects.append(enclosingIntRect(FloatRect(accumulatedOffset + rect.location(), rect.size())));
     }
 }
@@ -408,8 +408,8 @@
     ASSERT(!textRenderer.usesComplexLineLayoutPath());
 
     Vector<FloatQuad> quads;
-    for (auto& box : LineLayoutTraversal::textBoxesFor(textRenderer))
-        quads.append(textRenderer.localToAbsoluteQuad(FloatQuad(box.rect()), UseTransforms, wasFixed));
+    for (auto& run : LayoutIntegration::textRunsFor(textRenderer))
+        quads.append(textRenderer.localToAbsoluteQuad(FloatQuad(run.rect()), UseTransforms, wasFixed));
     return quads;
 }
 
@@ -1035,7 +1035,7 @@
 
 IntPoint RenderText::firstRunLocation() const
 {
-    auto first = LineLayoutTraversal::firstTextBoxFor(*this);
+    auto first = LayoutIntegration::firstTextRunFor(*this);
     if (!first)
         return { };
     return IntPoint(first->rect().location());
@@ -1355,7 +1355,7 @@
 
 IntRect RenderText::linesBoundingBox() const
 {
-    auto first = LineLayoutTraversal::firstTextBoxFor(*this);
+    auto first = LayoutIntegration::firstTextRunFor(*this);
     if (!first)
         return { };
 
@@ -1444,7 +1444,7 @@
 
 int RenderText::caretMinOffset() const
 {
-    auto first = LineLayoutTraversal::firstTextBoxFor(*this);
+    auto first = LayoutIntegration::firstTextRunFor(*this);
     if (!first)
         return 0;
 
@@ -1457,7 +1457,7 @@
 
 int RenderText::caretMaxOffset() const
 {
-    auto first = LineLayoutTraversal::firstTextBoxFor(*this);
+    auto first = LayoutIntegration::firstTextRunFor(*this);
     if (!first)
         return text().length();
 
@@ -1471,9 +1471,9 @@
 unsigned RenderText::countRenderedCharacterOffsetsUntil(unsigned offset) const
 {
     unsigned result = 0;
-    for (auto& box : LineLayoutTraversal::textBoxesFor(*this)) {
-        auto start = box.localStartOffset();
-        auto length = box.length();
+    for (auto& run : LayoutIntegration::textRunsFor(*this)) {
+        auto start = run.localStartOffset();
+        auto length = run.length();
         if (offset < start)
             return result;
         if (offset <= start + length) {
@@ -1488,7 +1488,7 @@
 enum class OffsetType { Character, Caret };
 static bool containsOffset(const RenderText& text, unsigned offset, OffsetType type)
 {
-    for (auto box = LineLayoutTraversal::firstTextBoxInTextOrderFor(text); box; box.traverseNextInTextOrder()) {
+    for (auto box = LayoutIntegration::firstTextRunInTextOrderFor(text); box; box.traverseNextInTextOrder()) {
         auto start = box->localStartOffset();
         if (offset < start)
             return false;
@@ -1517,7 +1517,7 @@
 
 bool RenderText::hasRenderedText() const
 {
-    for (auto& box : LineLayoutTraversal::textBoxesFor(*this)) {
+    for (auto& box : LayoutIntegration::textRunsFor(*this)) {
         if (box.length())
             return true;
     }

Modified: trunk/Source/WebCore/rendering/RenderTreeAsText.cpp (267696 => 267697)


--- trunk/Source/WebCore/rendering/RenderTreeAsText.cpp	2020-09-28 12:25:01 UTC (rev 267696)
+++ trunk/Source/WebCore/rendering/RenderTreeAsText.cpp	2020-09-28 13:42:33 UTC (rev 267697)
@@ -36,7 +36,7 @@
 #include "HTMLNames.h"
 #include "HTMLSpanElement.h"
 #include "InlineTextBox.h"
-#include "LineLayoutTraversal.h"
+#include "LayoutIntegrationRunIterator.h"
 #include "Logging.h"
 #include "PrintContext.h"
 #include "PseudoElement.h"
@@ -203,7 +203,7 @@
         // many test results.
         const RenderText& text = downcast<RenderText>(o);
         r = IntRect(text.firstRunLocation(), text.linesBoundingBox().size());
-        if (!LineLayoutTraversal::firstTextBoxFor(text))
+        if (!LayoutIntegration::firstTextRunFor(text))
             adjustForTableCells = false;
     } else if (o.isBR()) {
         const RenderLineBreak& br = downcast<RenderLineBreak>(o);
@@ -478,26 +478,26 @@
     }
 }
 
-static void writeTextBox(TextStream& ts, const RenderText& o, const LineLayoutTraversal::TextBox& textBox)
+static void writeTextRun(TextStream& ts, const RenderText& o, const LayoutIntegration::TextRun& textRun)
 {
-    auto rect = textBox.rect();
+    auto rect = textRun.rect();
     int x = rect.x();
     int y = rect.y();
     // FIXME: Use non-logical width. webkit.org/b/206809.
-    int logicalWidth = ceilf(rect.x() + (textBox.isHorizontal() ? rect.width() : rect.height())) - x;
+    int logicalWidth = ceilf(rect.x() + (textRun.isHorizontal() ? rect.width() : rect.height())) - x;
     // FIXME: Table cell adjustment is temporary until results can be updated.
     if (is<RenderTableCell>(*o.containingBlock()))
         y -= floorToInt(downcast<RenderTableCell>(*o.containingBlock()).intrinsicPaddingBefore());
         
     ts << "text run at (" << x << "," << y << ") width " << logicalWidth;
-    if (!textBox.isLeftToRightDirection() || textBox.dirOverride()) {
-        ts << (!textBox.isLeftToRightDirection() ? " RTL" : " LTR");
-        if (textBox.dirOverride())
+    if (!textRun.isLeftToRightDirection() || textRun.dirOverride()) {
+        ts << (!textRun.isLeftToRightDirection() ? " RTL" : " LTR");
+        if (textRun.dirOverride())
             ts << " override";
     }
     ts << ": "
-        << quoteAndEscapeNonPrintables(textBox.text());
-    if (textBox.hasHyphen())
+        << quoteAndEscapeNonPrintables(textRun.text());
+    if (textRun.hasHyphen())
         ts << " + hyphen string " << quoteAndEscapeNonPrintables(o.style().hyphenString().string());
     ts << "\n";
 }
@@ -546,9 +546,9 @@
 
     if (is<RenderText>(o)) {
         auto& text = downcast<RenderText>(o);
-        for (auto& textBox : LineLayoutTraversal::textBoxesFor(text)) {
+        for (auto& run : LayoutIntegration::textRunsFor(text)) {
             ts << indent;
-            writeTextBox(ts, text, textBox);
+            writeTextRun(ts, text, run);
         }
     } else {
         for (auto& child : childrenOfType<RenderObject>(downcast<RenderElement>(o))) {

Deleted: trunk/Source/WebCore/rendering/line/LineLayoutTraversal.cpp (267696 => 267697)


--- trunk/Source/WebCore/rendering/line/LineLayoutTraversal.cpp	2020-09-28 12:25:01 UTC (rev 267696)
+++ trunk/Source/WebCore/rendering/line/LineLayoutTraversal.cpp	2020-09-28 13:42:33 UTC (rev 267697)
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2019 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 "LineLayoutTraversal.h"
-
-#include "LayoutIntegrationLineLayout.h"
-#include "RenderBlockFlow.h"
-#include "RenderLineBreak.h"
-
-namespace WebCore {
-namespace LineLayoutTraversal {
-
-TextBoxIterator::TextBoxIterator(Box::PathVariant&& pathVariant)
-    : m_textBox(WTFMove(pathVariant))
-{
-}
-
-TextBoxIterator& TextBoxIterator::traverseNextInVisualOrder()
-{
-    WTF::switchOn(m_textBox.m_pathVariant, [](auto& path) {
-        path.traverseNextTextBoxInVisualOrder();
-    });
-    return *this;
-}
-
-TextBoxIterator& TextBoxIterator::traverseNextInTextOrder()
-{
-    WTF::switchOn(m_textBox.m_pathVariant, [](auto& path) {
-        path.traverseNextTextBoxInTextOrder();
-    });
-    return *this;
-}
-
-bool TextBoxIterator::operator==(const TextBoxIterator& other) const
-{
-    if (m_textBox.m_pathVariant.index() != other.m_textBox.m_pathVariant.index())
-        return false;
-
-    return WTF::switchOn(m_textBox.m_pathVariant, [&](const auto& path) {
-        return path == WTF::get<std::decay_t<decltype(path)>>(other.m_textBox.m_pathVariant);
-    });
-}
-
-bool TextBoxIterator::atEnd() const
-{
-    return WTF::switchOn(m_textBox.m_pathVariant, [](auto& path) {
-        return path.atEnd();
-    });
-}
-
-static const RenderBlockFlow* lineLayoutSystemFlowForRenderer(const RenderObject& renderer)
-{
-    // In currently supported cases the renderer is always direct child of the flow.
-    if (!is<RenderBlockFlow>(*renderer.parent()))
-        return nullptr;
-    return downcast<RenderBlockFlow>(renderer.parent());
-}
-
-TextBoxIterator firstTextBoxFor(const RenderText& text)
-{
-    if (auto* flow = lineLayoutSystemFlowForRenderer(text)) {
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-        if (auto* layoutFormattingContextLineLayout = flow->layoutFormattingContextLineLayout())
-            return layoutFormattingContextLineLayout->textBoxesFor(text);
-#endif
-    }
-
-    return { ComplexPath { text.firstTextBox() } };
-}
-
-TextBoxIterator firstTextBoxInTextOrderFor(const RenderText& text)
-{
-    if (text.firstTextBox() && text.containsReversedText()) {
-        Vector<const InlineTextBox*> sortedTextBoxes;
-        for (auto* textBox = text.firstTextBox(); textBox; textBox = textBox->nextTextBox())
-            sortedTextBoxes.append(textBox);
-        std::sort(sortedTextBoxes.begin(), sortedTextBoxes.end(), InlineTextBox::compareByStart);
-        auto* first = sortedTextBoxes[0];
-        return { ComplexPath { first, WTFMove(sortedTextBoxes), 0 } };
-    }
-
-    return firstTextBoxFor(text);
-}
-
-TextBoxRange textBoxesFor(const RenderText& text)
-{
-    return { firstTextBoxFor(text) };
-}
-
-ElementBoxIterator::ElementBoxIterator(Box::PathVariant&& pathVariant)
-    : m_box(WTFMove(pathVariant))
-{
-}
-
-bool ElementBoxIterator::atEnd() const
-{
-    return WTF::switchOn(m_box.m_pathVariant, [](auto& path) {
-        return path.atEnd();
-    });
-}
-
-ElementBoxIterator elementBoxFor(const RenderLineBreak& renderElement)
-{
-    if (auto* flow = lineLayoutSystemFlowForRenderer(renderElement)) {
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-        if (auto* layoutFormattingContextLineLayout = flow->layoutFormattingContextLineLayout())
-            return layoutFormattingContextLineLayout->elementBoxFor(renderElement);
-#endif
-    }
-
-    return { ComplexPath(renderElement.inlineBoxWrapper()) };
-}
-
-}
-}

Deleted: trunk/Source/WebCore/rendering/line/LineLayoutTraversal.h (267696 => 267697)


--- trunk/Source/WebCore/rendering/line/LineLayoutTraversal.h	2020-09-28 12:25:01 UTC (rev 267696)
+++ trunk/Source/WebCore/rendering/line/LineLayoutTraversal.h	2020-09-28 13:42:33 UTC (rev 267697)
@@ -1,262 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include "InlineElementBox.h"
-#include "LineLayoutTraversalComplexPath.h"
-#include "LineLayoutTraversalDisplayRunPath.h"
-#include <wtf/Variant.h>
-
-namespace WebCore {
-
-class RenderLineBreak;
-class RenderText;
-
-namespace LineLayoutTraversal {
-
-class ElementBoxIterator;
-class TextBoxIterator;
-
-struct EndIterator { };
-
-class Box {
-public:
-    using PathVariant = Variant<
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-        DisplayRunPath,
-#endif
-        ComplexPath
-    >;
-
-    Box(PathVariant&&);
-
-    FloatRect rect() const;
-
-    float baseline() const;
-
-    bool isLeftToRightDirection() const;
-    bool isHorizontal() const;
-    bool dirOverride() const;
-    bool isLineBreak() const;
-    bool useLineBreakBoxRenderTreeDumpQuirk() const;
-
-protected:
-    friend class ElementBoxIterator;
-    friend class TextBoxIterator;
-
-    PathVariant m_pathVariant;
-};
-
-class TextBox : public Box {
-public:
-    TextBox(PathVariant&&);
-
-    bool hasHyphen() const;
-    StringView text() const;
-
-    // These offsets are relative to the text renderer (not flow).
-    unsigned localStartOffset() const;
-    unsigned localEndOffset() const;
-    unsigned length() const;
-
-    bool isLastOnLine() const;
-    bool isLast() const;
-};
-
-class TextBoxIterator {
-public:
-    TextBoxIterator() : m_textBox(ComplexPath { nullptr, { } }) { };
-    TextBoxIterator(Box::PathVariant&&);
-
-    TextBoxIterator& operator++() { return traverseNextInVisualOrder(); }
-    TextBoxIterator& traverseNextInVisualOrder();
-    TextBoxIterator& traverseNextInTextOrder();
-
-    explicit operator bool() const { return !atEnd(); }
-
-    bool operator==(const TextBoxIterator&) const;
-    bool operator!=(const TextBoxIterator& other) const { return !(*this == other); }
-
-    bool operator==(EndIterator) const { return atEnd(); }
-    bool operator!=(EndIterator) const { return !atEnd(); }
-
-    const TextBox& operator*() const { return m_textBox; }
-    const TextBox* operator->() const { return &m_textBox; }
-
-    bool atEnd() const;
-
-private:
-    TextBox m_textBox;
-};
-
-class ElementBoxIterator {
-public:
-    ElementBoxIterator() : m_box(ComplexPath { nullptr, { } }) { };
-    ElementBoxIterator(Box::PathVariant&&);
-
-    explicit operator bool() const { return !atEnd(); }
-
-    const Box& operator*() const { return m_box; }
-    const Box* operator->() const { return &m_box; }
-
-    bool atEnd() const;
-
-private:
-    Box m_box;
-};
-
-class TextBoxRange {
-public:
-    TextBoxRange(TextBoxIterator begin)
-        : m_begin(begin)
-    {
-    }
-
-    TextBoxIterator begin() const { return m_begin; }
-    EndIterator end() const { return { }; }
-
-private:
-    TextBoxIterator m_begin;
-};
-
-TextBoxIterator firstTextBoxFor(const RenderText&);
-TextBoxIterator firstTextBoxInTextOrderFor(const RenderText&);
-TextBoxRange textBoxesFor(const RenderText&);
-ElementBoxIterator elementBoxFor(const RenderLineBreak&);
-
-// -----------------------------------------------
-
-inline Box::Box(PathVariant&& path)
-    : m_pathVariant(WTFMove(path))
-{
-}
-
-inline FloatRect Box::rect() const
-{
-    return WTF::switchOn(m_pathVariant, [](auto& path) {
-        return path.rect();
-    });
-}
-
-inline float Box::baseline() const
-{
-    return WTF::switchOn(m_pathVariant, [](auto& path) {
-        return path.baseline();
-    });
-}
-
-inline bool Box::isLeftToRightDirection() const
-{
-    return WTF::switchOn(m_pathVariant, [](auto& path) {
-        return path.isLeftToRightDirection();
-    });
-}
-
-inline bool Box::isHorizontal() const
-{
-    return WTF::switchOn(m_pathVariant, [](auto& path) {
-        return path.isHorizontal();
-    });
-}
-
-inline bool Box::dirOverride() const
-{
-    return WTF::switchOn(m_pathVariant, [](auto& path) {
-        return path.dirOverride();
-    });
-}
-
-inline bool Box::isLineBreak() const
-{
-    return WTF::switchOn(m_pathVariant, [](auto& path) {
-        return path.isLineBreak();
-    });
-}
-
-inline bool Box::useLineBreakBoxRenderTreeDumpQuirk() const
-{
-    return WTF::switchOn(m_pathVariant, [](auto& path) {
-        return path.useLineBreakBoxRenderTreeDumpQuirk();
-    });
-}
-
-inline bool TextBox::hasHyphen() const
-{
-    return WTF::switchOn(m_pathVariant, [](auto& path) {
-        return path.hasHyphen();
-    });
-}
-
-inline TextBox::TextBox(PathVariant&& path)
-    : Box(WTFMove(path))
-{
-}
-
-inline StringView TextBox::text() const
-{
-    return WTF::switchOn(m_pathVariant, [](auto& path) {
-        return path.text();
-    });
-}
-
-inline unsigned TextBox::localStartOffset() const
-{
-    return WTF::switchOn(m_pathVariant, [](auto& path) {
-        return path.localStartOffset();
-    });
-}
-
-inline unsigned TextBox::localEndOffset() const
-{
-    return WTF::switchOn(m_pathVariant, [](auto& path) {
-        return path.localEndOffset();
-    });
-}
-
-inline unsigned TextBox::length() const
-{
-    return WTF::switchOn(m_pathVariant, [](auto& path) {
-        return path.length();
-    });
-}
-
-inline bool TextBox::isLastOnLine() const
-{
-    return WTF::switchOn(m_pathVariant, [](auto& path) {
-        return path.isLastOnLine();
-    });
-}
-
-inline bool TextBox::isLast() const
-{
-    return WTF::switchOn(m_pathVariant, [](auto& path) {
-        return path.isLast();
-    });
-}
-
-
-}
-}

Deleted: trunk/Source/WebCore/rendering/line/LineLayoutTraversalComplexPath.h (267696 => 267697)


--- trunk/Source/WebCore/rendering/line/LineLayoutTraversalComplexPath.h	2020-09-28 12:25:01 UTC (rev 267696)
+++ trunk/Source/WebCore/rendering/line/LineLayoutTraversalComplexPath.h	2020-09-28 13:42:33 UTC (rev 267697)
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#include "InlineTextBox.h"
-#include "RenderText.h"
-#include <wtf/Vector.h>
-
-namespace WebCore {
-namespace LineLayoutTraversal {
-
-class ComplexPath {
-public:
-    ComplexPath(const InlineBox* inlineBox, Vector<const InlineTextBox*>&& sortedInlineTextBoxes = { }, size_t sortedInlineTextBoxIndex = 0)
-        : m_inlineBox(inlineBox)
-        , m_sortedInlineTextBoxes(WTFMove(sortedInlineTextBoxes))
-        , m_sortedInlineTextBoxIndex(sortedInlineTextBoxIndex)
-    { }
-
-    FloatRect rect() const { return m_inlineBox->frameRect(); }
-
-    bool isLeftToRightDirection() const { return m_inlineBox->isLeftToRightDirection(); }
-    bool isHorizontal() const { return m_inlineBox->isHorizontal(); }
-    bool dirOverride() const { return m_inlineBox->dirOverride(); }
-    bool isLineBreak() const { return m_inlineBox->isLineBreak(); }
-    float baseline() const { return m_inlineBox->baselinePosition(AlphabeticBaseline); }
-
-    bool useLineBreakBoxRenderTreeDumpQuirk() const
-    {
-        return !m_inlineBox->behavesLikeText();
-    }
-
-    bool hasHyphen() const { return inlineTextBox()->hasHyphen(); }
-    StringView text() const { return StringView(inlineTextBox()->renderer().text()).substring(inlineTextBox()->start(), inlineTextBox()->len()); }
-    unsigned localStartOffset() const { return inlineTextBox()->start(); }
-    unsigned localEndOffset() const { return inlineTextBox()->end(); }
-    unsigned length() const { return inlineTextBox()->len(); }
-
-    inline bool isLastOnLine() const
-    {
-        auto* next = nextInlineTextBoxInTextOrder();
-        return !next || &inlineTextBox()->root() != &next->root();
-    }
-    inline bool isLast() const { return !nextInlineTextBoxInTextOrder(); };
-
-    void traverseNextTextBoxInVisualOrder() { m_inlineBox = inlineTextBox()->nextTextBox(); }
-    void traverseNextTextBoxInTextOrder()
-    {
-        m_inlineBox = nextInlineTextBoxInTextOrder();
-        if (!m_sortedInlineTextBoxes.isEmpty())
-            ++m_sortedInlineTextBoxIndex;
-    }
-
-    bool operator==(const ComplexPath& other) const { return m_inlineBox == other.m_inlineBox; }
-    bool atEnd() const { return !m_inlineBox; }
-
-private:
-    const InlineTextBox* inlineTextBox() const { return downcast<InlineTextBox>(m_inlineBox); }
-    const InlineTextBox* nextInlineTextBoxInTextOrder() const;
-
-    const InlineBox* m_inlineBox;
-    Vector<const InlineTextBox*> m_sortedInlineTextBoxes;
-    size_t m_sortedInlineTextBoxIndex { 0 };
-};
-
-inline const InlineTextBox* ComplexPath::nextInlineTextBoxInTextOrder() const
-{
-    if (!m_sortedInlineTextBoxes.isEmpty()) {
-        if (m_sortedInlineTextBoxIndex + 1 < m_sortedInlineTextBoxes.size())
-            return m_sortedInlineTextBoxes[m_sortedInlineTextBoxIndex + 1];
-        return nullptr;
-    }
-    return inlineTextBox()->nextTextBox();
-}
-
-}
-}

Deleted: trunk/Source/WebCore/rendering/line/LineLayoutTraversalDisplayRunPath.h (267696 => 267697)


--- trunk/Source/WebCore/rendering/line/LineLayoutTraversalDisplayRunPath.h	2020-09-28 12:25:01 UTC (rev 267696)
+++ trunk/Source/WebCore/rendering/line/LineLayoutTraversalDisplayRunPath.h	2020-09-28 13:42:33 UTC (rev 267697)
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-#pragma once
-
-#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
-
-#include "DisplayInlineContent.h"
-
-namespace WebCore {
-
-namespace LineLayoutTraversal {
-
-static FloatPoint linePosition(float left, float top)
-{
-    return FloatPoint(left, roundf(top));
-}
-
-class DisplayRunPath {
-public:
-    DisplayRunPath(const Display::InlineContent& inlineContent, size_t startIndex, size_t endIndex)
-        : m_inlineContent(&inlineContent)
-        , m_endIndex(endIndex)
-        , m_runIndex(startIndex)
-    { }
-    DisplayRunPath(DisplayRunPath&&) = default;
-    DisplayRunPath(const DisplayRunPath&) = default;
-    DisplayRunPath& operator=(const DisplayRunPath&) = default;
-    DisplayRunPath& operator=(DisplayRunPath&&) = default;
-
-    FloatRect rect() const;
-
-    float baseline() const { return line().baseline(); }
-
-    bool isLeftToRightDirection() const { return true; }
-    bool isHorizontal() const { return true; }
-    bool dirOverride() const { return false; }
-    bool isLineBreak() const { return run().isLineBreak(); }
-
-    bool useLineBreakBoxRenderTreeDumpQuirk() const
-    {
-        if (!m_runIndex)
-            return false;
-        auto& previous = runs()[m_runIndex - 1];
-        return previous.lineIndex() == run().lineIndex();
-    }
-
-    bool hasHyphen() const { return run().textContent()->needsHyphen(); }
-    StringView text() const { return run().textContent()->content(); }
-    unsigned localStartOffset() const { return run().textContent()->start(); }
-    unsigned localEndOffset() const { return run().textContent()->end(); }
-    unsigned length() const { return run().textContent()->length(); }
-
-    bool isLastOnLine() const
-    {
-        if (isLast())
-            return true;
-        auto& next = runs()[m_runIndex + 1];
-        return run().lineIndex() != next.lineIndex();
-    }
-    bool isLast() const
-    {
-        return m_runIndex + 1 == m_endIndex;
-    };
-
-    void traverseNextTextBoxInVisualOrder()
-    {
-        ASSERT(!atEnd());
-        ++m_runIndex;
-    }
-    void traverseNextTextBoxInTextOrder() {  traverseNextTextBoxInVisualOrder(); }
-
-    bool operator==(const DisplayRunPath& other) const { return m_inlineContent == other.m_inlineContent && m_runIndex == other.m_runIndex; }
-    bool atEnd() const { return m_runIndex == m_endIndex; }
-
-private:
-    const Display::InlineContent::Runs& runs() const { return m_inlineContent->runs; }
-    const Display::Run& run() const { return runs()[m_runIndex]; }
-    const Display::Line& line() const { return m_inlineContent->lineForRun(run()); }
-
-    RefPtr<const Display::InlineContent> m_inlineContent;
-    size_t m_endIndex { 0 };
-    size_t m_runIndex { 0 };
-};
-
-inline FloatRect DisplayRunPath::rect() const
-{
-    auto rect = run().rect();
-    auto position = linePosition(rect.x(), rect.y());
-    return { position, rect.size() };
-}
-
-}
-}
-
-#endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to