Title: [283554] trunk/Source/WebCore
Revision
283554
Author
[email protected]
Date
2021-10-05 09:46:59 -0700 (Tue, 05 Oct 2021)

Log Message

[LFC][Integration] Introduce InlineBoxIterator
https://bugs.webkit.org/show_bug.cgi?id=231233

Reviewed by Alan Bujtas.

And use it in InlineBoxPainter.

The adoption is still incomplete here so only the legacy path is covered.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* layout/integration/InlineIteratorBox.h:
(WebCore::InlineIterator::Box::isInlineBox const):
(WebCore::InlineIterator::Box::isRootInlineBox const):
* layout/integration/InlineIteratorBoxLegacyPath.h:
(WebCore::InlineIterator::BoxLegacyPath::isInlineBox const):
(WebCore::InlineIterator::BoxLegacyPath::isRootInlineBox const):
(WebCore::InlineIterator::BoxLegacyPath::traverseNextInlineBox):
(WebCore::InlineIterator::BoxLegacyPath::traversePreviousInlineBox):
(WebCore::InlineIterator::BoxLegacyPath::inlineFlowBox const):
* layout/integration/InlineIteratorBoxModernPath.h:
(WebCore::InlineIterator::BoxModernPath::isInlineBox const):
(WebCore::InlineIterator::BoxModernPath::isRootInlineBox const):
(WebCore::InlineIterator::BoxModernPath::traverseNextInlineBox):
(WebCore::InlineIterator::BoxModernPath::traversePreviousInlineBox):
* layout/integration/InlineIteratorInlineBox.cpp: Added.
(WebCore::InlineIterator::InlineBox::InlineBox):
(WebCore::InlineIterator::InlineBox::nextInlineBox const):
(WebCore::InlineIterator::InlineBox::previousInlineBox const):
(WebCore::InlineIterator::InlineBoxIterator::InlineBoxIterator):
(WebCore::InlineIterator::InlineBoxIterator::traverseNextInlineBox):
(WebCore::InlineIterator::InlineBoxIterator::traversePreviousInlineBox):
(WebCore::InlineIterator::inlineBoxFor):
* layout/integration/InlineIteratorInlineBox.h: Added.
(WebCore::InlineIterator::InlineBox::renderer const):
(WebCore::InlineIterator::InlineBox::legacyInlineBox const):
(WebCore::InlineIterator::InlineBoxIterator::InlineBoxIterator):
(WebCore::InlineIterator::InlineBoxIterator::operator* const):
(WebCore::InlineIterator::InlineBoxIterator::operator-> const):
(WebCore::InlineIterator::InlineBoxIterator::get const):
(WebCore::InlineIterator::InlineBox::iterator const):
(isType):
* rendering/InlineBoxPainter.cpp:
(WebCore::InlineBoxPainter::InlineBoxPainter):
(WebCore::clipRectForNinePieceImageStrip):
(WebCore::InlineBoxPainter::paintMask):
(WebCore::InlineBoxPainter::paintDecorations):
(WebCore::InlineBoxPainter::paintFillLayer):
(WebCore::InlineBoxPainter::paintBoxShadow):
(WebCore::InlineBoxPainter::constrainToLineTopAndBottomIfNeeded const):
* rendering/InlineBoxPainter.h:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (283553 => 283554)


--- trunk/Source/WebCore/ChangeLog	2021-10-05 16:43:49 UTC (rev 283553)
+++ trunk/Source/WebCore/ChangeLog	2021-10-05 16:46:59 UTC (rev 283554)
@@ -1,5 +1,59 @@
 2021-10-05  Antti Koivisto  <[email protected]>
 
+        [LFC][Integration] Introduce InlineBoxIterator
+        https://bugs.webkit.org/show_bug.cgi?id=231233
+
+        Reviewed by Alan Bujtas.
+
+        And use it in InlineBoxPainter.
+
+        The adoption is still incomplete here so only the legacy path is covered.
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * layout/integration/InlineIteratorBox.h:
+        (WebCore::InlineIterator::Box::isInlineBox const):
+        (WebCore::InlineIterator::Box::isRootInlineBox const):
+        * layout/integration/InlineIteratorBoxLegacyPath.h:
+        (WebCore::InlineIterator::BoxLegacyPath::isInlineBox const):
+        (WebCore::InlineIterator::BoxLegacyPath::isRootInlineBox const):
+        (WebCore::InlineIterator::BoxLegacyPath::traverseNextInlineBox):
+        (WebCore::InlineIterator::BoxLegacyPath::traversePreviousInlineBox):
+        (WebCore::InlineIterator::BoxLegacyPath::inlineFlowBox const):
+        * layout/integration/InlineIteratorBoxModernPath.h:
+        (WebCore::InlineIterator::BoxModernPath::isInlineBox const):
+        (WebCore::InlineIterator::BoxModernPath::isRootInlineBox const):
+        (WebCore::InlineIterator::BoxModernPath::traverseNextInlineBox):
+        (WebCore::InlineIterator::BoxModernPath::traversePreviousInlineBox):
+        * layout/integration/InlineIteratorInlineBox.cpp: Added.
+        (WebCore::InlineIterator::InlineBox::InlineBox):
+        (WebCore::InlineIterator::InlineBox::nextInlineBox const):
+        (WebCore::InlineIterator::InlineBox::previousInlineBox const):
+        (WebCore::InlineIterator::InlineBoxIterator::InlineBoxIterator):
+        (WebCore::InlineIterator::InlineBoxIterator::traverseNextInlineBox):
+        (WebCore::InlineIterator::InlineBoxIterator::traversePreviousInlineBox):
+        (WebCore::InlineIterator::inlineBoxFor):
+        * layout/integration/InlineIteratorInlineBox.h: Added.
+        (WebCore::InlineIterator::InlineBox::renderer const):
+        (WebCore::InlineIterator::InlineBox::legacyInlineBox const):
+        (WebCore::InlineIterator::InlineBoxIterator::InlineBoxIterator):
+        (WebCore::InlineIterator::InlineBoxIterator::operator* const):
+        (WebCore::InlineIterator::InlineBoxIterator::operator-> const):
+        (WebCore::InlineIterator::InlineBoxIterator::get const):
+        (WebCore::InlineIterator::InlineBox::iterator const):
+        (isType):
+        * rendering/InlineBoxPainter.cpp:
+        (WebCore::InlineBoxPainter::InlineBoxPainter):
+        (WebCore::clipRectForNinePieceImageStrip):
+        (WebCore::InlineBoxPainter::paintMask):
+        (WebCore::InlineBoxPainter::paintDecorations):
+        (WebCore::InlineBoxPainter::paintFillLayer):
+        (WebCore::InlineBoxPainter::paintBoxShadow):
+        (WebCore::InlineBoxPainter::constrainToLineTopAndBottomIfNeeded const):
+        * rendering/InlineBoxPainter.h:
+
+2021-10-05  Antti Koivisto  <[email protected]>
+
         Remove m_autoShrinkToFitEnabled from RuleSet
         https://bugs.webkit.org/show_bug.cgi?id=231214
 

