Title: [286968] trunk/Source/WebCore
Revision
286968
Author
za...@apple.com
Date
2021-12-13 12:21:18 -0800 (Mon, 13 Dec 2021)

Log Message

[LFC][IFC] Simple RTL content does not need visual reordering
https://bugs.webkit.org/show_bug.cgi?id=234252

Reviewed by Antti Koivisto.

* layout/formattingContexts/inline/InlineItemsBuilder.cpp:
(WebCore::Layout::InlineItemsBuilder::build):
(WebCore::Layout::InlineItemsBuilder::breakAndComputeBidiLevels):
* layout/formattingContexts/inline/InlineItemsBuilder.h:
(WebCore::Layout::InlineItemsBuilder::needsVisualReordering const):
(WebCore::Layout::InlineItemsBuilder::needsVisualReordeering const): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (286967 => 286968)


--- trunk/Source/WebCore/ChangeLog	2021-12-13 20:19:58 UTC (rev 286967)
+++ trunk/Source/WebCore/ChangeLog	2021-12-13 20:21:18 UTC (rev 286968)
@@ -1,3 +1,17 @@
+2021-12-13  Alan Bujtas  <za...@apple.com>
+
+        [LFC][IFC] Simple RTL content does not need visual reordering
+        https://bugs.webkit.org/show_bug.cgi?id=234252
+
+        Reviewed by Antti Koivisto.
+
+        * layout/formattingContexts/inline/InlineItemsBuilder.cpp:
+        (WebCore::Layout::InlineItemsBuilder::build):
+        (WebCore::Layout::InlineItemsBuilder::breakAndComputeBidiLevels):
+        * layout/formattingContexts/inline/InlineItemsBuilder.h:
+        (WebCore::Layout::InlineItemsBuilder::needsVisualReordering const):
+        (WebCore::Layout::InlineItemsBuilder::needsVisualReordeering const): Deleted.
+
 2021-12-13  Youenn Fablet  <you...@apple.com>
 
         Fix buggy assert in CoreAudioSharedUnit::setupAudioUnit

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp (286967 => 286968)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp	2021-12-13 20:19:58 UTC (rev 286967)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp	2021-12-13 20:21:18 UTC (rev 286968)
@@ -86,7 +86,7 @@
 {
     InlineItems inlineItems;
     collectInlineItems(inlineItems);
-    if (needsVisualReordeering())
+    if (needsVisualReordering())
         breakAndComputeBidiLevels(inlineItems);
     computeInlineTextItemWidths(inlineItems);
     return inlineItems;
@@ -250,7 +250,7 @@
 
 void InlineItemsBuilder::breakAndComputeBidiLevels(InlineItems& inlineItems)
 {
-    ASSERT(needsVisualReordeering());
+    ASSERT(needsVisualReordering());
     ASSERT(!inlineItems.isEmpty());
 
     StringBuilder paragraphContentBuilder;
@@ -258,6 +258,13 @@
     inlineItemOffsets.reserveInitialCapacity(inlineItems.size());
     buildBidiParagraph(root().style(), inlineItems, paragraphContentBuilder, inlineItemOffsets);
     ASSERT(inlineItemOffsets.size() == inlineItems.size());
+    if (paragraphContentBuilder.is8Bit()) {
+        // Simple content with RTL inline base direction could just follow the logical order.
+        // Note that inline level elements produce 16bit paragraph content by appending objectReplacementCharacter.
+        // e.g. <div dir=rtl>this initiates 8bit paragraph builder</div> while
+        //      <div dir=rtl><img> <- turns the paragraph builder to 16bit</div> 
+        return;
+    }
 
     // 1. Setup the bidi boundary loop by calling ubidi_setPara with the paragraph text.
     // 2. Call ubidi_getLogicalRun to advance to the next bidi boundary until we hit the end of the content.

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.h (286967 => 286968)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.h	2021-12-13 20:19:58 UTC (rev 286967)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.h	2021-12-13 20:21:18 UTC (rev 286968)
@@ -50,7 +50,7 @@
     void handleInlineBoxEnd(const Box&, InlineItems&);
     void handleInlineLevelBox(const Box&, InlineItems&);
     
-    bool needsVisualReordeering() const { return hasSeenBidiContent() || !root().style().isLeftToRightDirection(); }
+    bool needsVisualReordering() const { return hasSeenBidiContent() || !root().style().isLeftToRightDirection(); }
     bool hasSeenBidiContent() const { return m_hasSeenBidiContent; }
 
     const ContainerBox& root() const { return m_root; }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to