Title: [266155] trunk/Source/WebCore
Revision
266155
Author
[email protected]
Date
2020-08-25 18:31:55 -0700 (Tue, 25 Aug 2020)

Log Message

[LFC][IFC] Do not move the runs out of the LineBuilder while closing the line
https://bugs.webkit.org/show_bug.cgi?id=214790

Reviewed by Antti Koivisto.

Closing the line should not mean that the LineBuilder does not have the line runs anymore.
This is in preparation for moving alignment code from LineBuilder to LineBox.
(This patch also refactors InlineFormattingContext::lineLayout to make it less verbose.)

* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::lineLayout):
(WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthForConstraint const):
(WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine):
* layout/inlineformatting/InlineFormattingContext.h:
* layout/inlineformatting/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::initialize):
(WebCore::Layout::LineBuilder::close):
(WebCore::Layout::LineBuilder::append):
* layout/inlineformatting/InlineLineBuilder.h:
(WebCore::Layout::LineBuilder::runs const):
* layout/inlineformatting/LineLayoutContext.cpp:
(WebCore::Layout::LineLayoutContext::layoutInlineContent):
(WebCore::Layout::LineLayoutContext::close):
(WebCore::Layout::LineLayoutContext::nextContentForLine):
(WebCore::Layout::LineLayoutContext::commitFloats):
(WebCore::Layout::LineLayoutContext::layoutLine): Deleted.
* layout/inlineformatting/LineLayoutContext.h:
(WebCore::Layout::LineLayoutContext::InlineItemRange::isEmpty const):
(WebCore::Layout::LineLayoutContext::InlineItemRange::size const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (266154 => 266155)


--- trunk/Source/WebCore/ChangeLog	2020-08-26 00:08:37 UTC (rev 266154)
+++ trunk/Source/WebCore/ChangeLog	2020-08-26 01:31:55 UTC (rev 266155)
@@ -1,3 +1,35 @@
+2020-08-25  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Do not move the runs out of the LineBuilder while closing the line
+        https://bugs.webkit.org/show_bug.cgi?id=214790
+
+        Reviewed by Antti Koivisto.
+
+        Closing the line should not mean that the LineBuilder does not have the line runs anymore.
+        This is in preparation for moving alignment code from LineBuilder to LineBox. 
+        (This patch also refactors InlineFormattingContext::lineLayout to make it less verbose.)
+
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::lineLayout):
+        (WebCore::Layout::InlineFormattingContext::computedIntrinsicWidthForConstraint const):
+        (WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine):
+        * layout/inlineformatting/InlineFormattingContext.h:
+        * layout/inlineformatting/InlineLineBuilder.cpp:
+        (WebCore::Layout::LineBuilder::initialize):
+        (WebCore::Layout::LineBuilder::close):
+        (WebCore::Layout::LineBuilder::append):
+        * layout/inlineformatting/InlineLineBuilder.h:
+        (WebCore::Layout::LineBuilder::runs const):
+        * layout/inlineformatting/LineLayoutContext.cpp:
+        (WebCore::Layout::LineLayoutContext::layoutInlineContent):
+        (WebCore::Layout::LineLayoutContext::close):
+        (WebCore::Layout::LineLayoutContext::nextContentForLine):
+        (WebCore::Layout::LineLayoutContext::commitFloats):
+        (WebCore::Layout::LineLayoutContext::layoutLine): Deleted.
+        * layout/inlineformatting/LineLayoutContext.h:
+        (WebCore::Layout::LineLayoutContext::InlineItemRange::isEmpty const):
+        (WebCore::Layout::LineLayoutContext::InlineItemRange::size const):
+
 2020-08-25  Tim Horton  <[email protected]>
 
         Web Share API can share non-HTTP(S) URLs

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (266154 => 266155)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2020-08-26 00:08:37 UTC (rev 266154)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2020-08-26 01:31:55 UTC (rev 266155)
@@ -131,56 +131,53 @@
     LOG_WITH_STREAM(FormattingContextLayout, stream << "[End] -> inline formatting context -> formatting root(" << &root() << ")");
 }
 
