Title: [287259] trunk/Source/WebCore
Revision
287259
Author
za...@apple.com
Date
2021-12-20 07:11:46 -0800 (Mon, 20 Dec 2021)

Log Message

[LFC][IFC] InlineDisplay::Line has physical geometry
https://bugs.webkit.org/show_bug.cgi?id=234490

Reviewed by Antti Koivisto.

Remove the term "logical" from function names and variables.

* layout/formattingContexts/block/BlockFormattingGeometry.cpp:
(WebCore::Layout::BlockFormattingGeometry::inFlowNonReplacedContentHeightAndMargin const):
* layout/formattingContexts/inline/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::usedContentHeight const):
(WebCore::Layout::InlineFormattingContext::computeStaticPositionForOutOfFlowContent):
(WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
* layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:
(WebCore::Layout::LineBoxBuilder::build):
(WebCore::Layout::LineBoxBuilder::constructAndAlignInlineLevelBoxes):
* layout/formattingContexts/inline/display/InlineDisplayLine.h:
(WebCore::InlineDisplay::Line::lineBoxRect const):
(WebCore::InlineDisplay::Line::contentLeft const):
(WebCore::InlineDisplay::Line::contentWidth const):
(WebCore::InlineDisplay::Line::moveVertically):
(WebCore::InlineDisplay::Line::Line):
(WebCore::InlineDisplay::Line::lineBoxLogicalRect const): Deleted.
(WebCore::InlineDisplay::Line::contentLogicalLeft const): Deleted.
(WebCore::InlineDisplay::Line::contentLogicalWidth const): Deleted.
* layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
(WebCore::LayoutIntegration::lineOverflowWidth):
(WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):
* layout/layouttree/LayoutTreeBuilder.cpp:
(WebCore::Layout::showInlineTreeAndRuns):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (287258 => 287259)


--- trunk/Source/WebCore/ChangeLog	2021-12-20 12:38:49 UTC (rev 287258)
+++ trunk/Source/WebCore/ChangeLog	2021-12-20 15:11:46 UTC (rev 287259)
@@ -1,3 +1,36 @@
+2021-12-20  Alan Bujtas  <za...@apple.com>
+
+        [LFC][IFC] InlineDisplay::Line has physical geometry
+        https://bugs.webkit.org/show_bug.cgi?id=234490
+
+        Reviewed by Antti Koivisto.
+
+        Remove the term "logical" from function names and variables.
+
+        * layout/formattingContexts/block/BlockFormattingGeometry.cpp:
+        (WebCore::Layout::BlockFormattingGeometry::inFlowNonReplacedContentHeightAndMargin const):
+        * layout/formattingContexts/inline/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::usedContentHeight const):
+        (WebCore::Layout::InlineFormattingContext::computeStaticPositionForOutOfFlowContent):
+        (WebCore::Layout::InlineFormattingContext::computeGeometryForLineContent):
+        * layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:
+        (WebCore::Layout::LineBoxBuilder::build):
+        (WebCore::Layout::LineBoxBuilder::constructAndAlignInlineLevelBoxes):
+        * layout/formattingContexts/inline/display/InlineDisplayLine.h:
+        (WebCore::InlineDisplay::Line::lineBoxRect const):
+        (WebCore::InlineDisplay::Line::contentLeft const):
+        (WebCore::InlineDisplay::Line::contentWidth const):
+        (WebCore::InlineDisplay::Line::moveVertically):
+        (WebCore::InlineDisplay::Line::Line):
+        (WebCore::InlineDisplay::Line::lineBoxLogicalRect const): Deleted.
+        (WebCore::InlineDisplay::Line::contentLogicalLeft const): Deleted.
+        (WebCore::InlineDisplay::Line::contentLogicalWidth const): Deleted.
+        * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
+        (WebCore::LayoutIntegration::lineOverflowWidth):
+        (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):
+        * layout/layouttree/LayoutTreeBuilder.cpp:
+        (WebCore::Layout::showInlineTreeAndRuns):
+
 2021-12-20  Youenn Fablet  <you...@apple.com>
 
         Update RTCRtpScriptTransformer key frame API according latest spec proposal

Modified: trunk/Source/WebCore/layout/formattingContexts/block/BlockFormattingGeometry.cpp (287258 => 287259)


