Title: [287142] trunk/Source/WebCore
Revision
287142
Author
[email protected]
Date
2021-12-16 09:36:20 -0800 (Thu, 16 Dec 2021)

Log Message

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

Reviewed by Antti Koivisto.

It turns out that certain unicode categories (e.g. punctuation) could require reordering even when
the content is "simple" (8bit).

* layout/formattingContexts/inline/InlineItemsBuilder.cpp:
(WebCore::Layout::InlineItemsBuilder::breakAndComputeBidiLevels):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (287141 => 287142)


--- trunk/Source/WebCore/ChangeLog	2021-12-16 17:17:01 UTC (rev 287141)
+++ trunk/Source/WebCore/ChangeLog	2021-12-16 17:36:20 UTC (rev 287142)
@@ -1,3 +1,16 @@
+2021-12-16  Alan Bujtas  <[email protected]>
+
+        [LFC][IFC] Simple RTL content may need visual reordering
+        https://bugs.webkit.org/show_bug.cgi?id=234380
+
+        Reviewed by Antti Koivisto.
+
+        It turns out that certain unicode categories (e.g. punctuation) could require reordering even when
+        the content is "simple" (8bit).
+
+        * layout/formattingContexts/inline/InlineItemsBuilder.cpp:
+        (WebCore::Layout::InlineItemsBuilder::breakAndComputeBidiLevels):
+
 2021-12-16  Antoine Quint  <[email protected]>
 
         Remove the declaration for an unimplemented AudioBufferSourceNode::create(BaseAudioContext&, float) method

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


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp	2021-12-16 17:17:01 UTC (rev 287141)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineItemsBuilder.cpp	2021-12-16 17:36:20 UTC (rev 287142)
@@ -259,14 +259,6 @@
     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.
     // 3. Set the computed bidi level on the associated inline items. Split them as needed.
@@ -283,7 +275,13 @@
 
     UErrorCode error = U_ZERO_ERROR;
     ASSERT(!paragraphContentBuilder.isEmpty());
-    ubidi_setPara(ubidi, paragraphContentBuilder.characters16(), paragraphContentBuilder.length(), rootBidiLevel, nullptr, &error);
+    ubidi_setPara(ubidi
+        , StringView(paragraphContentBuilder).upconvertedCharacters()
+        , paragraphContentBuilder.length()
+        , rootBidiLevel
+        , nullptr
+        , &error);
+
     if (U_FAILURE(error)) {
         ASSERT_NOT_REACHED();
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to