Title: [289320] branches/safari-613-branch
Revision
289320
Author
[email protected]
Date
2022-02-07 18:56:21 -0800 (Mon, 07 Feb 2022)

Log Message

Cherry-pick r288800. rdar://problem/88241513

    [LFC][IFC] Do not break content at an inline box boundary
    https://bugs.webkit.org/show_bug.cgi?id=235868

    Reviewed by Antti Koivisto.

    Source/WebCore:

    Handle nested inline boxes, when the breaking position is between at an inline box boundary.
    e.g.
      <div style="width: 1px"><span><span><span>this_content_overflow</span></span></span></div>
    while the breaking position is between the 3rd <span> and the letter 't', we should not let the first
    line have all the <span><span><span> content only, but instead find a more reasonable breaking position by
    looking at the previous runs.
    This patch expands "findTrailingRunIndex" to find multiple, subsequent (nested) inline boxes.

    Test: fast/inline/nested-inline-box-with-word-break.html

    * layout/formattingContexts/inline/InlineContentBreaker.cpp:
    (WebCore::Layout::findTrailingRunIndex):

    LayoutTests:

    * fast/inline/nested-inline-box-with-word-break-expected.html: Added.
    * fast/inline/nested-inline-box-with-word-break.html: Added.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288800 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-613-branch/LayoutTests/ChangeLog (289319 => 289320)


--- branches/safari-613-branch/LayoutTests/ChangeLog	2022-02-08 02:56:17 UTC (rev 289319)
+++ branches/safari-613-branch/LayoutTests/ChangeLog	2022-02-08 02:56:21 UTC (rev 289320)
@@ -1,5 +1,47 @@
 2022-02-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r288800. rdar://problem/88241513
+
+    [LFC][IFC] Do not break content at an inline box boundary
+    https://bugs.webkit.org/show_bug.cgi?id=235868
+    
+    Reviewed by Antti Koivisto.
+    
+    Source/WebCore:
+    
+    Handle nested inline boxes, when the breaking position is between at an inline box boundary.
+    e.g.
+      <div style="width: 1px"><span><span><span>this_content_overflow</span></span></span></div>
+    while the breaking position is between the 3rd <span> and the letter 't', we should not let the first
+    line have all the <span><span><span> content only, but instead find a more reasonable breaking position by
+    looking at the previous runs.
+    This patch expands "findTrailingRunIndex" to find multiple, subsequent (nested) inline boxes.
+    
+    Test: fast/inline/nested-inline-box-with-word-break.html
+    
+    * layout/formattingContexts/inline/InlineContentBreaker.cpp:
+    (WebCore::Layout::findTrailingRunIndex):
+    
+    LayoutTests:
+    
+    * fast/inline/nested-inline-box-with-word-break-expected.html: Added.
+    * fast/inline/nested-inline-box-with-word-break.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288800 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-30  Alan Bujtas  <[email protected]>
+
+            [LFC][IFC] Do not break content at an inline box boundary
+            https://bugs.webkit.org/show_bug.cgi?id=235868
+
+            Reviewed by Antti Koivisto.
+
+            * fast/inline/nested-inline-box-with-word-break-expected.html: Added.
+            * fast/inline/nested-inline-box-with-word-break.html: Added.
+
+2022-02-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r288789. rdar://problem/88043325
 
     Capturing WebGL canvas through peer connection shows the image flipped

Added: branches/safari-613-branch/LayoutTests/fast/inline/nested-inline-box-with-word-break-expected.html (0 => 289320)


--- branches/safari-613-branch/LayoutTests/fast/inline/nested-inline-box-with-word-break-expected.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/fast/inline/nested-inline-box-with-word-break-expected.html	2022-02-08 02:56:21 UTC (rev 289320)
@@ -0,0 +1,17 @@
+<style>
+div {
+  font-family: Ahem;
+  font-size: 20px;
+  width: 20px;
+  word-break: break-word;
+  color: green;
+}
+</style>
+<div style="padding-left: 40px">X</div>
+<div style="padding-left: 0px">X</div>
+<div style="padding-left: 80px">X</div>
+<div style="padding-left: 0px">X</div>
+<div style="padding-left: 30px">XXXX</div>
+<div style="padding-left: 0px">X</div>
+<div style="padding-left: 40px">XXXX</div>
+<div style="padding-left: 0px">XXXX</div>

Added: branches/safari-613-branch/LayoutTests/fast/inline/nested-inline-box-with-word-break.html (0 => 289320)


