Title: [285403] trunk/Source/WebCore
Revision
285403
Author
[email protected]
Date
2021-11-08 08:24:10 -0800 (Mon, 08 Nov 2021)

Log Message

[LFC][IFC] The first run in visual order may not generate a display box
https://bugs.webkit.org/show_bug.cgi?id=232806

Reviewed by Antti Koivisto.

Do not rely on the 0 index value to compute the content start position when visual ordering is in place.
The very first run (i == 0) in visual order may not even call into the displayBoxRect function (e.g. inline box end as </span>)
which means that we end up with an incorrect initial content start position (as we miss the RTL conversion).

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (285402 => 285403)


--- trunk/Source/WebCore/ChangeLog	2021-11-08 16:19:29 UTC (rev 285402)
+++ trunk/Source/WebCore/ChangeLog	2021-11-08 16:24:10 UTC (rev 285403)
@@ -1,3 +1,17 @@
+2021-11-08  Alan Bujtas  <[email protected]>
+
+        [LFC][IFC] The first run in visual order may not generate a display box
+        https://bugs.webkit.org/show_bug.cgi?id=232806
+
+        Reviewed by Antti Koivisto.
+
+        Do not rely on the 0 index value to compute the content start position when visual ordering is in place.
+        The very first run (i == 0) in visual order may not even call into the displayBoxRect function (e.g. inline box end as </span>) 
+        which means that we end up with an incorrect initial content start position (as we miss the RTL conversion).
+
+        * layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp:
+        (WebCore::Layout::InlineDisplayContentBuilder::createBoxesAndUpdateGeometryForLineContent):
+
 2021-11-08  Jer Noble  <[email protected]>
 
         Infinite loop in SourceBufferParserWebM::SegmentReader::Read

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


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp	2021-11-08 16:19:29 UTC (rev 285402)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp	2021-11-08 16:24:10 UTC (rev 285403)
@@ -75,7 +75,11 @@
     auto contentNeedsBidiReordering = !lineContent.visualOrderList.isEmpty();
     ASSERT(!contentNeedsBidiReordering || lineContent.visualOrderList.size() == runs.size());
 
-    auto contentRightInVisualOrder = InlineLayoutUnit { };
+    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();
+
     for (size_t i = 0; i < runs.size(); ++i) {
         auto visualIndex = contentNeedsBidiReordering ? lineContent.visualOrderList[i] : i;
         auto& lineRun = runs[visualIndex];
@@ -111,15 +115,6 @@
             auto distanceFromLogicalPreviousRun = logicalPreviousRun ? lineRun.logicalLeft() - logicalPreviousRun->logicalRight() : lineRun.logicalLeft();
             auto visualOrderRect = logicalRect;
             auto contentLeft = contentRightInVisualOrder + distanceFromLogicalPreviousRun;
-            if (!i) {
-                // First visual run. Initial content position depends on the block's inline direction.
-                contentLeft += lineBoxLogicalTopLeft.x();
-
-                auto rootInlineBox = boxes[0];
-                ASSERT(rootInlineBox.isRootInlineBox());
-                if (!rootInlineBox.style().isLeftToRightDirection())
-                    contentLeft += lineContent.lineLogicalWidth - rootInlineBox.logicalWidth();
-            }
             visualOrderRect.setLeft(contentLeft);
             // The inline box right edge includes its content as well as the inline box end (padding-right etc).
             // What we need here is the inline box start run's width.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to