Title: [289374] trunk/Source/WebCore
Revision
289374
Author
[email protected]
Date
2022-02-08 06:55:17 -0800 (Tue, 08 Feb 2022)

Log Message

[LFC][IFC] Take writing direction into account when applying RenderBlockFlow end padding quirk
https://bugs.webkit.org/show_bug.cgi?id=236280

Reviewed by Antti Koivisto.

In vertical writing mode the overflow should be expanded in the vertical direction if applicable.

* layout/formattingContexts/inline/display/InlineDisplayLine.h:
(WebCore::InlineDisplay::Line::contentLogicalWidth const):
(WebCore::InlineDisplay::Line::Line):
(WebCore::InlineDisplay::Line::contentWidth const): Deleted.
* layout/integration/InlineIteratorLineModernPath.h:
(WebCore::InlineIterator::LineIteratorModernPath::contentLogicalRight const):
* layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
(WebCore::LayoutIntegration::lineOverflowLogicalWidth):
(WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):
(WebCore::LayoutIntegration::lineOverflowWidth): Deleted.
* layout/integration/LayoutIntegrationLine.h:
(WebCore::LayoutIntegration::Line::Line):
(WebCore::LayoutIntegration::Line::contentLogicalWidth const):
(WebCore::LayoutIntegration::Line::contentWidth const): Deleted. -> this is a logical width value.
* layout/integration/LayoutIntegrationPagination.cpp:
(WebCore::LayoutIntegration::makeAdjustedContent):
* platform/graphics/FloatRect.h:
(WebCore::FloatRect::shiftMaxYEdgeBy):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (289373 => 289374)


--- trunk/Source/WebCore/ChangeLog	2022-02-08 14:35:05 UTC (rev 289373)
+++ trunk/Source/WebCore/ChangeLog	2022-02-08 14:55:17 UTC (rev 289374)
@@ -1,5 +1,33 @@
 2022-02-08  Alan Bujtas  <[email protected]>
 
+        [LFC][IFC] Take writing direction into account when applying RenderBlockFlow end padding quirk
+        https://bugs.webkit.org/show_bug.cgi?id=236280
+
+        Reviewed by Antti Koivisto.
+
+        In vertical writing mode the overflow should be expanded in the vertical direction if applicable.
+
+        * layout/formattingContexts/inline/display/InlineDisplayLine.h:
+        (WebCore::InlineDisplay::Line::contentLogicalWidth const):
+        (WebCore::InlineDisplay::Line::Line):
+        (WebCore::InlineDisplay::Line::contentWidth const): Deleted.
+        * layout/integration/InlineIteratorLineModernPath.h:
+        (WebCore::InlineIterator::LineIteratorModernPath::contentLogicalRight const):
+        * layout/integration/LayoutIntegrationInlineContentBuilder.cpp:
+        (WebCore::LayoutIntegration::lineOverflowLogicalWidth):
+        (WebCore::LayoutIntegration::InlineContentBuilder::createDisplayLines const):
+        (WebCore::LayoutIntegration::lineOverflowWidth): Deleted.
+        * layout/integration/LayoutIntegrationLine.h:
+        (WebCore::LayoutIntegration::Line::Line):
+        (WebCore::LayoutIntegration::Line::contentLogicalWidth const):
+        (WebCore::LayoutIntegration::Line::contentWidth const): Deleted. -> this is a logical width value.
+        * layout/integration/LayoutIntegrationPagination.cpp:
+        (WebCore::LayoutIntegration::makeAdjustedContent):
+        * platform/graphics/FloatRect.h:
+        (WebCore::FloatRect::shiftMaxYEdgeBy):
+
+2022-02-08  Alan Bujtas  <[email protected]>
+
         [LFC][Integration] Take isHorizontalWritingMode value into account when converting incoming margin/border/padding values
         https://bugs.webkit.org/show_bug.cgi?id=236285
 

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


--- trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLine.h	2022-02-08 14:35:05 UTC (rev 289373)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLine.h	2022-02-08 14:55:17 UTC (rev 289374)
@@ -40,7 +40,7 @@
         float top { 0 };
         float bottom { 0 };
     };
-    Line(const FloatRect& lineBoxRect, const FloatRect& scrollableOverflow, EnclosingTopAndBottom, float aligmentBaseline, float contentLeft, float contentWidth);
+    Line(const FloatRect& lineBoxRect, const FloatRect& scrollableOverflow, EnclosingTopAndBottom, float aligmentBaseline, float contentLeft, float contentLogicalWidth);
 
     float left() const { return m_lineBoxRect.x(); }
     float right() const { return m_lineBoxRect.maxX(); }
