Title: [281272] trunk/Source/WebCore
Revision
281272
Author
za...@apple.com
Date
2021-08-19 15:23:31 -0700 (Thu, 19 Aug 2021)

Log Message

[Line layout] "zero width space" (U+200B) is a breaking space
https://bugs.webkit.org/show_bug.cgi?id=227858

Reviewed by Antti Koivisto.

This is a workaround for handling mismatching prior-context content in break iterators.

* layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::endsWithSoftWrapOpportunity):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (281271 => 281272)


--- trunk/Source/WebCore/ChangeLog	2021-08-19 21:59:52 UTC (rev 281271)
+++ trunk/Source/WebCore/ChangeLog	2021-08-19 22:23:31 UTC (rev 281272)
@@ -1,5 +1,17 @@
 2021-08-19  Alan Bujtas  <za...@apple.com>
 
+        [Line layout] "zero width space" (U+200B) is a breaking space
+        https://bugs.webkit.org/show_bug.cgi?id=227858
+
+        Reviewed by Antti Koivisto.
+
+        This is a workaround for handling mismatching prior-context content in break iterators.
+
+        * layout/formattingContexts/inline/InlineLineBuilder.cpp:
+        (WebCore::Layout::endsWithSoftWrapOpportunity):
+
+2021-08-19  Alan Bujtas  <za...@apple.com>
+
         [LFC][IFC] Add support for negative horizontal margin (inline box)
         https://bugs.webkit.org/show_bug.cgi?id=227837
 

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


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2021-08-19 21:59:52 UTC (rev 281271)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2021-08-19 22:23:31 UTC (rev 281272)
@@ -54,7 +54,13 @@
     // [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.
     auto previousContent = currentTextItem.inlineTextBox().content();
-    auto lineBreakIterator = LazyLineBreakIterator { nextInlineTextItem.inlineTextBox().content() };
+    auto currentContent = nextInlineTextItem.inlineTextBox().content();
+    if (currentContent.is8Bit() && !previousContent.is8Bit()) {
+        // FIXME: Remove this workaround when we move over to a better way of handling prior-context with unicode.
+        // See the templated CharacterType in nextBreakablePosition for last and lastlast characters. 
+        currentContent = String::make16BitFrom8BitSource(currentContent.characters8(), currentContent.length());
+    }
+    auto lineBreakIterator = LazyLineBreakIterator { currentContent };
     auto previousContentLength = previousContent.length();
     // FIXME: We should look into the entire uncommitted content for more text context.
     UChar lastCharacter = previousContentLength ? previousContent[previousContentLength - 1] : 0;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to