--- trunk/Source/WebCore/layout/formattingContexts/block/BlockFormattingGeometry.cpp	2021-12-20 12:38:49 UTC (rev 287258)
+++ trunk/Source/WebCore/layout/formattingContexts/block/BlockFormattingGeometry.cpp	2021-12-20 15:11:46 UTC (rev 287259)
@@ -87,7 +87,7 @@
             auto& lines = inlineFormattingState.lines();
             // Even empty containers generate one line. 
             ASSERT(!lines.isEmpty());
-            return { toLayoutUnit(lines.last().lineBoxLogicalRect().bottom() + inlineFormattingState.clearGapAfterLastLine()) - borderAndPaddingTop, nonCollapsedMargin };
+            return { toLayoutUnit(lines.last().lineBoxRect().bottom() + inlineFormattingState.clearGapAfterLastLine()) - borderAndPaddingTop, nonCollapsedMargin };
         }
 
         // 2. the bottom edge of the bottom (possibly collapsed) margin of its last in-flow child, if the child's bottom margin...

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp (287258 => 287259)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp	2021-12-20 12:38:49 UTC (rev 287258)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineFormattingContext.cpp	2021-12-20 15:11:46 UTC (rev 287259)
@@ -185,8 +185,8 @@
     auto& lines = formattingState().lines();
     // Even empty content generates a line.
     ASSERT(!lines.isEmpty());
-    auto top = LayoutUnit { lines.first().lineBoxLogicalRect().top() };
-    auto bottom = LayoutUnit { lines.last().lineBoxLogicalRect().bottom() + formattingState().clearGapAfterLastLine() };
+    auto top = LayoutUnit { lines.first().lineBoxRect().top() };
+    auto bottom = LayoutUnit { lines.last().lineBoxRect().bottom() + formattingState().clearGapAfterLastLine() };
 
     auto floatingContext = FloatingContext { *this, formattingState().floatingState() };
     if (auto floatBottom = floatingContext.bottom()) {
@@ -305,7 +305,7 @@
             // This is the first (non-float)child. Let's place it to the left of the first box.
             // <div><img style="position: absolute">text content</div>
             ASSERT(boxes.size());
-            outOfFlowGeometry.setLogicalTopLeft({ boxes[0].left(), lines[0].lineBoxLogicalRect().top() });
+            outOfFlowGeometry.setLogicalTopLeft({ boxes[0].left(), lines[0].lineBoxRect().top() });
             continue;
         }
 
@@ -346,7 +346,7 @@
                         ? BoxGeometry::borderBoxLeft(inlineBoxBoxGeometry) + inlineBoxBoxGeometry.contentBoxLeft()
                         : BoxGeometry::borderBoxRect(inlineBoxBoxGeometry).right();
                 }
-                outOfFlowGeometry.setLogicalTopLeft({ left, lines[previousBox.lineIndex()].lineBoxLogicalRect().top() });
+                outOfFlowGeometry.setLogicalTopLeft({ left, lines[previousBox.lineIndex()].lineBoxRect().top() });
                 return;
             }
 
@@ -353,11 +353,11 @@
             if (nextBox) {
                 // The out of flow box is placed at the beginning of the next line (where the first box on the line is).
                 // <div>text<br><img style="position: absolute"><img style="position: absolute">content</div>
-                outOfFlowGeometry.setLogicalTopLeft({ nextBox->left(), lines[nextBox->lineIndex()].lineBoxLogicalRect().top() });
+                outOfFlowGeometry.setLogicalTopLeft({ nextBox->left(), lines[nextBox->lineIndex()].lineBoxRect().top() });
                 return;
             }
 
-            auto& lastLineLogicalRect = lines[previousBox.lineIndex()].lineBoxLogicalRect();
+            auto& lastLineLogicalRect = lines[previousBox.lineIndex()].lineBoxRect();
             // This out-of-flow box is the last box.
             // FIXME: Use isLineBreak instead to cover preserved new lines too.
             if (previousBox.layoutBox().isLineBreakBox()) {
@@ -552,7 +552,7 @@
     auto currentLineIndex = formattingState.lines().size();
 
     auto lineAndLineBox = LineBoxBuilder(*this).build(lineContent, currentLineIndex);
-    auto lineBoxLogicalRect = lineAndLineBox.line.lineBoxLogicalRect();
+    auto lineBoxLogicalRect = lineAndLineBox.line.lineBoxRect();
 
     auto inlineContentBuilder = InlineDisplayContentBuilder { root(), formattingState };
     formattingState.addBoxes(inlineContentBuilder.build(lineContent, lineAndLineBox.lineBox, lineBoxLogicalRect, currentLineIndex));

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp (287258 => 287259)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp	2021-12-20 12:38:49 UTC (rev 287258)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp	2021-12-20 15:11:46 UTC (rev 287259)
@@ -119,10 +119,10 @@
             physicalLeft -= lineContent.lineMarginStart;
         }
         // FIXME: Use physical geometry here.