@@ -57,7 +57,7 @@
     float baseline() const { return m_aligmentBaseline; }
 
     float contentLeft() const { return m_contentLeft; }
-    float contentWidth() const { return m_contentWidth; }
+    float contentLogicalWidth() const { return m_contentLogicalWidth; }
 
     void moveVertically(float offset) { m_lineBoxRect.move({ { }, offset }); }
 
@@ -71,16 +71,16 @@
     EnclosingTopAndBottom m_enclosingTopAndBottom;
     float m_aligmentBaseline { 0 };
     float m_contentLeft { 0 };
-    float m_contentWidth { 0 };
+    float m_contentLogicalWidth { 0 };
 };
 
-inline Line::Line(const FloatRect& lineBoxRect, const FloatRect& scrollableOverflow, EnclosingTopAndBottom enclosingTopAndBottom, float aligmentBaseline, float contentLeft, float contentWidth)
+inline Line::Line(const FloatRect& lineBoxRect, const FloatRect& scrollableOverflow, EnclosingTopAndBottom enclosingTopAndBottom, float aligmentBaseline, float contentLeft, float contentLogicalWidth)
     : m_lineBoxRect(lineBoxRect)
     , m_scrollableOverflow(scrollableOverflow)
     , m_enclosingTopAndBottom(enclosingTopAndBottom)
     , m_aligmentBaseline(aligmentBaseline)
     , m_contentLeft(contentLeft)
-    , m_contentWidth(contentWidth)
+    , m_contentLogicalWidth(contentLogicalWidth)
 {
 }
 

Modified: trunk/Source/WebCore/layout/integration/InlineIteratorLineModernPath.h (289373 => 289374)


--- trunk/Source/WebCore/layout/integration/InlineIteratorLineModernPath.h	2022-02-08 14:35:05 UTC (rev 289373)
+++ trunk/Source/WebCore/layout/integration/InlineIteratorLineModernPath.h	2022-02-08 14:55:17 UTC (rev 289374)
@@ -63,7 +63,7 @@
     LayoutUnit selectionBottom() const { return bottom(); }
 
     float contentLogicalLeft() const { return line().lineBoxLeft() + line().contentLeft(); }
-    float contentLogicalRight() const { return contentLogicalLeft() + line().contentWidth(); }
+    float contentLogicalRight() const { return contentLogicalLeft() + line().contentLogicalWidth(); }
     float y() const { return lineBoxTop(); }
     float logicalHeight() const { return lineBoxBottom() - lineBoxTop(); }
     bool isHorizontal() const { return true; }

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp (289373 => 289374)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp	2022-02-08 14:35:05 UTC (rev 289373)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationInlineContentBuilder.cpp	2022-02-08 14:55:17 UTC (rev 289374)
@@ -46,7 +46,7 @@
     return { enclosingTopAndBottom.top + offset, enclosingTopAndBottom.bottom + offset };
 }
 
-inline static float lineOverflowWidth(const RenderBlockFlow& flow, Layout::InlineLayoutUnit lineContentWidth)
+inline static float lineOverflowLogicalWidth(const RenderBlockFlow& flow, Layout::InlineLayoutUnit lineContentLogicalWidth)
 {
     // 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 lineContentWidth + endPadding;
+    return lineContentLogicalWidth + endPadding;
 }
 
 InlineContentBuilder::InlineContentBuilder(const RenderBlockFlow& blockFlow, BoxTree& boxTree)
@@ -91,11 +91,22 @@
     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.contentWidth()); overflowWidth > scrollableOverflowRect.width()) {
-            auto overflowValue = overflowWidth - scrollableOverflowRect.width();
-            m_blockFlow.style().isLeftToRightDirection() ? scrollableOverflowRect.shiftMaxXEdgeBy(overflowValue) : scrollableOverflowRect.shiftXEdgeBy(-overflowValue);
-        }
 
+        auto adjustOverflowLogicalWidthWithBlockFlowQuirk = [&] {
+            auto& rootStyle = m_blockFlow.style();
+            auto isHorizontalWritingMode = rootStyle.isHorizontalWritingMode();
+            auto adjustedOverflowLogicalWidth = lineOverflowLogicalWidth(m_blockFlow, line.contentLogicalWidth());
+            auto scrollableOverflowLogicalWidth = isHorizontalWritingMode ? scrollableOverflowRect.width() : scrollableOverflowRect.height();
+            if (adjustedOverflowLogicalWidth > scrollableOverflowLogicalWidth) {
+                auto overflowValue = adjustedOverflowLogicalWidth - scrollableOverflowLogicalWidth;
+                if (isHorizontalWritingMode)
+                    rootStyle.isLeftToRightDirection() ? scrollableOverflowRect.shiftMaxXEdgeBy(overflowValue) : scrollableOverflowRect.shiftXEdgeBy(-overflowValue);
+                else
+                    rootStyle.isLeftToRightDirection() ? scrollableOverflowRect.shiftMaxYEdgeBy(overflowValue) : scrollableOverflowRect.shiftYEdgeBy(-overflowValue);
+            }
+        };
+        adjustOverflowLogicalWidthWithBlockFlowQuirk();
+
         auto firstBoxIndex = boxIndex;
         auto lineInkOverflowRect = scrollableOverflowRect;
         // Collect overflow from boxes.
