Title: [284060] trunk
Revision
284060
Author
[email protected]
Date
2021-10-12 16:36:41 -0700 (Tue, 12 Oct 2021)

Log Message

[LFC][IFC] LazyLineBreakIterator should be correctly setup for the prior context case
https://bugs.webkit.org/show_bug.cgi?id=231608

Reviewed by Antti Koivisto.

Source/WebCore:

Pass in the locale and the breaking mode values when constructing the LazyLineBreakIterator for finding soft wrap opportunities across layout boxes.

Test: fast/inline/line-break-loose-with-inline-box-boundary.html

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

LayoutTests:

* fast/inline/line-break-loose-with-inline-box-boundary-expected.html: Added.
* fast/inline/line-break-loose-with-inline-box-boundary.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (284059 => 284060)


--- trunk/LayoutTests/ChangeLog	2021-10-12 23:35:55 UTC (rev 284059)
+++ trunk/LayoutTests/ChangeLog	2021-10-12 23:36:41 UTC (rev 284060)
@@ -1,3 +1,13 @@
+2021-10-12  Alan Bujtas  <[email protected]>
+
+        [LFC][IFC] LazyLineBreakIterator should be correctly setup for the prior context case
+        https://bugs.webkit.org/show_bug.cgi?id=231608
+
+        Reviewed by Antti Koivisto.
+
+        * fast/inline/line-break-loose-with-inline-box-boundary-expected.html: Added.
+        * fast/inline/line-break-loose-with-inline-box-boundary.html: Added.
+
 2021-10-12  Sihui Liu  <[email protected]>
 
         Implement FileSystemSyncAccessHandle read() and write()

Added: trunk/LayoutTests/fast/inline/line-break-loose-with-inline-box-boundary-expected.html (0 => 284060)


--- trunk/LayoutTests/fast/inline/line-break-loose-with-inline-box-boundary-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/line-break-loose-with-inline-box-boundary-expected.html	2021-10-12 23:36:41 UTC (rev 284060)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<style>
+div {
+  line-break: loose;
+  border: 1px solid black;
+  width: 10.2em;
+}
+</style>
+<div lang="ja">サンプル文サンプル文&#x3041;サンプル文</div>

Added: trunk/LayoutTests/fast/inline/line-break-loose-with-inline-box-boundary.html (0 => 284060)


--- trunk/LayoutTests/fast/inline/line-break-loose-with-inline-box-boundary.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/line-break-loose-with-inline-box-boundary.html	2021-10-12 23:36:41 UTC (rev 284060)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<style>
+div {
+  line-break: loose;
+  border: 1px solid black;
+  width: 10.2em;
+}
+</style>
+<!-- breaking position should not be dependent on inline box boundary -->
+<div lang="ja">サンプル文サンプル文<span>&#x3041;</span>サンプル文</div>

Modified: trunk/Source/WebCore/ChangeLog (284059 => 284060)


--- trunk/Source/WebCore/ChangeLog	2021-10-12 23:35:55 UTC (rev 284059)
+++ trunk/Source/WebCore/ChangeLog	2021-10-12 23:36:41 UTC (rev 284060)
@@ -1,3 +1,17 @@
+2021-10-12  Alan Bujtas  <[email protected]>
+
+        [LFC][IFC] LazyLineBreakIterator should be correctly setup for the prior context case
+        https://bugs.webkit.org/show_bug.cgi?id=231608
+
+        Reviewed by Antti Koivisto.
+
+        Pass in the locale and the breaking mode values when constructing the LazyLineBreakIterator for finding soft wrap opportunities across layout boxes.
+
+        Test: fast/inline/line-break-loose-with-inline-box-boundary.html
+
+        * layout/formattingContexts/inline/InlineLineBuilder.cpp:
+        (WebCore::Layout::endsWithSoftWrapOpportunity):
+
 2021-10-12  Sihui Liu  <[email protected]>
 
         Implement FileSystemSyncAccessHandle read() and write()

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


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2021-10-12 23:35:55 UTC (rev 284059)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2021-10-12 23:36:41 UTC (rev 284060)
@@ -60,7 +60,8 @@
         // See the templated CharacterType in nextBreakablePosition for last and lastlast characters. 
         currentContent = String::make16BitFrom8BitSource(currentContent.characters8(), currentContent.length());
     }
-    auto lineBreakIterator = LazyLineBreakIterator { currentContent };
+    auto& style = nextInlineTextItem.style();
+    auto lineBreakIterator = LazyLineBreakIterator { currentContent, style.computedLocale(), TextUtil::lineBreakIteratorMode(style.lineBreak()) };
     auto previousContentLength = previousContent.length();
     // FIXME: We should look into the entire uncommitted content for more text context.
     UChar lastCharacter = previousContentLength ? previousContent[previousContentLength - 1] : 0;
@@ -71,7 +72,7 @@
     // Now check if we can break right at the inline item boundary.
     // With the [ex-ample], findNextBreakablePosition should return the startPosition (0).
     // FIXME: Check if there's a more correct way of finding breaking opportunities.
-    return !TextUtil::findNextBreakablePosition(lineBreakIterator, 0, nextInlineTextItem.style());
+    return !TextUtil::findNextBreakablePosition(lineBreakIterator, 0, style);
 }
 
 static inline bool isAtSoftWrapOpportunity(const InlineFormattingContext& inlineFormattingContext, const InlineItem& current, const InlineItem& next)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to