-        auto lineBoxLogicalRect = InlineRect { lineContent.lineLogicalTopLeft.y(), physicalLeft, lineContent.lineLogicalWidth, lineBoxLogicalHeight };
-        auto scrollableOverflowRect = lineBoxLogicalRect;
+        auto lineBoxRect = InlineRect { lineContent.lineLogicalTopLeft.y(), physicalLeft, lineContent.lineLogicalWidth, lineBoxLogicalHeight };
+        auto scrollableOverflowRect = lineBoxRect;
         auto& rootInlineBox = lineBox.rootInlineBox();
-        auto enclosingTopAndBottom = InlineDisplay::Line::EnclosingTopAndBottom { lineBoxLogicalRect.top() + rootInlineBox.logicalTop(), lineBoxLogicalRect.top() + rootInlineBox.logicalBottom() };
+        auto enclosingTopAndBottom = InlineDisplay::Line::EnclosingTopAndBottom { lineBoxRect.top() + rootInlineBox.logicalTop(), lineBoxRect.top() + rootInlineBox.logicalBottom() };
 
         for (auto& inlineLevelBox : lineBox.nonRootInlineLevelBoxes()) {
             if (!inlineLevelBox.isAtomicInlineLevelBox() && !inlineLevelBox.isInlineBox())
@@ -133,11 +133,11 @@
 
             if (inlineLevelBox.isAtomicInlineLevelBox()) {
                 borderBox = lineBox.logicalBorderBoxForAtomicInlineLevelBox(layoutBox, formattingContext().geometryForBox(layoutBox));
-                borderBox.moveBy(lineBoxLogicalRect.topLeft());
+                borderBox.moveBy(lineBoxRect.topLeft());
             } else if (inlineLevelBox.isInlineBox()) {
                 auto& boxGeometry = formattingContext().geometryForBox(layoutBox);
                 borderBox = lineBox.logicalBorderBoxForInlineBox(layoutBox, boxGeometry);
-                borderBox.moveBy(lineBoxLogicalRect.topLeft());
+                borderBox.moveBy(lineBoxRect.topLeft());
                 // Collect scrollable overflow from inline boxes. All other inline level boxes (e.g atomic inline level boxes) stretch the line.
                 auto hasScrollableContent = [&] {
                     // In standards mode, inline boxes always start with an imaginary strut.
@@ -153,7 +153,7 @@
             enclosingTopAndBottom.top = std::min(enclosingTopAndBottom.top, borderBox.top());
             enclosingTopAndBottom.bottom = std::max(enclosingTopAndBottom.bottom, borderBox.bottom());
         }
-        return InlineDisplay::Line { lineBoxLogicalRect, scrollableOverflowRect, enclosingTopAndBottom, rootInlineBox.logicalTop() + rootInlineBox.baseline(), rootInlineBoxAlignmentOffset + rootInlineBox.logicalLeft(), rootInlineBox.logicalWidth() };
+        return InlineDisplay::Line { lineBoxRect, scrollableOverflowRect, enclosingTopAndBottom, rootInlineBox.logicalTop() + rootInlineBox.baseline(), rootInlineBoxAlignmentOffset + rootInlineBox.logicalLeft(), rootInlineBox.logicalWidth() };
     };
     return { line(), lineBox };
 }
@@ -307,7 +307,7 @@
                 else {
                     auto& formattingState = layoutState().formattingStateForInlineFormattingContext(downcast<ContainerBox>(layoutBox));
                     auto& lastLine = formattingState.lines().last();
-                    auto inlineBlockBaseline = lastLine.lineBoxLogicalRect().top() + lastLine.baseline();
+                    auto inlineBlockBaseline = lastLine.lineBoxRect().top() + lastLine.baseline();
                     ascent = inlineLevelBoxGeometry.marginBefore() + inlineLevelBoxGeometry.borderBefore() + inlineLevelBoxGeometry.paddingBefore().value_or(0) + inlineBlockBaseline;
                 }
             } else if (layoutBox.isReplacedBox())

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLine.h (287258 => 287259)


--- trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLine.h	2021-12-20 12:38:49 UTC (rev 287258)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLine.h	2021-12-20 15:11:46 UTC (rev 287259)
@@ -40,9 +40,9 @@
         Layout::InlineLayoutUnit top { 0 };
         Layout::InlineLayoutUnit bottom { 0 };
     };
-    Line(const Layout::InlineRect& lineBoxLogicalRect, const Layout::InlineRect& scrollableOverflow, EnclosingTopAndBottom, Layout::InlineLayoutUnit aligmentBaseline, Layout::InlineLayoutUnit contentLogicalLeft, Layout::InlineLayoutUnit contentLogicalWidth);
+    Line(const Layout::InlineRect& lineBoxRect, const Layout::InlineRect& scrollableOverflow, EnclosingTopAndBottom, Layout::InlineLayoutUnit aligmentBaseline, Layout::InlineLayoutUnit contentLeft, Layout::InlineLayoutUnit contentWidth);
 
-    const Layout::InlineRect& lineBoxLogicalRect() const { return m_lineBoxLogicalRect; }
+    const Layout::InlineRect& lineBoxRect() const { return m_lineBoxRect; }
     const Layout::InlineRect& scrollableOverflow() const { return m_scrollableOverflow; }
 
     EnclosingTopAndBottom enclosingTopAndBottom() const { return m_enclosingTopAndBottom; }
@@ -49,14 +49,14 @@
 
     Layout::InlineLayoutUnit baseline() const { return m_aligmentBaseline; }
 
-    Layout::InlineLayoutUnit contentLogicalLeft() const { return m_contentLogicalLeft; }
-    Layout::InlineLayoutUnit contentLogicalWidth() const { return m_contentLogicalWidth; }
+    Layout::InlineLayoutUnit contentLeft() const { return m_contentLeft; }
+    Layout::InlineLayoutUnit contentWidth() const { return m_contentWidth; }
 
-    void moveVertically(Layout::InlineLayoutUnit offset) { m_lineBoxLogicalRect.moveVertically(offset); }
+    void moveVertically(Layout::InlineLayoutUnit offset) { m_lineBoxRect.moveVertically(offset); }
 
 private:
     // This is line box geometry (see https://www.w3.org/TR/css-inline-3/#line-box).
-    Layout::InlineRect m_lineBoxLogicalRect;
+    Layout::InlineRect m_lineBoxRect;
     Layout::InlineRect m_scrollableOverflow;
     // Enclosing top and bottom includes all inline level boxes (border box) vertically.
     // While the line box usually enclose them as well, its vertical geometry is based on
@@ -63,17 +63,17 @@
     // the layout bounds of the inline level boxes which may be different when line-height is present.
     EnclosingTopAndBottom m_enclosingTopAndBottom;
     Layout::InlineLayoutUnit m_aligmentBaseline { 0 };
-    Layout::InlineLayoutUnit m_contentLogicalLeft { 0 };
-    Layout::InlineLayoutUnit m_contentLogicalWidth { 0 };
+    Layout::InlineLayoutUnit m_contentLeft { 0 };
+    Layout::InlineLayoutUnit m_contentWidth { 0 };
 };
 
-inline Line::Line(const Layout::InlineRect& lineBoxLogicalRect, const Layout::InlineRect& scrollableOverflow, EnclosingTopAndBottom enclosingTopAndBottom, Layout::InlineLayoutUnit aligmentBaseline, Layout::InlineLayoutUnit contentLogicalLeft, Layout::InlineLayoutUnit contentLogicalWidth)
-    : m_lineBoxLogicalRect(lineBoxLogicalRect)
+inline Line::Line(const Layout::InlineRect& lineBoxRect, const Layout::InlineRect& scrollableOverflow, EnclosingTopAndBottom enclosingTopAndBottom, Layout::InlineLayoutUnit aligmentBaseline, Layout::InlineLayoutUnit contentLeft, Layout::InlineLayoutUnit contentWidth)
+    : m_lineBoxRect(lineBoxRect)
     , m_scrollableOverflow(scrollableOverflow)
     , m_enclosingTopAndBottom(enclosingTopAndBottom)
     , m_aligmentBaseline(aligmentBaseline)