--- branches/safari-613-branch/LayoutTests/fast/inline/nested-inline-box-with-word-break.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/fast/inline/nested-inline-box-with-word-break.html	2022-02-08 02:56:21 UTC (rev 289320)
@@ -0,0 +1,25 @@
+<style>
+div {
+  font-family: Ahem;
+  font-size: 20px;
+  width: 20px;
+  word-break: break-word;
+  color: green;
+}
+.first span {
+  padding: 10px
+}
+.second span {
+  padding: 20px
+}
+.third span {
+  padding: 30px
+}
+.forth span {
+  padding: 40px
+}
+</style>
+<div class=first><span><span><span><span>XX</span></span></span></span></div>
+<div class=second><span><span><span><span>XX</span></span></span></span></div>
+<div class=third><span>X<span>X<span>X<span>XX</span></span></span></span></div>
+<div class=forth><span>X<span>X<span>X<span>XX</span>X</span>X</span>X</span></div>

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (289319 => 289320)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-02-08 02:56:17 UTC (rev 289319)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-02-08 02:56:21 UTC (rev 289320)
@@ -1,5 +1,57 @@
 2022-02-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r288800. rdar://problem/88241513
+
+    [LFC][IFC] Do not break content at an inline box boundary
+    https://bugs.webkit.org/show_bug.cgi?id=235868
+    
+    Reviewed by Antti Koivisto.
+    
+    Source/WebCore:
+    
+    Handle nested inline boxes, when the breaking position is between at an inline box boundary.
+    e.g.
+      <div style="width: 1px"><span><span><span>this_content_overflow</span></span></span></div>
+    while the breaking position is between the 3rd <span> and the letter 't', we should not let the first
+    line have all the <span><span><span> content only, but instead find a more reasonable breaking position by
+    looking at the previous runs.
+    This patch expands "findTrailingRunIndex" to find multiple, subsequent (nested) inline boxes.
+    
+    Test: fast/inline/nested-inline-box-with-word-break.html
+    
+    * layout/formattingContexts/inline/InlineContentBreaker.cpp:
+    (WebCore::Layout::findTrailingRunIndex):
+    
+    LayoutTests:
+    
+    * fast/inline/nested-inline-box-with-word-break-expected.html: Added.
+    * fast/inline/nested-inline-box-with-word-break.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288800 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-30  Alan Bujtas  <[email protected]>
+
+            [LFC][IFC] Do not break content at an inline box boundary
+            https://bugs.webkit.org/show_bug.cgi?id=235868
+
+            Reviewed by Antti Koivisto.
+
+            Handle nested inline boxes, when the breaking position is between at an inline box boundary.
+            e.g.
+              <div style="width: 1px"><span><span><span>this_content_overflow</span></span></span></div>
+            while the breaking position is between the 3rd <span> and the letter 't', we should not let the first
+            line have all the <span><span><span> content only, but instead find a more reasonable breaking position by
+            looking at the previous runs.
+            This patch expands "findTrailingRunIndex" to find multiple, subsequent (nested) inline boxes.
+
+            Test: fast/inline/nested-inline-box-with-word-break.html
+
+            * layout/formattingContexts/inline/InlineContentBreaker.cpp:
+            (WebCore::Layout::findTrailingRunIndex):
+
+2022-02-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r288789. rdar://problem/88043325
 
     Capturing WebGL canvas through peer connection shows the image flipped

Modified: branches/safari-613-branch/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp (289319 => 289320)


--- branches/safari-613-branch/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp	2022-02-08 02:56:17 UTC (rev 289319)
+++ branches/safari-613-branch/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp	2022-02-08 02:56:21 UTC (rev 289320)
@@ -267,9 +267,12 @@
     // Try not break content at inline box boundary
     // e.g. <span>fits</span><span>overflows</span>
     // when the text "overflows" completely overflows, let's break the content right before the '<span>'.
-    auto trailingCandidateIndex = breakableRunIndex - 1;
-    auto isAtInlineBox = runs[trailingCandidateIndex].inlineItem.isInlineBoxStart();
-    return !isAtInlineBox ? trailingCandidateIndex : trailingCandidateIndex ? std::make_optional(trailingCandidateIndex - 1) : std::nullopt;
+    for (auto trailingCandidateIndex = breakableRunIndex; trailingCandidateIndex--;) {
+        auto isAtInlineBox = runs[trailingCandidateIndex].inlineItem.isInlineBoxStart();
+        if (!isAtInlineBox)
+            return trailingCandidateIndex;
+    }
+    return { };
 }
 
 static bool isWrappableRun(const InlineContentBreaker::ContinuousContent::Run& run)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to