Title: [285391] trunk/Source/WebCore
Revision
285391
Author
[email protected]
Date
2021-11-07 10:39:07 -0800 (Sun, 07 Nov 2021)

Log Message

[LFC][IFC] bidi boundary does not necessarily mean soft wrapping opportunity
https://bugs.webkit.org/show_bug.cgi?id=232793

Reviewed by Antti Koivisto.

Prior to bidi support, we only split non-whitespace content at soft break opportunities e.g. hyphen.

* layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::endsWithSoftWrapOpportunity): Now we call findNextBreakablePosition on those rare bidi boundaries.
Could add a "break reason" to InlineTextItem if it turns out to be a perf issue.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (285390 => 285391)


--- trunk/Source/WebCore/ChangeLog	2021-11-07 16:07:18 UTC (rev 285390)
+++ trunk/Source/WebCore/ChangeLog	2021-11-07 18:39:07 UTC (rev 285391)
@@ -1,3 +1,16 @@
+2021-11-07  Alan Bujtas  <[email protected]>
+
+        [LFC][IFC] bidi boundary does not necessarily mean soft wrapping opportunity
+        https://bugs.webkit.org/show_bug.cgi?id=232793
+
+        Reviewed by Antti Koivisto.
+
+        Prior to bidi support, we only split non-whitespace content at soft break opportunities e.g. hyphen.
+
+        * layout/formattingContexts/inline/InlineLineBuilder.cpp:
+        (WebCore::Layout::endsWithSoftWrapOpportunity): Now we call findNextBreakablePosition on those rare bidi boundaries.
+        Could add a "break reason" to InlineTextItem if it turns out to be a perf issue.
+
 2021-11-06  Tyler Wilcock  <[email protected]>
 
         AX: WebKit1 PluginViewBase objects with an associated widget()->platformWidget() should be considered attachments

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp (285390 => 285391)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2021-11-07 16:07:18 UTC (rev 285390)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2021-11-07 18:39:07 UTC (rev 285391)
@@ -46,10 +46,14 @@
     // We are at the position after a whitespace.
     if (currentTextItem.isWhitespace())
         return true;
-    // When both these non-whitespace runs belong to the same layout box, it's guaranteed that
-    // they are split at a soft breaking opportunity. See InlineTextItem::moveToNextBreakablePosition.
-    if (&currentTextItem.inlineTextBox() == &nextInlineTextItem.inlineTextBox())
-        return true;
+    // When both these non-whitespace runs belong to the same layout box with the same bidi level, it's guaranteed that
+    // they are split at a soft breaking opportunity. See InlineItemsBuilder::moveToNextBreakablePosition.
+    if (&currentTextItem.inlineTextBox() == &nextInlineTextItem.inlineTextBox()) {
+        if (currentTextItem.bidiLevel() == nextInlineTextItem.bidiLevel())
+            return true;
+        // The bidi boundary may or may not be the reason for splitting the inline text box content.
+        // FIXME: We could add a "reason flag" to InlineTextItem to tell why the split happened.
+    }
     // Now we need to collect at least 3 adjacent characters to be able to make a decision whether the previous text item ends with breaking opportunity.
     // [ex-][ample] <- second to last[x] last[-] current[a]
     // We need at least 1 character in the current inline text item and 2 more from previous inline items.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to