Title: [287329] trunk
Revision
287329
Author
[email protected]
Date
2021-12-21 14:16:34 -0800 (Tue, 21 Dec 2021)

Log Message

[LFC][IFC] Compute visual geometry for InlineDisplay::Line
https://bugs.webkit.org/show_bug.cgi?id=234545

Reviewed by Antti Koivisto.

Source/WebCore:

1. Compute visual geometry for InlineDisplay::Line
2. Use this visual geometry when constructing display boxes

* layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::processBidiContent):
* layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp:
(WebCore::Layout::InlineDisplayLineBuilder::build const):

LayoutTests:

* TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (287328 => 287329)


--- trunk/LayoutTests/ChangeLog	2021-12-21 22:07:36 UTC (rev 287328)
+++ trunk/LayoutTests/ChangeLog	2021-12-21 22:16:34 UTC (rev 287329)
@@ -1,3 +1,12 @@
+2021-12-21  Alan Bujtas  <[email protected]>
+
+        [LFC][IFC] Compute visual geometry for InlineDisplay::Line
+        https://bugs.webkit.org/show_bug.cgi?id=234545
+
+        Reviewed by Antti Koivisto.
+
+        * TestExpectations:
+
 2021-12-21  Simon Fraser  <[email protected]>
 
         Allow a way to specify a custom pixel tolerance in a ref test

Modified: trunk/LayoutTests/TestExpectations (287328 => 287329)


--- trunk/LayoutTests/TestExpectations	2021-12-21 22:07:36 UTC (rev 287328)
+++ trunk/LayoutTests/TestExpectations	2021-12-21 22:16:34 UTC (rev 287329)
@@ -4847,6 +4847,8 @@
 fast/layoutformattingcontext/absolute-positioned-box-with-inline-sibling.html [ Skip ]
 [ Debug ] fast/layoutformattingcontext/table-fixed-width-with-max-distribution.html [ Skip ]
 [ Debug ] fast/layoutformattingcontext/table-space-distribution-simple-mismatching.html [ Skip ]
+# Needs display box support.
+fast/layoutformattingcontext/flex-box-simple.html [ Skip ]
 
 # Missing painting support for in-flow positioning
 fast/layoutformattingcontext/replaced-box-with-margin-on-baseline.html [ ImageOnlyFailure ]

Modified: trunk/Source/WebCore/ChangeLog (287328 => 287329)


--- trunk/Source/WebCore/ChangeLog	2021-12-21 22:07:36 UTC (rev 287328)
+++ trunk/Source/WebCore/ChangeLog	2021-12-21 22:16:34 UTC (rev 287329)
@@ -1,3 +1,18 @@
+2021-12-21  Alan Bujtas  <[email protected]>
+
+        [LFC][IFC] Compute visual geometry for InlineDisplay::Line
+        https://bugs.webkit.org/show_bug.cgi?id=234545
+
+        Reviewed by Antti Koivisto.
+
+        1. Compute visual geometry for InlineDisplay::Line
+        2. Use this visual geometry when constructing display boxes
+
+        * layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
+        (WebCore::Layout::InlineDisplayContentBuilder::processBidiContent):
+        * layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp:
+        (WebCore::Layout::InlineDisplayLineBuilder::build const):
+
 2021-12-21  Darin Adler  <[email protected]>
 
         ScriptState.h/cpp is a remnant of _javascript_ engine abstraction that can be removed

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp (287328 => 287329)


--- trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp	2021-12-21 22:07:36 UTC (rev 287328)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp	2021-12-21 22:16:34 UTC (rev 287329)
@@ -540,11 +540,6 @@
     auto lineBoxRect = displayLine.lineBoxRect();
     auto contentStartInVisualOrder = lineBoxRect.left() + displayLine.contentLeft();
     auto createDisplayBoxesInVisualOrder = [&] {
-        // First visual run's initial content position depends on the block's inline direction.
-        if (!root().style().isLeftToRightDirection()) {
-            // FIXME: Turn display line's contentLeft to visual and just use that value.
-            contentStartInVisualOrder = lineBoxRect.width() - displayLine.contentWidth() - displayLine.contentLeft();
-        }
 
         auto contentRightInVisualOrder = contentStartInVisualOrder;
         auto& runs = lineContent.runs;

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp (287328 => 287329)


--- trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp	2021-12-21 22:07:36 UTC (rev 287328)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp	2021-12-21 22:16:34 UTC (rev 287329)
@@ -76,22 +76,26 @@
 InlineDisplay::Line InlineDisplayLineBuilder::build(const LineBuilder::LineContent& lineContent, const LineBox& lineBox, InlineLayoutUnit lineBoxLogicalHeight, size_t lineIndex) const
 {
     auto& rootStyle = lineIndex ? root().firstLineStyle() : root().style();
-    auto lineBoxVisualLeft = lineContent.lineLogicalTopLeft.x();
-    if (!rootStyle.isLeftToRightDirection()) {
-        // https://drafts.csswg.org/css-text/#text-indent-property
-        // Since text-indent only initiates margin start, we just need to pull the linebox back to the left.
-        lineBoxVisualLeft -= lineContent.lineMarginStart;
-    }
-    // FIXME: Use physical geometry here.
+    auto& rootInlineBox = lineBox.rootInlineBox();
+    auto& rootGeometry = layoutState().geometryForBox(root());
+    auto isLeftToRightDirection = rootStyle.isLeftToRightDirection();
+    auto lineOffsetFromContentBox = lineContent.lineLogicalTopLeft.x() - rootGeometry.contentBoxLeft();
+
+    auto lineBoxVisualLeft = isLeftToRightDirection
+        ? rootGeometry.contentBoxLeft() + lineOffsetFromContentBox
+        : InlineLayoutUnit { rootGeometry.borderEnd() } + rootGeometry.paddingEnd().value_or(0_lu);
+    auto contentVisualLeft = isLeftToRightDirection
+        ? lineBox.rootInlineBoxAlignmentOffset()
+        : rootGeometry.contentBoxWidth() - lineOffsetFromContentBox -  lineBox.rootInlineBoxAlignmentOffset() - rootInlineBox.logicalWidth();
+
     auto lineBoxRect = InlineRect { lineContent.lineLogicalTopLeft.y(), lineBoxVisualLeft, lineContent.lineLogicalWidth, lineBoxLogicalHeight };
     auto enclosingLineGeometry = collectEnclosingLineGeometry(lineBox, lineBoxRect);
 
-    auto& rootInlineBox = lineBox.rootInlineBox();
     return InlineDisplay::Line { lineBoxRect
         , enclosingLineGeometry.scrollableOverflowRect
         , enclosingLineGeometry.enclosingTopAndBottom
         , rootInlineBox.logicalTop() + rootInlineBox.baseline()
-        , lineBox.rootInlineBoxAlignmentOffset() + rootInlineBox.logicalLeft()
+        , contentVisualLeft
         , rootInlineBox.logicalWidth()
     };
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to