-    , m_contentLogicalLeft(contentLogicalLeft)
-    , m_contentLogicalWidth(contentLogicalWidth)
+    , m_contentLeft(contentLeft)
+    , m_contentWidth(contentWidth)
 {
 }
 

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp (287258 => 287259)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp	2021-12-20 12:38:49 UTC (rev 287258)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp	2021-12-20 15:11:46 UTC (rev 287259)
@@ -46,7 +46,7 @@
     return { enclosingTopAndBottom.top + offset, enclosingTopAndBottom.bottom + offset };
 }
 
-inline static float lineOverflowWidth(const RenderBlockFlow& flow, Layout::InlineLayoutUnit lineContentLogicalWidth)
+inline static float lineOverflowWidth(const RenderBlockFlow& flow, Layout::InlineLayoutUnit lineContentWidth)
 {
     // FIXME: It's the copy of the lets-adjust-overflow-for-the-caret behavior from LegacyLineLayout::addOverflowFromInlineChildren.
     auto endPadding = flow.hasNonVisibleOverflow() ? flow.paddingEnd() : 0_lu;
@@ -54,7 +54,7 @@
         endPadding = flow.endPaddingWidthForCaret();
     if (flow.hasNonVisibleOverflow() && !endPadding && flow.element() && flow.element()->isRootEditableElement())
         endPadding = 1;
-    return lineContentLogicalWidth + endPadding;
+    return lineContentWidth + endPadding;
 }
 
 InlineContentBuilder::InlineContentBuilder(const RenderBlockFlow& blockFlow, const BoxTree& boxTree)
@@ -79,7 +79,7 @@
     for (size_t lineIndex = 0; lineIndex < lines.size(); ++lineIndex) {
         auto& line = lines[lineIndex];
         auto scrollableOverflowRect = FloatRect { line.scrollableOverflow() };
-        if (auto overflowWidth = lineOverflowWidth(m_blockFlow, line.contentLogicalWidth()); overflowWidth > scrollableOverflowRect.width())
+        if (auto overflowWidth = lineOverflowWidth(m_blockFlow, line.contentWidth()); overflowWidth > scrollableOverflowRect.width())
             scrollableOverflowRect.setWidth(overflowWidth);
 
         auto firstBoxIndex = boxIndex;
@@ -112,9 +112,8 @@
                 inlineContent.hasMultilinePaintOverlap = true;
         }
 
-        auto lineBoxLogicalRect = FloatRect { line.lineBoxLogicalRect() };
         auto boxCount = boxIndex - firstBoxIndex;
-        inlineContent.lines.append({ firstBoxIndex, boxCount, lineBoxLogicalRect, line.enclosingTopAndBottom().top, line.enclosingTopAndBottom().bottom, scrollableOverflowRect, lineInkOverflowRect, line.baseline(), line.contentLogicalLeft(), line.contentLogicalWidth() });
+        inlineContent.lines.append({ firstBoxIndex, boxCount, FloatRect { line.lineBoxRect() }, line.enclosingTopAndBottom().top, line.enclosingTopAndBottom().bottom, scrollableOverflowRect, lineInkOverflowRect, line.baseline(), line.contentLeft(), line.contentWidth() });
     }
 }
 

Modified: trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp (287258 => 287259)


--- trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2021-12-20 12:38:49 UTC (rev 287258)
+++ trunk/Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp	2021-12-20 15:11:46 UTC (rev 287259)
@@ -374,9 +374,9 @@
         };
         addSpacing();
         auto& line = lines[lineIndex];
-        auto& lineBoxLogicalRect = line.lineBoxLogicalRect();
+        auto& lineBoxRect = line.lineBoxRect();
         auto enclosingTopAndBottom = line.enclosingTopAndBottom();
-        stream << "line at (" << lineBoxLogicalRect.left() << "," << lineBoxLogicalRect.top() << ") size (" << lineBoxLogicalRect.width() << "x" << lineBoxLogicalRect.height() << ") baseline (" << line.baseline() << ") enclosing top (" << enclosingTopAndBottom.top << ") bottom (" << enclosingTopAndBottom.bottom << ")";
+        stream << "line at (" << lineBoxRect.left() << "," << lineBoxRect.top() << ") size (" << lineBoxRect.width() << "x" << lineBoxRect.height() << ") baseline (" << line.baseline() << ") enclosing top (" << enclosingTopAndBottom.top << ") bottom (" << enclosingTopAndBottom.bottom << ")";
         stream.nextLine();
 
         addSpacing();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to