@@ -126,7 +137,7 @@
         }
 
         auto boxCount = boxIndex - firstBoxIndex;
-        inlineContent.lines.append({ firstBoxIndex, boxCount, FloatRect { line.lineBoxRect() }, line.enclosingTopAndBottom().top, line.enclosingTopAndBottom().bottom, scrollableOverflowRect, lineInkOverflowRect, line.baseline(), line.contentLeft(), line.contentWidth() });
+        inlineContent.lines.append({ firstBoxIndex, boxCount, FloatRect { line.lineBoxRect() }, line.enclosingTopAndBottom().top, line.enclosingTopAndBottom().bottom, scrollableOverflowRect, lineInkOverflowRect, line.baseline(), line.contentLeft(), line.contentLogicalWidth() });
     }
 }
 

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h (289373 => 289374)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h	2022-02-08 14:35:05 UTC (rev 289373)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationLine.h	2022-02-08 14:55:17 UTC (rev 289374)
@@ -36,7 +36,7 @@
 class Line {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    Line(size_t firstBoxIndex, size_t boxCount, const FloatRect& lineBoxRect, float enclosingContentTop, float enclosingContentBottom, const FloatRect& scrollableOverflow, const FloatRect& inkOverflow, float baseline, float contentLeft, float contentWidth)
+    Line(size_t firstBoxIndex, size_t boxCount, const FloatRect& lineBoxRect, float enclosingContentTop, float enclosingContentBottom, const FloatRect& scrollableOverflow, const FloatRect& inkOverflow, float baseline, float contentLeft, float contentLogicalWidth)
         : m_firstBoxIndex(firstBoxIndex)
         , m_boxCount(boxCount)
         , m_lineBoxRect(lineBoxRect)
@@ -46,7 +46,7 @@
         , m_inkOverflow(inkOverflow)
         , m_baseline(baseline)
         , m_contentLeft(contentLeft)
-        , m_contentWidth(contentWidth)
+        , m_contentLogicalWidth(contentLogicalWidth)
     {
     }
 
@@ -67,7 +67,7 @@
     float baseline() const { return m_baseline; }
 
     float contentLeft() const { return m_contentLeft; }
-    float contentWidth() const { return m_contentWidth; }
+    float contentLogicalWidth() const { return m_contentLogicalWidth; }
 
 private:
     size_t m_firstBoxIndex { 0 };
@@ -83,7 +83,7 @@
     FloatRect m_inkOverflow;
     float m_baseline { 0 };
     float m_contentLeft { 0 };
-    float m_contentWidth { 0 };
+    float m_contentLogicalWidth { 0 };
 };
 
 }

Modified: trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp (289373 => 289374)


--- trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp	2022-02-08 14:35:05 UTC (rev 289373)
+++ trunk/Source/WebCore/layout/integration/LayoutIntegrationPagination.cpp	2022-02-08 14:55:17 UTC (rev 289374)
@@ -136,7 +136,7 @@
             moveVertically(line.inkOverflow(), offset),
             line.baseline(),
             line.contentLeft(),
-            line.contentWidth()
+            line.contentLogicalWidth()
         };
     };
 

Modified: trunk/Source/WebCore/platform/graphics/FloatRect.h (289373 => 289374)


--- trunk/Source/WebCore/platform/graphics/FloatRect.h	2022-02-08 14:35:05 UTC (rev 289373)
+++ trunk/Source/WebCore/platform/graphics/FloatRect.h	2022-02-08 14:55:17 UTC (rev 289374)
@@ -159,6 +159,11 @@
         setHeight(std::max(0.0f, height() - delta));
     }
 
+    void shiftMaxYEdgeBy(float delta)
+    {
+        shiftMaxYEdgeTo(maxY() + delta);
+    }
+
     FloatPoint minXMinYCorner() const { return m_location; } // typically topLeft
     FloatPoint maxXMinYCorner() const { return FloatPoint(m_location.x() + m_size.width(), m_location.y()); } // typically topRight
     FloatPoint minXMaxYCorner() const { return FloatPoint(m_location.x(), m_location.y() + m_size.height()); } // typically bottomLeft
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to