Title: [272701] trunk/Source/WebCore
Revision
272701
Author
[email protected]
Date
2021-02-10 18:25:21 -0800 (Wed, 10 Feb 2021)

Log Message

[LFC][IFC] Logical width of a line box is equal to the inner logical width of its containing block
https://bugs.webkit.org/show_bug.cgi?id=221648

Reviewed by Antti Koivisto.

This is is used when horizontal scrolling is allowed (not supported atm).

* layout/inlineformatting/InlineFormattingContextGeometry.cpp:
(WebCore::Layout::LineBoxBuilder::build):
(WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
* layout/inlineformatting/InlineLineBox.cpp:
(WebCore::Layout::LineBox::LineBox):
(WebCore::Layout::m_contentLogicalWidth):
* layout/inlineformatting/InlineLineBox.h:
(WebCore::Layout::LineBox::contentLogicalWidth const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (272700 => 272701)


--- trunk/Source/WebCore/ChangeLog	2021-02-11 02:25:03 UTC (rev 272700)
+++ trunk/Source/WebCore/ChangeLog	2021-02-11 02:25:21 UTC (rev 272701)
@@ -1,3 +1,21 @@
+2021-02-10  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Logical width of a line box is equal to the inner logical width of its containing block
+        https://bugs.webkit.org/show_bug.cgi?id=221648
+
+        Reviewed by Antti Koivisto.
+
+        This is is used when horizontal scrolling is allowed (not supported atm).
+
+        * layout/inlineformatting/InlineFormattingContextGeometry.cpp:
+        (WebCore::Layout::LineBoxBuilder::build):
+        (WebCore::Layout::LineBoxBuilder::constructInlineLevelBoxes):
+        * layout/inlineformatting/InlineLineBox.cpp:
+        (WebCore::Layout::LineBox::LineBox):
+        (WebCore::Layout::m_contentLogicalWidth):
+        * layout/inlineformatting/InlineLineBox.h:
+        (WebCore::Layout::LineBox::contentLogicalWidth const):
+
 2021-02-10  David Kilzer  <[email protected]>
 
         WebCore::genericFamily() should use checked_cf_cast<>

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (272700 => 272701)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2021-02-11 02:25:03 UTC (rev 272700)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2021-02-11 02:25:21 UTC (rev 272701)
@@ -450,8 +450,7 @@
     auto& lineBoxLogicalRect = lineBox.logicalRect();
     if (!lineBox.hasContent()) {
         // Fast path for lines with no content e.g. <div><span></span><span></span></div> or <span><div></div></span> where we construct empty pre and post blocks.
-        ASSERT(!lineContent.contentLogicalWidth);
-        ASSERT(!lineBoxLogicalRect.width() && !lineBoxLogicalRect.height());
+        ASSERT(!lineBox.contentLogicalWidth() && !lineBoxLogicalRect.height());
         auto updateInlineBoxesGeometryIfApplicable = [&] {
             if (!lineBox.hasInlineBox())
                 return;

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp (272700 => 272701)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp	2021-02-11 02:25:03 UTC (rev 272700)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContextGeometry.cpp	2021-02-11 02:25:21 UTC (rev 272701)
@@ -157,7 +157,7 @@
     auto& runs = lineContent.runs;
     auto lineLogicalWidth = lineContent.lineLogicalWidth;
     auto contentLogicalWidth = lineContent.contentLogicalWidth;
-    auto lineBox = LineBox { lineContent.logicalTopLeft, contentLogicalWidth, runs.size() };
+    auto lineBox = LineBox { lineContent.logicalTopLeft, lineLogicalWidth, contentLogicalWidth, runs.size() };
 
     if (auto horizontalAlignmentOffset = Layout::horizontalAlignmentOffset(runs, rootBox().style().textAlign(), lineLogicalWidth, contentLogicalWidth, lineContent.isLastLineWithInlineContent))
         lineBox.setHorizontalAlignmentOffset(*horizontalAlignmentOffset);
@@ -212,7 +212,7 @@
     auto simplifiedVerticalAlignment = SimplifiedVerticalAlignment { };
 
     auto createRootInlineBox = [&] {
-        auto rootInlineBox = LineBox::InlineLevelBox::createRootInlineBox(rootBox(), horizontalAligmentOffset, lineBox.logicalWidth());
+        auto rootInlineBox = LineBox::InlineLevelBox::createRootInlineBox(rootBox(), horizontalAligmentOffset, lineBox.contentLogicalWidth());
         setVerticalGeometryForInlineBox(*rootInlineBox);
         simplifiedVerticalAlignment = { { } , rootInlineBox->layoutBounds().height(), rootInlineBox->layoutBounds().ascent - rootInlineBox->baseline() };
         lineBox.addRootInlineBox(WTFMove(rootInlineBox));
@@ -248,7 +248,7 @@
         }
         // Construct the missing LineBox::InlineBoxes starting with the topmost layout box.
         for (auto* layoutBox : WTF::makeReversedRange(layoutBoxesWithoutInlineBoxes)) {
-            auto inlineBox = LineBox::InlineLevelBox::createInlineBox(*layoutBox, horizontalAligmentOffset, lineBox.logicalWidth());
+            auto inlineBox = LineBox::InlineLevelBox::createInlineBox(*layoutBox, horizontalAligmentOffset, lineBox.contentLogicalWidth());
             setVerticalGeometryForInlineBox(*inlineBox);
             lineBox.addInlineLevelBox(WTFMove(inlineBox));
         }
@@ -335,7 +335,7 @@
         // e.g. <div><span></span><span></span></div> is still okay.
         m_inlineLevelBoxesNeedVerticalAlignment = m_inlineLevelBoxesNeedVerticalAlignment || lineHasContent;
         if (run.isInlineBoxStart()) {
-            auto initialLogicalWidth = lineBox.logicalWidth() - run.logicalLeft();
+            auto initialLogicalWidth = lineBox.contentLogicalWidth() - run.logicalLeft();
             ASSERT(initialLogicalWidth >= 0);
             auto inlineBox = LineBox::InlineLevelBox::createInlineBox(layoutBox, logicalLeft, initialLogicalWidth);
             setVerticalGeometryForInlineBox(*inlineBox);

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.cpp (272700 => 272701)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.cpp	2021-02-11 02:25:03 UTC (rev 272700)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.cpp	2021-02-11 02:25:21 UTC (rev 272701)
@@ -83,8 +83,9 @@
     return verticalAlignment == VerticalAlign::Top || verticalAlignment == VerticalAlign::Bottom;
 }
 
-LineBox::LineBox(const InlineLayoutPoint& logicalTopleft, InlineLayoutUnit contentLogicalWidth, size_t numberOfRuns)
-    : m_logicalRect(logicalTopleft, InlineLayoutSize { contentLogicalWidth, { } })
+LineBox::LineBox(const InlineLayoutPoint& logicalTopleft, InlineLayoutUnit lineLogicalWidth, InlineLayoutUnit contentLogicalWidth, size_t numberOfRuns)
+    : m_logicalRect(logicalTopleft, InlineLayoutSize { lineLogicalWidth, { } })
+    , m_contentLogicalWidth(contentLogicalWidth)
 {
     m_nonRootInlineLevelBoxList.reserveInitialCapacity(numberOfRuns);
     m_inlineLevelBoxRectMap.reserveInitialCapacity(numberOfRuns);

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.h (272700 => 272701)


--- trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.h	2021-02-11 02:25:03 UTC (rev 272700)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineLineBox.h	2021-02-11 02:25:21 UTC (rev 272701)
@@ -130,7 +130,7 @@
         Type m_type { Type::InlineBox };
     };
 
-    LineBox(const InlineLayoutPoint& logicalTopLeft, InlineLayoutUnit logicalWidth, size_t numberOfRuns);
+    LineBox(const InlineLayoutPoint& logicalTopLeft, InlineLayoutUnit lineLogicalWidth, InlineLayoutUnit contentLogicalWidth, size_t numberOfRuns);
 
     const InlineRect& logicalRect() const { return m_logicalRect; }
     InlineLayoutUnit logicalWidth() const { return logicalSize().width(); }
@@ -137,6 +137,7 @@
     InlineLayoutUnit logicalHeight() const { return logicalSize().height(); }
     InlineLayoutPoint logicalTopLeft() const { return logicalRect().topLeft(); }
     InlineLayoutSize logicalSize() const { return logicalRect().size(); }
+    InlineLayoutUnit contentLogicalWidth() const { return m_contentLogicalWidth; }
 
     Optional<InlineLayoutUnit> horizontalAlignmentOffset() const { return m_horizontalAlignmentOffset; }
 
@@ -175,6 +176,7 @@
 
 private:
     InlineRect m_logicalRect;
+    InlineLayoutUnit m_contentLogicalWidth { 0 };
     bool m_hasContent { false };
     Optional<InlineLayoutUnit> m_horizontalAlignmentOffset;
     OptionSet<InlineLevelBox::Type> m_boxTypes;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to