Title: [285628] trunk/Source/WebCore
Revision
285628
Author
[email protected]
Date
2021-11-11 06:55:45 -0800 (Thu, 11 Nov 2021)

Log Message

[LFC][IFC] Add support for non-initial text-alignment values on bidi content
https://bugs.webkit.org/show_bug.cgi?id=232968

Reviewed by Antti Koivisto.

The text-align property "moves" the root inline box as a whole and not the individual runs.
This patch ensures that this offset value is taken into account when computing the horizontal position for the visually ordered runs too.
(Note that this offset value is baked into the logical position of the runs, see LineBox::logicalRectForTextRun.)

* layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::createBoxesAndUpdateGeometryForLineContent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (285627 => 285628)


--- trunk/Source/WebCore/ChangeLog	2021-11-11 14:55:29 UTC (rev 285627)
+++ trunk/Source/WebCore/ChangeLog	2021-11-11 14:55:45 UTC (rev 285628)
@@ -1,5 +1,19 @@
 2021-11-11  Alan Bujtas  <[email protected]>
 
+        [LFC][IFC] Add support for non-initial text-alignment values on bidi content
+        https://bugs.webkit.org/show_bug.cgi?id=232968
+
+        Reviewed by Antti Koivisto.
+
+        The text-align property "moves" the root inline box as a whole and not the individual runs.
+        This patch ensures that this offset value is taken into account when computing the horizontal position for the visually ordered runs too.
+        (Note that this offset value is baked into the logical position of the runs, see LineBox::logicalRectForTextRun.)
+
+        * layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp:
+        (WebCore::Layout::InlineDisplayContentBuilder::createBoxesAndUpdateGeometryForLineContent):
+
+2021-11-11  Alan Bujtas  <[email protected]>
+
         [LFC][IFC] Add support for missing inline item types in buildBidiParagraph
         https://bugs.webkit.org/show_bug.cgi?id=232964
 

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp (285627 => 285628)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp	2021-11-11 14:55:29 UTC (rev 285627)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp	2021-11-11 14:55:45 UTC (rev 285628)
@@ -75,10 +75,15 @@
     auto contentNeedsBidiReordering = !lineContent.visualOrderList.isEmpty();
     ASSERT(!contentNeedsBidiReordering || lineContent.visualOrderList.size() == runs.size());
 
+    auto rootInlineBoxRect = lineBox.logicalRectForRootInlineBox();
     auto contentRightInVisualOrder = lineBoxLogicalTopLeft.x();
     // First visual run's initial content position depends on the block's inline direction.
-    if (!root().style().isLeftToRightDirection())
-        contentRightInVisualOrder += lineContent.lineLogicalWidth - lineBox.logicalRectForRootInlineBox().width();
+    if (!root().style().isLeftToRightDirection()) {
+        // FIXME: This needs the block end position instead of the lineLogicalWidth.
+        contentRightInVisualOrder += lineContent.lineLogicalWidth - rootInlineBoxRect.width();
+    }
+    // Adjust the content start position with the (text)aligment offset (root inline box has the aligment offset and not the individual runs).
+    contentRightInVisualOrder += rootInlineBoxRect.left();
 
     for (size_t i = 0; i < runs.size(); ++i) {
         auto visualIndex = contentNeedsBidiReordering ? lineContent.visualOrderList[i] : i;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to