Modified: trunk/Source/WebCore/Sources.txt (283553 => 283554)


--- trunk/Source/WebCore/Sources.txt	2021-10-05 16:43:49 UTC (rev 283553)
+++ trunk/Source/WebCore/Sources.txt	2021-10-05 16:46:59 UTC (rev 283554)
@@ -1511,6 +1511,7 @@
 layout/formattingContexts/inline/invalidation/InlineInvalidation.cpp
 layout/formattingContexts/inline/text/TextUtil.cpp
 layout/integration/InlineIteratorBox.cpp
+layout/integration/InlineIteratorInlineBox.cpp
 layout/integration/InlineIteratorLine.cpp
 layout/integration/InlineIteratorTextBox.cpp
 layout/integration/LayoutIntegrationBoxTree.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (283553 => 283554)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-10-05 16:43:49 UTC (rev 283553)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-10-05 16:46:59 UTC (rev 283554)
@@ -5210,6 +5210,7 @@
 		E401E0A41C3C0B8300F34D10 /* StyleChange.h in Headers */ = {isa = PBXBuildFile; fileRef = E401E0A31C3C0B8300F34D10 /* StyleChange.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E403B7A2251B11930019E800 /* LayoutIntegrationCoverage.h in Headers */ = {isa = PBXBuildFile; fileRef = E403B7A1251B11930019E800 /* LayoutIntegrationCoverage.h */; };
 		E403B7A3251B11C10019E800 /* LayoutIntegrationPagination.h in Headers */ = {isa = PBXBuildFile; fileRef = E4312AB724B3265600678349 /* LayoutIntegrationPagination.h */; };
+		E415EB13270C351300E8DA1B /* InlineIteratorInlineBox.h in Headers */ = {isa = PBXBuildFile; fileRef = E415EB11270C351200E8DA1B /* InlineIteratorInlineBox.h */; };
 		E418025523D4549B00FFB071 /* LayoutIntegrationBoxTree.h in Headers */ = {isa = PBXBuildFile; fileRef = E418025323D4549A00FFB071 /* LayoutIntegrationBoxTree.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E419041F1CC6486B00C35F5D /* FontSelectorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = E419041E1CC6486B00C35F5D /* FontSelectorClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E42050172141901B0066EF3B /* ProcessWarming.h in Headers */ = {isa = PBXBuildFile; fileRef = E42050142141901A0066EF3B /* ProcessWarming.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -5271,8 +5272,8 @@
 		E47C39321FE6E10500BBBC6B /* RenderTreeBuilderList.h in Headers */ = {isa = PBXBuildFile; fileRef = E47C39281FE6E0DD00BBBC6B /* RenderTreeBuilderList.h */; };
 		E47C39331FE6E10800BBBC6B /* RenderTreeBuilderMultiColumn.h in Headers */ = {isa = PBXBuildFile; fileRef = E47C39271FE6E0DC00BBBC6B /* RenderTreeBuilderMultiColumn.h */; };
 		E47CEBC92706EF5200B8D8F5 /* InlineWalker.h in Headers */ = {isa = PBXBuildFile; fileRef = E47CEBC72706EF5100B8D8F5 /* InlineWalker.h */; };
+		E47CEBE12709916D00B8D8F5 /* InlineIteratorTextBox.h in Headers */ = {isa = PBXBuildFile; fileRef = E47CEBE02709916D00B8D8F5 /* InlineIteratorTextBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E47CEBEA2709DFD100B8D8F5 /* RuleSetBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = E47CEBE82709DFD000B8D8F5 /* RuleSetBuilder.h */; };
-		E47CEBE12709916D00B8D8F5 /* InlineIteratorTextBox.h in Headers */ = {isa = PBXBuildFile; fileRef = E47CEBE02709916D00B8D8F5 /* InlineIteratorTextBox.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E47E276516036ED200EE2AFB /* ExtensionStyleSheets.h in Headers */ = {isa = PBXBuildFile; fileRef = E47E276416036ED200EE2AFB /* ExtensionStyleSheets.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E47FC8A325B84D72005495FC /* LoadSchedulingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = E47FC8A125B84D71005495FC /* LoadSchedulingMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E48137B91DB3B526005C59BF /* StyleValidity.h in Headers */ = {isa = PBXBuildFile; fileRef = E48137B81DB3B526005C59BF /* StyleValidity.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -16426,6 +16427,8 @@
 		E403B79F251B118B0019E800 /* LayoutIntegrationCoverage.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutIntegrationCoverage.cpp; sourceTree = "<group>"; };
 		E403B7A1251B11930019E800 /* LayoutIntegrationCoverage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutIntegrationCoverage.h; sourceTree = "<group>"; };
 		E406F3FB1198307D009D59D6 /* ColorData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ColorData.cpp; path = DerivedSources/WebCore/ColorData.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
+		E415EB11270C351200E8DA1B /* InlineIteratorInlineBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineIteratorInlineBox.h; sourceTree = "<group>"; };
+		E415EB14270C353700E8DA1B /* InlineIteratorInlineBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InlineIteratorInlineBox.cpp; sourceTree = "<group>"; };
 		E418025323D4549A00FFB071 /* LayoutIntegrationBoxTree.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LayoutIntegrationBoxTree.h; sourceTree = "<group>"; };
 		E418025623D454B500FFB071 /* LayoutIntegrationBoxTree.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutIntegrationBoxTree.cpp; sourceTree = "<group>"; };
 		E419041E1CC6486B00C35F5D /* FontSelectorClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontSelectorClient.h; sourceTree = "<group>"; };
@@ -16534,10 +16537,10 @@
 		E47C392B1FE6E0DF00BBBC6B /* RenderTreeBuilderList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderTreeBuilderList.cpp; sourceTree = "<group>"; };
 		E47C392C1FE6E0DF00BBBC6B /* RenderTreeUpdater.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderTreeUpdater.h; sourceTree = "<group>"; };
 		E47CEBC72706EF5100B8D8F5 /* InlineWalker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineWalker.h; sourceTree = "<group>"; };
+		E47CEBDE2709916400B8D8F5 /* InlineIteratorTextBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InlineIteratorTextBox.cpp; sourceTree = "<group>"; };
+		E47CEBE02709916D00B8D8F5 /* InlineIteratorTextBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineIteratorTextBox.h; sourceTree = "<group>"; };
 		E47CEBE82709DFD000B8D8F5 /* RuleSetBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RuleSetBuilder.h; sourceTree = "<group>"; };
 		E47CEBEB2709DFDC00B8D8F5 /* RuleSetBuilder.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RuleSetBuilder.cpp; sourceTree = "<group>"; };
-		E47CEBDE2709916400B8D8F5 /* InlineIteratorTextBox.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = InlineIteratorTextBox.cpp; sourceTree = "<group>"; };
-		E47CEBE02709916D00B8D8F5 /* InlineIteratorTextBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InlineIteratorTextBox.h; sourceTree = "<group>"; };
 		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>"; };
 		E47FC8A125B84D71005495FC /* LoadSchedulingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoadSchedulingMode.h; sourceTree = "<group>"; };
@@ -29506,6 +29509,8 @@
 				E4A664C62521B778007081DC /* InlineIteratorBox.h */,
 				E4A664C52521B778007081DC /* InlineIteratorBoxLegacyPath.h */,
 				E4A664C42521B777007081DC /* InlineIteratorBoxModernPath.h */,
+				E415EB14270C353700E8DA1B /* InlineIteratorInlineBox.cpp */,
+				E415EB11270C351200E8DA1B /* InlineIteratorInlineBox.h */,
 				E4D33F42252C50A800837D05 /* InlineIteratorLine.cpp */,
 				E4D33F3F252C4B8200837D05 /* InlineIteratorLine.h */,
 				E4D33F43252C50E200837D05 /* InlineIteratorLineLegacyPath.h */,
@@ -33028,6 +33033,7 @@
 				E4A664CC2521D4AF007081DC /* InlineIteratorBox.h in Headers */,
 				E4A664CF2521D4E2007081DC /* InlineIteratorBoxLegacyPath.h in Headers */,
 				E4A664CE2521D4C9007081DC /* InlineIteratorBoxModernPath.h in Headers */,
+				E415EB13270C351300E8DA1B /* InlineIteratorInlineBox.h in Headers */,
 				E4D33F41252C4B8300837D05 /* InlineIteratorLine.h in Headers */,
 				E4D33F44252C50E200837D05 /* InlineIteratorLineLegacyPath.h in Headers */,
 				E4D33F46252C50FC00837D05 /* InlineIteratorLineModernPath.h in Headers */,

Modified: trunk/Source/WebCore/layout/integration/InlineIteratorBox.h (283553 => 283554)


--- trunk/Source/WebCore/layout/integration/InlineIteratorBox.h	2021-10-05 16:43:49 UTC (rev 283553)
+++ trunk/Source/WebCore/layout/integration/InlineIteratorBox.h	2021-10-05 16:46:59 UTC (rev 283554)
@@ -57,6 +57,8 @@
     Box(PathVariant&&);
 
     bool isText() const;
+    bool isInlineBox() const;
+    bool isRootInlineBox() const;
 
     FloatRect rect() const;
 
@@ -100,6 +102,7 @@
 
 protected:
     friend class BoxIterator;
+    friend class InlineBoxIterator;
     friend class LeafBoxIterator;
     friend class TextBoxIterator;
 
@@ -169,6 +172,20 @@
     });
 }
 
+inline bool Box::isInlineBox() const
+{
+    return WTF::switchOn(m_pathVariant, [](auto& path) {
+        return path.isInlineBox();
+    });
+}
+
+inline bool Box::isRootInlineBox() const
+{
+    return WTF::switchOn(m_pathVariant, [](auto& path) {
+        return path.isRootInlineBox();
+    });
+}
+
 inline FloatRect Box::rect() const
 {
     return WTF::switchOn(m_pathVariant, [](auto& path) {

Modified: trunk/Source/WebCore/layout/integration/InlineIteratorBoxLegacyPath.h (283553 => 283554)


--- trunk/Source/WebCore/layout/integration/InlineIteratorBoxLegacyPath.h	2021-10-05 16:43:49 UTC (rev 283553)
+++ trunk/Source/WebCore/layout/integration/InlineIteratorBoxLegacyPath.h	2021-10-05 16:46:59 UTC (rev 283554)
@@ -54,6 +54,8 @@
     }
 
     bool isText() const { return m_inlineBox->isInlineTextBox(); }
+    bool isInlineBox() const { return m_inlineBox->isInlineFlowBox(); }
+    bool isRootInlineBox() const { return m_inlineBox->isRootInlineBox(); }
 
     FloatRect rect() const { return m_inlineBox->frameRect(); }
 
@@ -117,6 +119,16 @@
         traversePreviousInlineBoxInCacheOrder();
     }
 
+    void traverseNextInlineBox()
+    {
+        m_inlineBox = inlineFlowBox()->nextLineBox();
+    }
+
+    void traversePreviousInlineBox()
+    {
+        m_inlineBox = inlineFlowBox()->prevLineBox();
+    }
+
     bool operator==(const BoxLegacyPath& other) const { return m_inlineBox == other.m_inlineBox; }
 
     bool atEnd() const { return !m_inlineBox; }
@@ -126,6 +138,7 @@
 
 private:
     const LegacyInlineTextBox* inlineTextBox() const { return downcast<LegacyInlineTextBox>(m_inlineBox); }
+    const LegacyInlineFlowBox* inlineFlowBox() const { return downcast<LegacyInlineFlowBox>(m_inlineBox); }
 
     static Vector<const LegacyInlineBox*> inlineBoxesInLogicalOrder(const LegacyRootInlineBox& root)
     {

Modified: trunk/Source/WebCore/layout/integration/InlineIteratorBoxModernPath.h (283553 => 283554)


--- trunk/Source/WebCore/layout/integration/InlineIteratorBoxModernPath.h	2021-10-05 16:43:49 UTC (rev 283553)
+++ trunk/Source/WebCore/layout/integration/InlineIteratorBoxModernPath.h	2021-10-05 16:46:59 UTC (rev 283554)
@@ -48,6 +48,8 @@
     }
 
     bool isText() const { return !!box().text(); }
+    bool isInlineBox() const { return box().isInlineBox(); }
+    bool isRootInlineBox() const { return box().isRootInlineBox(); }
 
     FloatRect rect() const { return box().logicalRect(); }
 
@@ -174,6 +176,32 @@
         traversePreviousOnLine();
     }
 
+    void traverseNextInlineBox()
+    {
+        ASSERT(box().isInlineBox());
+
+        // FIXME: This always searches to the end.
+        auto& layoutBox = box().layoutBox();
+        do {
+            traverseNextBox();
+        } while (!atEnd() && &box().layoutBox() != &layoutBox);
+
+        ASSERT(atEnd() || box().isInlineBox());
+    }
+
+    void traversePreviousInlineBox()
+    {
+        ASSERT(box().isInlineBox());
+
+        // FIXME: This always searches to the beginning.
+        auto& layoutBox = box().layoutBox();
+        do {
+            traversePreviousBox();
+        } while (!atEnd() && &box().layoutBox() != &layoutBox);
+
+        ASSERT(atEnd() || box().isInlineBox());
+    }
+
     bool operator==(const BoxModernPath& other) const { return m_inlineContent == other.m_inlineContent && m_boxIndex == other.m_boxIndex; }
 
     bool atEnd() const { return m_boxIndex == boxes().size(); }
@@ -181,19 +209,29 @@
     auto& inlineContent() const { return *m_inlineContent; }
 
 private:
+    void traverseNextBox()
+    {
+        ASSERT(!atEnd());
+        ++m_boxIndex;
+    }
+
+    void traversePreviousBox()
+    {
+        ASSERT(!atEnd());
+        m_boxIndex = m_boxIndex ? m_boxIndex - 1 : boxes().size();
+    }
+
     void traverseNextLeaf()
     {
-        ASSERT(!atEnd());
         do {
-            ++m_boxIndex;
+            traverseNextBox();
         } while (!atEnd() && box().isInlineBox());
     }
 
     void traversePreviousLeaf()
     {
-        ASSERT(!atEnd());
         do {
-            m_boxIndex = m_boxIndex ? m_boxIndex - 1 : boxes().size();
+            traversePreviousBox();
         } while (!atEnd() && box().isInlineBox());
     }
 

Added: trunk/Source/WebCore/layout/integration/InlineIteratorInlineBox.cpp (0 => 283554)


--- trunk/Source/WebCore/layout/integration/InlineIteratorInlineBox.cpp	                        (rev 0)
+++ trunk/Source/WebCore/layout/integration/InlineIteratorInlineBox.cpp	2021-10-05 16:46:59 UTC (rev 283554)
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2021 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 "InlineIteratorInlineBox.h"
+
+#include "LayoutIntegrationLineLayout.h"
+
+namespace WebCore {
+namespace InlineIterator {
+
+InlineBox::InlineBox(PathVariant&& path)
+    : Box(WTFMove(path))
+{
+}
+
+InlineBoxIterator InlineBox::nextInlineBox() const
+{
+    return InlineBoxIterator(*this).traverseNextInlineBox();
+}
+
+InlineBoxIterator InlineBox::previousInlineBox() const
+{
+    return InlineBoxIterator(*this).traversePreviousInlineBox();
+}
+
+InlineBoxIterator::InlineBoxIterator(Box::PathVariant&& pathVariant)
+    : BoxIterator(WTFMove(pathVariant))
+{
+}
+
+InlineBoxIterator::InlineBoxIterator(const Box& box)
+    : BoxIterator(box)
+{
+}
+
+InlineBoxIterator& InlineBoxIterator::traverseNextInlineBox()
+{
+    WTF::switchOn(m_box.m_pathVariant, [](auto& path) {
+        path.traverseNextInlineBox();
+    });
+    return *this;
+}
+
+InlineBoxIterator& InlineBoxIterator::traversePreviousInlineBox()
+{
+    WTF::switchOn(m_box.m_pathVariant, [](auto& path) {
+        path.traversePreviousInlineBox();
+    });
+    return *this;
+}
+
+InlineBoxIterator inlineBoxFor(const LegacyInlineFlowBox& legacyInlineFlowBox)
+{
+    return { BoxLegacyPath { &legacyInlineFlowBox } };
+}
+
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+InlineBoxIterator inlineBoxFor(const LayoutIntegration::InlineContent& content, size_t boxIndex)
+{
+    ASSERT(content.boxes[boxIndex].isInlineBox());
+    return { BoxModernPath { content, boxIndex } };
+}
+#endif
+
+}
+}

Added: trunk/Source/WebCore/layout/integration/InlineIteratorInlineBox.h (0 => 283554)


--- trunk/Source/WebCore/layout/integration/InlineIteratorInlineBox.h	                        (rev 0)
+++ trunk/Source/WebCore/layout/integration/InlineIteratorInlineBox.h	2021-10-05 16:46:59 UTC (rev 283554)
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2021 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 "InlineIteratorBox.h"
+
+namespace WebCore {
+
+namespace InlineIterator {
+
+class InlineBoxIterator;
+
+class InlineBox : public Box {
+public:
+    InlineBox(PathVariant&&);
+
+    const RenderBoxModelObject& renderer() const { return downcast<RenderBoxModelObject>(Box::renderer()); }
+
+    // FIXME: Remove. For intermediate porting steps only.
+    const LegacyInlineFlowBox* legacyInlineBox() const { return downcast<LegacyInlineFlowBox>(Box::legacyInlineBox()); }
+
+    InlineBoxIterator nextInlineBox() const;
+    InlineBoxIterator previousInlineBox() const;
+    InlineBoxIterator iterator() const;
+};
+
+class InlineBoxIterator : public BoxIterator {
+public:
+    InlineBoxIterator() { }
+    InlineBoxIterator(Box::PathVariant&&);
+    InlineBoxIterator(const Box&);
+
+    const InlineBox& operator*() const { return get(); }
+    const InlineBox* operator->() const { return &get(); }
+
+    InlineBoxIterator& traverseNextInlineBox();
+    InlineBoxIterator& traversePreviousInlineBox();
+
+private:
+    const InlineBox& get() const { return downcast<InlineBox>(m_box); }
+};
+
+InlineBoxIterator inlineBoxFor(const LegacyInlineFlowBox&);
+#if ENABLE(LAYOUT_FORMATTING_CONTEXT)
+InlineBoxIterator inlineBoxFor(const LayoutIntegration::InlineContent&, size_t boxIndex);
+#endif
+
+inline InlineBoxIterator InlineBox::iterator() const
+{
+    return { *this };
+}
+
+}
+}
+
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::InlineIterator::InlineBox)
+static bool isType(const WebCore::InlineIterator::Box& box) { return box.isInlineBox(); }
+SPECIALIZE_TYPE_TRAITS_END()
+
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::InlineIterator::InlineBoxIterator)
+static bool isType(const WebCore::InlineIterator::BoxIterator& box) { return !box || box->isInlineBox(); }
+SPECIALIZE_TYPE_TRAITS_END()

Modified: trunk/Source/WebCore/rendering/InlineBoxPainter.cpp (283553 => 283554)


--- trunk/Source/WebCore/rendering/InlineBoxPainter.cpp	2021-10-05 16:43:49 UTC (rev 283553)
+++ trunk/Source/WebCore/rendering/InlineBoxPainter.cpp	2021-10-05 16:46:59 UTC (rev 283554)
@@ -26,6 +26,7 @@
 #include "InlineBoxPainter.h"
 
 #include "GraphicsContext.h"
+#include "InlineIteratorLine.h"
 #include "LegacyInlineFlowBox.h"
 #include "PaintInfo.h"
 #include "RenderBlockFlow.h"
@@ -36,12 +37,12 @@
 namespace WebCore {
 
 InlineBoxPainter::InlineBoxPainter(const LegacyInlineFlowBox& inlineBox, PaintInfo& paintInfo, const LayoutPoint& paintOffset)
-    : m_inlineBox(inlineBox)
+    : m_inlineBox(*InlineIterator::inlineBoxFor(inlineBox))
     , m_paintInfo(paintInfo)
     , m_paintOffset(paintOffset)
     , m_renderer(m_inlineBox.renderer())
-    , m_isFirstLine(m_inlineBox.isFirstLine())
-    , m_isRootInlineBox(is<RenderBlockFlow>(m_renderer))
+    , m_isFirstLine(m_inlineBox.line()->isFirst())
+    , m_isRootInlineBox(m_inlineBox.isRootInlineBox())
     , m_isHorizontal(m_inlineBox.isHorizontal())
 {
 }
@@ -94,28 +95,28 @@
     paintDecorations();
 }
 
-static LayoutRect clipRectForNinePieceImageStrip(const LegacyInlineFlowBox* box, const NinePieceImage& image, const LayoutRect& paintRect)
+static LayoutRect clipRectForNinePieceImageStrip(const InlineIterator::InlineBox& box, const NinePieceImage& image, const LayoutRect& paintRect)
 {
     LayoutRect clipRect(paintRect);
-    auto& style = box->renderer().style();
+    auto& style = box.renderer().style();
     LayoutBoxExtent outsets = style.imageOutsets(image);
-    if (box->isHorizontal()) {
+    if (box.isHorizontal()) {
         clipRect.setY(paintRect.y() - outsets.top());
         clipRect.setHeight(paintRect.height() + outsets.top() + outsets.bottom());
-        if (box->includeLogicalLeftEdge()) {
+        if (box.legacyInlineBox()->includeLogicalLeftEdge()) {
             clipRect.setX(paintRect.x() - outsets.left());
             clipRect.setWidth(paintRect.width() + outsets.left());
         }
-        if (box->includeLogicalRightEdge())
+        if (box.legacyInlineBox()->includeLogicalRightEdge())
             clipRect.setWidth(clipRect.width() + outsets.right());
     } else {
         clipRect.setX(paintRect.x() - outsets.left());
         clipRect.setWidth(paintRect.width() + outsets.left() + outsets.right());
-        if (box->includeLogicalLeftEdge()) {
+        if (box.legacyInlineBox()->includeLogicalLeftEdge()) {
             clipRect.setY(paintRect.y() - outsets.top());
             clipRect.setHeight(paintRect.height() + outsets.top());
         }
-        if (box->includeLogicalRightEdge())
+        if (box.legacyInlineBox()->includeLogicalRightEdge())
             clipRect.setHeight(clipRect.height() + outsets.bottom());
     }
     return clipRect;
@@ -126,12 +127,12 @@
     if (!m_paintInfo.shouldPaintWithinRoot(renderer()) || renderer().style().visibility() != Visibility::Visible || m_paintInfo.phase != PaintPhase::Mask)
         return;
 
-    LayoutRect frameRect(m_inlineBox.frameRect());
+    LayoutRect frameRect(m_inlineBox.rect());
     constrainToLineTopAndBottomIfNeeded(frameRect);
 
     // Move x/y to our coordinates.
     LayoutRect localRect(frameRect);
-    m_inlineBox.root().blockFlow().flipForWritingMode(localRect);
+    m_inlineBox.line()->containingBlock().flipForWritingMode(localRect);
     LayoutPoint adjustedPaintOffset = m_paintOffset + localRect.location();
 
     const NinePieceImage& maskNinePieceImage = renderer().style().maskBoxImage();
@@ -165,7 +166,7 @@
         return; // Don't paint anything while we wait for the image to load.
     }
 
-    bool hasSingleLine = !m_inlineBox.prevLineBox() && !m_inlineBox.nextLineBox();
+    bool hasSingleLine = !m_inlineBox.previousInlineBox() && !m_inlineBox.nextInlineBox();
     if (hasSingleLine)
         renderer().paintNinePieceImage(m_paintInfo.context(), LayoutRect(adjustedPaintOffset, frameRect.size()), renderer().style(), maskNinePieceImage, compositeOp);
     else {
@@ -172,17 +173,17 @@
         // We have a mask image that spans multiple lines.
         // We need to adjust _tx and _ty by the width of all previous lines.
         LayoutUnit logicalOffsetOnLine;
-        for (auto* curr = m_inlineBox.prevLineBox(); curr; curr = curr->prevLineBox())
-            logicalOffsetOnLine += curr->logicalWidth();
+        for (auto box = m_inlineBox.previousInlineBox(); box; box.traversePreviousInlineBox())
+            logicalOffsetOnLine += box->logicalWidth();
         LayoutUnit totalLogicalWidth = logicalOffsetOnLine;
-        for (auto* curr = &m_inlineBox; curr; curr = curr->nextLineBox())
-            totalLogicalWidth += curr->logicalWidth();
+        for (auto box = m_inlineBox.iterator(); box; box.traverseNextInlineBox())
+            totalLogicalWidth += box->logicalWidth();
         LayoutUnit stripX = adjustedPaintOffset.x() - (isHorizontal() ? logicalOffsetOnLine : 0_lu);
         LayoutUnit stripY = adjustedPaintOffset.y() - (isHorizontal() ? 0_lu : logicalOffsetOnLine);
         LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : frameRect.width();
         LayoutUnit stripHeight = isHorizontal() ? frameRect.height() : totalLogicalWidth;
 
-        LayoutRect clipRect = clipRectForNinePieceImageStrip(&m_inlineBox, maskNinePieceImage, paintRect);
+        LayoutRect clipRect = clipRectForNinePieceImageStrip(m_inlineBox, maskNinePieceImage, paintRect);
         GraphicsContextStateSaver stateSaver(m_paintInfo.context());
         m_paintInfo.context().clip(clipRect);
         renderer().paintNinePieceImage(m_paintInfo.context(), LayoutRect(stripX, stripY, stripWidth, stripHeight), renderer().style(), maskNinePieceImage, compositeOp);
@@ -206,18 +207,18 @@
     if (m_isRootInlineBox && (!m_isFirstLine || &style == &renderer().style()))
         return;
 
-    LayoutRect frameRect(m_inlineBox.frameRect());
+    LayoutRect frameRect(m_inlineBox.rect());
     constrainToLineTopAndBottomIfNeeded(frameRect);
 
     // Move x/y to our coordinates.
     LayoutRect localRect(frameRect);
-    m_inlineBox.root().blockFlow().flipForWritingMode(localRect);
+    m_inlineBox.line()->containingBlock().flipForWritingMode(localRect);
 
     LayoutPoint adjustedPaintoffset = m_paintOffset + localRect.location();
     GraphicsContext& context = m_paintInfo.context();
     LayoutRect paintRect = LayoutRect(adjustedPaintoffset, frameRect.size());
     // Shadow comes first and is behind the background and border.
-    if (!renderer().boxShadowShouldBeAppliedToBackground(adjustedPaintoffset, BackgroundBleedNone, &m_inlineBox))
+    if (!renderer().boxShadowShouldBeAppliedToBackground(adjustedPaintoffset, BackgroundBleedNone, m_inlineBox.legacyInlineBox()))
         paintBoxShadow(ShadowStyle::Normal, paintRect);
 
     auto color = style.visitedDependentColor(CSSPropertyBackgroundColor);
@@ -239,9 +240,9 @@
     if (hasBorderImage && !borderImageSource->isLoaded())
         return; // Don't paint anything while we wait for the image to load.
 
-    bool hasSingleLine = !m_inlineBox.prevLineBox() && !m_inlineBox.nextLineBox();
+    bool hasSingleLine = !m_inlineBox.previousInlineBox() && !m_inlineBox.nextInlineBox();
     if (!hasBorderImage || hasSingleLine) {
-        renderer().paintBorder(m_paintInfo, paintRect, style, BackgroundBleedNone, m_inlineBox.includeLogicalLeftEdge(), m_inlineBox.includeLogicalRightEdge());
+        renderer().paintBorder(m_paintInfo, paintRect, style, BackgroundBleedNone, m_inlineBox.legacyInlineBox()->includeLogicalLeftEdge(), m_inlineBox.legacyInlineBox()->includeLogicalRightEdge());
         return;
     }
 
@@ -254,11 +255,11 @@
     // FIXME: What the heck do we do with RTL here? The math we're using is obviously not right,
     // but it isn't even clear how this should work at all.
     LayoutUnit logicalOffsetOnLine;
-    for (auto* curr = m_inlineBox.prevLineBox(); curr; curr = curr->prevLineBox())
-        logicalOffsetOnLine += curr->logicalWidth();
+    for (auto box = m_inlineBox.previousInlineBox(); box; box.traversePreviousInlineBox())
+        logicalOffsetOnLine += box->logicalWidth();
     LayoutUnit totalLogicalWidth = logicalOffsetOnLine;
-    for (auto* curr = &m_inlineBox; curr; curr = curr->nextLineBox())
-        totalLogicalWidth += curr->logicalWidth();
+    for (auto box = m_inlineBox.iterator(); box; box.traverseNextInlineBox())
+        totalLogicalWidth += box->logicalWidth();
 
     LayoutUnit stripX = adjustedPaintoffset.x() - (isHorizontal() ? logicalOffsetOnLine : 0_lu);
     LayoutUnit stripY = adjustedPaintoffset.y() - (isHorizontal() ? 0_lu : logicalOffsetOnLine);
@@ -265,7 +266,7 @@
     LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : frameRect.width();
     LayoutUnit stripHeight = isHorizontal() ? frameRect.height() : totalLogicalWidth;
 
-    LayoutRect clipRect = clipRectForNinePieceImageStrip(&m_inlineBox, borderImage, paintRect);
+    LayoutRect clipRect = clipRectForNinePieceImageStrip(m_inlineBox, borderImage, paintRect);
     GraphicsContextStateSaver stateSaver(context);
     context.clip(clipRect);
     renderer().paintBorder(m_paintInfo, LayoutRect(stripX, stripY, stripWidth, stripHeight), style);
@@ -286,10 +287,10 @@
     auto* image = fillLayer.image();
     bool hasFillImage = image && image->canRender(&renderer(), renderer().style().effectiveZoom());
     bool hasFillImageOrBorderRadious = hasFillImage || renderer().style().hasBorderRadius();
-    bool hasSingleLine = !m_inlineBox.prevLineBox() && !m_inlineBox.nextLineBox();
+    bool hasSingleLine = !m_inlineBox.previousInlineBox() && !m_inlineBox.nextInlineBox();
 
     if (!hasFillImageOrBorderRadious || hasSingleLine || m_isRootInlineBox) {
-        renderer().paintFillLayerExtended(m_paintInfo, color, fillLayer, rect, BackgroundBleedNone, &m_inlineBox, rect.size(), op);
+        renderer().paintFillLayerExtended(m_paintInfo, color, fillLayer, rect, BackgroundBleedNone, m_inlineBox.legacyInlineBox(), rect.size(), op);
         return;
     }
 
@@ -296,8 +297,8 @@
 #if ENABLE(CSS_BOX_DECORATION_BREAK)
     if (renderer().style().boxDecorationBreak() == BoxDecorationBreak::Clone) {
         GraphicsContextStateSaver stateSaver(m_paintInfo.context());
-        m_paintInfo.context().clip({ rect.x(), rect.y(), LayoutUnit(m_inlineBox.width()), LayoutUnit(m_inlineBox.height()) });
-        renderer().paintFillLayerExtended(m_paintInfo, color, fillLayer, rect, BackgroundBleedNone, &m_inlineBox, rect.size(), op);
+        m_paintInfo.context().clip({ rect.x(), rect.y(), LayoutUnit(m_inlineBox.rect().width()), LayoutUnit(m_inlineBox.rect().height()) });
+        renderer().paintFillLayerExtended(m_paintInfo, color, fillLayer, rect, BackgroundBleedNone, m_inlineBox.legacyInlineBox(), rect.size(), op);
         return;
     }
 #endif
@@ -311,31 +312,31 @@
     LayoutUnit logicalOffsetOnLine;
     LayoutUnit totalLogicalWidth;
     if (renderer().style().direction() == TextDirection::LTR) {
-        for (auto* curr = m_inlineBox.prevLineBox(); curr; curr = curr->prevLineBox())
-            logicalOffsetOnLine += curr->logicalWidth();
+        for (auto box = m_inlineBox.previousInlineBox(); box; box.traversePreviousInlineBox())
+            logicalOffsetOnLine += box->logicalWidth();
         totalLogicalWidth = logicalOffsetOnLine;
-        for (auto* curr = &m_inlineBox; curr; curr = curr->nextLineBox())
-            totalLogicalWidth += curr->logicalWidth();
+        for (auto box = m_inlineBox.iterator(); box; box.traverseNextInlineBox())
+            totalLogicalWidth += box->logicalWidth();
     } else {
-        for (auto* curr = m_inlineBox.nextLineBox(); curr; curr = curr->nextLineBox())
-            logicalOffsetOnLine += curr->logicalWidth();
+        for (auto box = m_inlineBox.nextInlineBox(); box; box.traverseNextInlineBox())
+            logicalOffsetOnLine += box->logicalWidth();
         totalLogicalWidth = logicalOffsetOnLine;
-        for (auto* curr = &m_inlineBox; curr; curr = curr->prevLineBox())
-            totalLogicalWidth += curr->logicalWidth();
+        for (auto box = m_inlineBox.iterator(); box; box.traversePreviousInlineBox())
+            totalLogicalWidth += box->logicalWidth();
     }
     LayoutUnit stripX = rect.x() - (isHorizontal() ? logicalOffsetOnLine : 0_lu);
     LayoutUnit stripY = rect.y() - (isHorizontal() ? 0_lu : logicalOffsetOnLine);
-    LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : LayoutUnit(m_inlineBox.width());
-    LayoutUnit stripHeight = isHorizontal() ? LayoutUnit(m_inlineBox.height()) : totalLogicalWidth;
+    LayoutUnit stripWidth = isHorizontal() ? totalLogicalWidth : LayoutUnit(m_inlineBox.rect().width());
+    LayoutUnit stripHeight = isHorizontal() ? LayoutUnit(m_inlineBox.rect().height()) : totalLogicalWidth;
 
     GraphicsContextStateSaver stateSaver(m_paintInfo.context());
-    m_paintInfo.context().clip({ rect.x(), rect.y(), LayoutUnit(m_inlineBox.width()), LayoutUnit(m_inlineBox.height()) });
-    renderer().paintFillLayerExtended(m_paintInfo, color, fillLayer, LayoutRect(stripX, stripY, stripWidth, stripHeight), BackgroundBleedNone, &m_inlineBox, rect.size(), op);
+    m_paintInfo.context().clip({ rect.x(), rect.y(), LayoutUnit(m_inlineBox.rect().width()), LayoutUnit(m_inlineBox.rect().height()) });
+    renderer().paintFillLayerExtended(m_paintInfo, color, fillLayer, LayoutRect(stripX, stripY, stripWidth, stripHeight), BackgroundBleedNone, m_inlineBox.legacyInlineBox(), rect.size(), op);
 }
 
 void InlineBoxPainter::paintBoxShadow(ShadowStyle shadowStyle, const LayoutRect& paintRect)
 {
-    bool hasSingleLine = !m_inlineBox.prevLineBox() && !m_inlineBox.nextLineBox();
+    bool hasSingleLine = !m_inlineBox.previousInlineBox() && !m_inlineBox.nextInlineBox();
     if (hasSingleLine || m_isRootInlineBox) {
         renderer().paintBoxShadow(m_paintInfo, paintRect, style(), shadowStyle);
         return;
@@ -343,7 +344,7 @@
 
     // FIXME: We can do better here in the multi-line case. We want to push a clip so that the shadow doesn't
     // protrude incorrectly at the edges, and we want to possibly include shadows cast from the previous/following lines
-    renderer().paintBoxShadow(m_paintInfo, paintRect, style(), shadowStyle, m_inlineBox.includeLogicalLeftEdge(), m_inlineBox.includeLogicalRightEdge());
+    renderer().paintBoxShadow(m_paintInfo, paintRect, style(), shadowStyle, m_inlineBox.legacyInlineBox()->includeLogicalLeftEdge(), m_inlineBox.legacyInlineBox()->includeLogicalRightEdge());
 }
 
 void InlineBoxPainter::constrainToLineTopAndBottomIfNeeded(LayoutRect& rect) const
@@ -350,16 +351,16 @@
 {
     if (renderer().document().inNoQuirksMode())
         return;
-    if (m_inlineBox.hasTextChildren())
+    if (m_inlineBox.legacyInlineBox()->hasTextChildren())
         return;
-    if (m_inlineBox.descendantsHaveSameLineHeightAndBaseline() && m_inlineBox.hasTextDescendants())
+    if (m_inlineBox.legacyInlineBox()->descendantsHaveSameLineHeightAndBaseline() && m_inlineBox.legacyInlineBox()->hasTextDescendants())
         return;
 
     LayoutUnit logicalTop = isHorizontal() ? rect.y() : rect.x();
     LayoutUnit logicalHeight = isHorizontal() ? rect.height() : rect.width();
 
-    LayoutUnit bottom = std::min(m_inlineBox.root().lineBottom(), logicalTop + logicalHeight);
-    logicalTop = std::max(m_inlineBox.root().lineTop(), logicalTop);
+    LayoutUnit bottom = std::min(m_inlineBox.line()->bottom(), logicalTop + logicalHeight);
+    logicalTop = std::max(m_inlineBox.line()->top(), logicalTop);
     logicalHeight = bottom - logicalTop;
     if (isHorizontal()) {
         rect.setY(logicalTop);

Modified: trunk/Source/WebCore/rendering/InlineBoxPainter.h (283553 => 283554)


--- trunk/Source/WebCore/rendering/InlineBoxPainter.h	2021-10-05 16:43:49 UTC (rev 283553)
+++ trunk/Source/WebCore/rendering/InlineBoxPainter.h	2021-10-05 16:46:59 UTC (rev 283554)
@@ -26,6 +26,7 @@
 
 #include "FloatRect.h"
 #include "GraphicsTypes.h"
+#include "InlineIteratorInlineBox.h"
 #include "LayoutRect.h"
 #include "ShadowData.h"
 
@@ -59,7 +60,7 @@
     RenderBoxModelObject& renderer() const { return const_cast<RenderBoxModelObject&>(m_renderer); }
     bool isHorizontal() const { return m_isHorizontal; }
 
-    const LegacyInlineFlowBox& m_inlineBox;
+    const InlineIterator::InlineBox m_inlineBox;
     PaintInfo& m_paintInfo;
     const LayoutPoint m_paintOffset;
     const RenderBoxModelObject& m_renderer;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to