-void InlineFormattingContext::lineLayout(InlineItems& inlineItems, LineLayoutContext::InlineItemRange layoutRange, const ConstraintsForInFlowContent& constraints)
+void InlineFormattingContext::lineLayout(InlineItems& inlineItems, LineLayoutContext::InlineItemRange needsLayoutRange, const ConstraintsForInFlowContent& constraints)
 {
     auto lineLogicalTop = constraints.vertical.logicalTop;
-    struct PreviousLineEnd {
-        unsigned runIndex;
+    struct PreviousLine {
+        LineLayoutContext::InlineItemRange range;
         Optional<unsigned> overflowContentLength;
     };
-    Optional<PreviousLineEnd> previousLineEnd;
-    auto lineBuilder = LineBuilder { *this, root().style().textAlign(), LineBuilder::IntrinsicSizing::No };
+    Optional<PreviousLine> previousLine;
+    auto line = LineBuilder { *this, root().style().textAlign(), LineBuilder::IntrinsicSizing::No };
     auto lineLayoutContext = LineLayoutContext { *this, root(), inlineItems };
 
-    while (!layoutRange.isEmpty()) {
-        lineBuilder.initialize(constraintsForLine(constraints.horizontal, lineLogicalTop));
-        auto lineContent = lineLayoutContext.layoutLine(lineBuilder, layoutRange, previousLineEnd ? previousLineEnd->overflowContentLength : WTF::nullopt);
-        setDisplayBoxesForLine(lineContent, constraints.horizontal);
+    while (!needsLayoutRange.isEmpty()) {
+        line.initialize(constraintsForLine(constraints.horizontal, lineLogicalTop));
+        // Turn previous line's overflow content length into the next line's leading content partial length.
+        // "sp[<-line break->]lit_content" -> overflow length: 11 -> leading partial content length: 11.
+        auto partialLeadingContentLength = previousLine ? previousLine->overflowContentLength : WTF::nullopt;
+        auto lineContent = lineLayoutContext.layoutInlineContent(line, needsLayoutRange, partialLeadingContentLength);
+        setDisplayBoxesForLine(line, lineContent, constraints.horizontal);
 
-        if (lineContent.trailingInlineItemIndex) {
-            lineLogicalTop = lineContent.lineBox.logicalBottom();
+        auto lineContentRange = lineContent.inlineItems;
+        if (!lineContentRange.isEmpty()) {
+            ASSERT(needsLayoutRange.start < lineContentRange.end);
+            lineLogicalTop = line.lineBox().logicalBottom();
             // When the trailing content is partial, we need to reuse the last InlineTextItem.
-            auto trailingRunIndex = *lineContent.trailingInlineItemIndex;
-            if (lineContent.partialContent) {
+            auto lastInlineItemNeedsPartialLayout = lineContent.partialContent.hasValue();
+            if (lastInlineItemNeedsPartialLayout) {
                 ASSERT(lineContent.partialContent->overflowContentLength);
-                // Turn previous line's overflow content length into the next line's leading content partial length.
-                // "sp<->litcontent" -> overflow length: 10 -> leading partial content length: 10.
-                auto isNewInlineContent = !previousLineEnd
-                    || trailingRunIndex > previousLineEnd->runIndex
-                    || (previousLineEnd->overflowContentLength && *previousLineEnd->overflowContentLength > lineContent.partialContent->overflowContentLength);
-                if (isNewInlineContent) {
-                    // Strart the next line with the same, partial trailing InlineTextItem.
-                    previousLineEnd = PreviousLineEnd { trailingRunIndex, lineContent.partialContent->overflowContentLength };
-                    layoutRange.start = previousLineEnd->runIndex;
-                } else {
+                auto lineLayoutHasAdvanced = !previousLine
+                    || lineContentRange.end > previousLine->range.end
+                    || (previousLine->overflowContentLength && *previousLine->overflowContentLength > lineContent.partialContent->overflowContentLength);
+                if (!lineLayoutHasAdvanced) {
                     ASSERT_NOT_REACHED();
                     // Move over to the next run if we are stuck on this partial content (when the overflow content length remains the same).
-                    // We certainly lose some content, but we would be busy looping anyway.
-                    previousLineEnd = PreviousLineEnd { trailingRunIndex, { } };
-                    layoutRange.start = previousLineEnd->runIndex + 1;
+                    // We certainly lose some content, but we would be busy looping otherwise.
+                    lastInlineItemNeedsPartialLayout = false;
                 }
-            } else {
-                previousLineEnd = PreviousLineEnd { trailingRunIndex, { } };
-                layoutRange.start = previousLineEnd->runIndex + 1;
             }
+            needsLayoutRange.start = lastInlineItemNeedsPartialLayout ? lineContentRange.end - 1 : lineContentRange.end;
+            previousLine = PreviousLine { lineContentRange, lineContent.partialContent ? makeOptional(lineContent.partialContent->overflowContentLength) : WTF::nullopt };
             continue;
         }
         // Floats prevented us placing any content on the line.
-        ASSERT(lineContent.runList.isEmpty());
-        ASSERT(lineBuilder.hasIntrusiveFloat());
+        ASSERT(line.runs().isEmpty());
+        ASSERT(line.hasIntrusiveFloat());
         // Move the next line below the intrusive float.
         auto floatingContext = FloatingContext { root(), *this, formattingState().floatingState() };
-        auto floatConstraints = floatingContext.constraints(lineLogicalTop, toLayoutUnit(lineContent.lineBox.logicalBottom()));
+        auto floatConstraints = floatingContext.constraints(lineLogicalTop, toLayoutUnit(line.lineBox().logicalBottom()));
         ASSERT(floatConstraints.left || floatConstraints.right);
         static auto inifitePoint = PointInContextRoot::max();
         // In case of left and right constraints, we need to pick the one that's closer to the current line.
@@ -251,16 +248,16 @@
 {
     auto& inlineItems = formattingState().inlineItems();
     auto maximumLineWidth = InlineLayoutUnit { };
-    auto lineBuilder = LineBuilder { *this, root().style().textAlign(), LineBuilder::IntrinsicSizing::Yes };
+    auto line = LineBuilder { *this, root().style().textAlign(), LineBuilder::IntrinsicSizing::Yes };
     auto lineLayoutContext = LineLayoutContext { *this, root(), inlineItems };
     auto layoutRange = LineLayoutContext::InlineItemRange { 0 , inlineItems.size() };
     while (!layoutRange.isEmpty()) {
         // Only the horiztonal available width is constrained when computing intrinsic width.
-        lineBuilder.initialize(LineBuilder::Constraints { { }, availableWidth, { }, false });
-        auto lineContent = lineLayoutContext.layoutLine(lineBuilder, layoutRange, { });
-        layoutRange.start = *lineContent.trailingInlineItemIndex + 1;
+        line.initialize(LineBuilder::Constraints { { }, availableWidth, { }, false });
+        auto lineContent = lineLayoutContext.layoutInlineContent(line, layoutRange, { });
+        layoutRange.start = lineContent.inlineItems.end;
         // FIXME: Use line logical left and right to take floats into account.
-        maximumLineWidth = std::max(maximumLineWidth, lineContent.lineBox.logicalWidth());
+        maximumLineWidth = std::max(maximumLineWidth, line.lineBox().logicalWidth());
     }
     return maximumLineWidth;
 }
@@ -464,10 +461,10 @@
     return LineBuilder::Constraints { { lineLogicalLeft, lineLogicalTop }, lineLogicalRight - lineLogicalLeft, initialLineHeight, lineIsConstrainedByFloat };
 }
 
-void InlineFormattingContext::setDisplayBoxesForLine(const LineLayoutContext::LineContent& lineContent, const HorizontalConstraints& horizontalConstraints)
+void InlineFormattingContext::setDisplayBoxesForLine(const LineBuilder& line, const LineLayoutContext::LineContent& lineContent, const HorizontalConstraints& horizontalConstraints)
 {
     auto& formattingState = this->formattingState();
-    auto& lineBox = lineContent.lineBox;
+    auto& lineBox = line.lineBox();
 
     if (!lineContent.floats.isEmpty()) {
         auto floatingContext = FloatingContext { root(), *this, formattingState.floatingState() };
@@ -476,7 +473,7 @@
             auto& floatBox = floatCandidate.item->layoutBox();
             auto& displayBox = formattingState.displayBox(floatBox);
             // Set static position first.
-            auto verticalStaticPosition = floatCandidate.isIntrusive == LineLayoutContext::LineContent::Float::Intrusive::Yes ? lineBox.logicalTop() : lineBox.logicalBottom();
+            auto verticalStaticPosition = floatCandidate.isIntrusive ? lineBox.logicalTop() : lineBox.logicalBottom();
             displayBox.setTopLeft({ lineBox.logicalLeft(), verticalStaticPosition });
             // Float it.
             displayBox.setTopLeft(floatingContext.positionForFloat(floatBox, horizontalConstraints));
@@ -494,7 +491,7 @@
     auto lineIndex = inlineContent.lineBoxes.size();
     auto lineInkOverflow = lineBox.scrollableOverflow();
     // Compute box final geometry.
-    auto& lineRuns = lineContent.runList;
+    auto& lineRuns = line.runs();
     for (unsigned index = 0; index < lineRuns.size(); ++index) {
         auto& lineRun = lineRuns.at(index);
         auto& logicalRect = lineRun.logicalRect();

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h (266154 => 266155)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h	2020-08-26 00:08:37 UTC (rev 266154)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.h	2020-08-26 01:31:55 UTC (rev 266155)
@@ -88,7 +88,7 @@
 
     void collectInlineContentIfNeeded();
     LineBuilder::Constraints constraintsForLine(const HorizontalConstraints&, InlineLayoutUnit lineLogicalTop);
-    void setDisplayBoxesForLine(const LineLayoutContext::LineContent&, const HorizontalConstraints&);
+    void setDisplayBoxesForLine(const LineBuilder&, const LineLayoutContext::LineContent&, const HorizontalConstraints&);
     void invalidateFormattingState(const InvalidationState&);
 
     const InlineFormattingState& formattingState() const { return downcast<InlineFormattingState>(FormattingContext::formattingState()); }

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp (266154 => 266155)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp	2020-08-26 00:08:37 UTC (rev 266154)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.cpp	2020-08-26 01:31:55 UTC (rev 266155)
@@ -89,11 +89,13 @@
         m_initialStrut = AscentAndDescent { ascentAndDescent.ascent, initialLineHeight - ascentAndDescent.ascent };
     else
         m_initialStrut = { };
-
-    resetContent();
+    clear();
+#if ASSERT_ENABLED
+    m_isClosed = false;
+#endif
 }
 
-void LineBuilder::resetContent()
+void LineBuilder::clear()
 {
     m_lineBox.setLogicalWidth({ });
     m_lineBox.setIsConsideredEmpty();
@@ -102,14 +104,17 @@
     m_lineIsVisuallyEmptyBeforeTrimmableTrailingContent = { };
 }
 
-LineBuilder::RunList LineBuilder::close(IsLastLineWithInlineContent isLastLineWithInlineContent)
+void LineBuilder::close(IsLastLineWithInlineContent isLastLineWithInlineContent)
 {
+#if ASSERT_ENABLED
+    m_isClosed = true;
+#endif
     // 1. Remove trimmable trailing content.
     // 2. Align merged runs both vertically and horizontally.
     removeTrailingTrimmableContent();
     visuallyCollapsePreWrapOverflowContent();
     if (m_isIntrinsicSizing)
-        return WTFMove(m_runs);
+        return;
 
     auto hangingContent = collectHangingContent(isLastLineWithInlineContent);
     adjustBaselineAndLineHeight();
@@ -124,7 +129,6 @@
     }
     alignContentVertically();
     alignHorizontally(hangingContent, isLastLineWithInlineContent);
-    return WTFMove(m_runs);
 }
 
 void LineBuilder::alignContentVertically()
@@ -403,6 +407,7 @@
 
 void LineBuilder::append(const InlineItem& inlineItem, InlineLayoutUnit logicalWidth)
 {
+    ASSERT(!m_isClosed);
     appendWith(inlineItem, { logicalWidth, false });
 }
 

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h (266154 => 266155)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h	2020-08-26 00:08:37 UTC (rev 266154)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBuilder.h	2020-08-26 01:31:55 UTC (rev 266155)
@@ -55,9 +55,13 @@
     ~LineBuilder();
 
     void initialize(const Constraints&);
+
+    enum class IsLastLineWithInlineContent { No, Yes };
+    void close(IsLastLineWithInlineContent);
+
     void append(const InlineItem&, InlineLayoutUnit logicalWidth);
     void appendPartialTrailingTextItem(const InlineTextItem&, InlineLayoutUnit logicalWidth, bool needsHypen);
-    void resetContent();
+    void clear();
     bool isVisuallyEmpty() const { return m_lineBox.isConsideredEmpty(); }
     bool hasIntrusiveFloat() const { return m_hasIntrusiveFloat; }
     InlineLayoutUnit availableWidth() const { return logicalWidth() - contentLogicalWidth(); }
@@ -140,8 +144,7 @@
         unsigned m_expansionOpportunityCount { 0 };
     };
     using RunList = Vector<Run, 10>;
-    enum class IsLastLineWithInlineContent { No, Yes };
-    RunList close(IsLastLineWithInlineContent = IsLastLineWithInlineContent::No);
+    const RunList& runs() const { return m_runs; }
 
     static AscentAndDescent halfLeadingMetrics(const FontMetrics&, InlineLayoutUnit lineLogicalHeight);
 
@@ -223,6 +226,9 @@
     LineBox m_lineBox;
     Optional<bool> m_lineIsVisuallyEmptyBeforeTrimmableTrailingContent;
     bool m_shouldIgnoreTrailingLetterSpacing { false };
+#if ASSERT_ENABLED
+    bool m_isClosed { false };
+#endif
 };
 
 inline void LineBuilder::TrimmableTrailingContent::reset()

Modified: trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.cpp (266154 => 266155)


--- trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.cpp	2020-08-26 00:08:37 UTC (rev 266154)
+++ trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.cpp	2020-08-26 01:31:55 UTC (rev 266155)
@@ -286,7 +286,7 @@
 {
 }
 
-LineLayoutContext::LineContent LineLayoutContext::layoutLine(LineBuilder& line, const InlineItemRange layoutRange, Optional<unsigned> partialLeadingContentLength)
+LineLayoutContext::LineContent LineLayoutContext::layoutInlineContent(LineBuilder& line, const InlineItemRange& layoutRange, Optional<unsigned> partialLeadingContentLength)
 {
     ASSERT(m_floats.isEmpty());
     m_partialLeadingTextItem = { };
@@ -325,27 +325,16 @@
     return close(line, layoutRange, committedInlineItemCount, { });
 }
 
-LineLayoutContext::LineContent LineLayoutContext::close(LineBuilder& line, const InlineItemRange layoutRange, unsigned committedInlineItemCount, Optional<LineContent::PartialContent> partialContent)
+LineLayoutContext::LineContent LineLayoutContext::close(LineBuilder& line, const InlineItemRange& layoutRange, unsigned committedInlineItemCount, Optional<LineContent::PartialContent> partialContent)
 {
     ASSERT(committedInlineItemCount || !m_floats.isEmpty() || line.hasIntrusiveFloat());
-    if (!committedInlineItemCount) {
-        if (m_floats.isEmpty()) {
-            // We didn't manage to add a run or a float at this vertical position.
-            return LineContent { { }, { }, WTFMove(m_floats), line.close(), line.lineBox() };
-        }
-        unsigned trailingInlineItemIndex = layoutRange.start + m_floats.size() - 1;
-        return LineContent { trailingInlineItemIndex, { }, WTFMove(m_floats), line.close(), line.lineBox() };
-    }
-    // Adjust hyphenated line count.
-    if (partialContent && partialContent->trailingContentHasHyphen)
-        ++m_successiveHyphenatedLineCount;
-    else
-        m_successiveHyphenatedLineCount = 0;
-    ASSERT(committedInlineItemCount);
-    unsigned trailingInlineItemIndex = layoutRange.start + committedInlineItemCount + m_floats.size() - 1;
-    ASSERT(trailingInlineItemIndex < layoutRange.end);
+    auto numberOfCommittedItems = committedInlineItemCount + m_floats.size();
+    auto trailingInlineItemIndex = layoutRange.start + numberOfCommittedItems - 1;
+    auto lineRange = InlineItemRange { layoutRange.start, trailingInlineItemIndex + 1 };
+    ASSERT(lineRange.end <= layoutRange.end);
+
     auto isLastLineWithInlineContent = [&] {
-        if (trailingInlineItemIndex == layoutRange.end - 1)
+        if (lineRange.end == layoutRange.end)
             return LineBuilder::IsLastLineWithInlineContent::Yes;
         if (partialContent)
             return LineBuilder::IsLastLineWithInlineContent::No;
@@ -358,10 +347,13 @@
         ASSERT_NOT_REACHED();
         return LineBuilder::IsLastLineWithInlineContent::No;
     }();
-    return LineContent { trailingInlineItemIndex, partialContent, WTFMove(m_floats), line.close(isLastLineWithInlineContent), line.lineBox() };
+    line.close(isLastLineWithInlineContent);
+    // Adjust hyphenated line count.
+    m_successiveHyphenatedLineCount = partialContent && partialContent->trailingContentHasHyphen ? m_successiveHyphenatedLineCount + 1 : 0;
+    return LineContent { partialContent, lineRange, WTFMove(m_floats) };
 }
 
-void LineLayoutContext::nextContentForLine(LineCandidate& lineCandidate, unsigned currentInlineItemIndex, const InlineItemRange layoutRange, Optional<unsigned> partialLeadingContentLength, InlineLayoutUnit availableLineWidth, InlineLayoutUnit currentLogicalRight)
+void LineLayoutContext::nextContentForLine(LineCandidate& lineCandidate, unsigned currentInlineItemIndex, const InlineItemRange& layoutRange, Optional<unsigned> partialLeadingContentLength, InlineLayoutUnit availableLineWidth, InlineLayoutUnit currentLogicalRight)
 {
     ASSERT(currentInlineItemIndex < layoutRange.end);
     lineCandidate.reset();
@@ -417,7 +409,7 @@
     for (auto& floatCandidate : floatContent.list()) {
         if (!floatCandidate.isIntrusive && commitIntrusiveOnly == CommitIntrusiveFloatsOnly::Yes)
             continue;
-        m_floats.append({ floatCandidate.isIntrusive? LineContent::Float::Intrusive::Yes : LineContent::Float::Intrusive::No, floatCandidate.item });
+        m_floats.append({ floatCandidate.isIntrusive, floatCandidate.item });
         if (floatCandidate.isIntrusive) {
             hasIntrusiveFloat = true;
             // This float is intrusive and it shrinks the current line.
@@ -528,7 +520,7 @@
 size_t LineLayoutContext::rebuildLine(LineBuilder& line, const InlineItemRange& layoutRange)
 {
     // Clear the line and start appending the inline items closing with the last wrap opportunity run.
-    line.resetContent();
+    line.clear();
     auto currentItemIndex = layoutRange.start;
     auto logicalRight = InlineLayoutUnit { };
     if (m_partialLeadingTextItem) {

Modified: trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.h (266154 => 266155)


--- trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.h	2020-08-26 00:08:37 UTC (rev 266154)
+++ trunk/Source/WebCore/layout/inlineformatting/LineLayoutContext.h	2020-08-26 01:31:55 UTC (rev 266155)
@@ -39,33 +39,30 @@
 public:
     LineLayoutContext(const InlineFormattingContext&, const ContainerBox& formattingContextRoot, const InlineItems&);
 
+    struct InlineItemRange {
+        bool isEmpty() const { return start == end; }
+        size_t size() const { return end - start; }
+        size_t start { 0 };
+        size_t end { 0 };
+    };
     struct LineContent {
         struct PartialContent {
             bool trailingContentHasHyphen { false };
             unsigned overflowContentLength { 0 };
         };
-        Optional<unsigned> trailingInlineItemIndex;
         Optional<PartialContent> partialContent;
+        InlineItemRange inlineItems;
         struct Float {
-            enum class Intrusive { No, Yes };
-            Intrusive isIntrusive { Intrusive::Yes };
+            bool isIntrusive { true };
             const InlineItem* item { nullptr };
         };
         using FloatList = Vector<Float>;
         FloatList floats;
-        const LineBuilder::RunList runList;
-        const LineBox lineBox;
     };
-    struct InlineItemRange {
-        bool isEmpty() const { return start == end; }
-        size_t size() const { return end - start; }
-        size_t start { 0 };
-        size_t end { 0 };
-    };
-    LineContent layoutLine(LineBuilder&, const InlineItemRange, Optional<unsigned> partialLeadingContentLength);
+    LineContent layoutInlineContent(LineBuilder&, const InlineItemRange&, Optional<unsigned> partialLeadingContentLength);
 
 private:
-    void nextContentForLine(LineCandidate&, unsigned inlineItemIndex, const InlineItemRange layoutRange, Optional<unsigned> overflowLength, InlineLayoutUnit availableLineWidth, InlineLayoutUnit currentLogicalRight);
+    void nextContentForLine(LineCandidate&, unsigned inlineItemIndex, const InlineItemRange& layoutRange, Optional<unsigned> overflowLength, InlineLayoutUnit availableLineWidth, InlineLayoutUnit currentLogicalRight);
     struct Result {
         LineBreaker::IsEndOfLine isEndOfLine { LineBreaker::IsEndOfLine::No };
         struct CommittedContentCount {
@@ -80,7 +77,7 @@
     Result handleFloatsAndInlineContent(LineBreaker&, LineBuilder&, const InlineItemRange& layoutRange, const LineCandidate&);
     size_t rebuildLine(LineBuilder&, const InlineItemRange& layoutRange);
     void commitPartialContent(LineBuilder&, const LineBreaker::RunList&, const LineBreaker::Result::PartialTrailingContent&);
-    LineContent close(LineBuilder&, const InlineItemRange layoutRange, unsigned committedInlineItemCount, Optional<LineContent::PartialContent>);
+    LineContent close(LineBuilder&, const InlineItemRange& layoutRange, unsigned committedInlineItemCount, Optional<LineContent::PartialContent>);
 
     InlineLayoutUnit inlineItemWidth(const InlineItem&, InlineLayoutUnit contentLogicalLeft) const;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to