Title: [288834] branches/safari-613.1.16.1-branch
Revision
288834
Author
[email protected]
Date
2022-01-31 12:40:06 -0800 (Mon, 31 Jan 2022)

Log Message

Cherry-pick r288095. rdar://problem/88286876

    [LFC][IFC] ASSERT in InlineContentBreaker::tryBreakingPreviousNonOverflowingRuns (!partialRun->length) when webinspector is open
    https://bugs.webkit.org/show_bug.cgi?id=235286

    Reviewed by Antti Koivisto.

    Source/WebCore:

    When the overflowing run is non-breakable (in this case an "inline box end" with padding), we try to find a breakable
    previous run in the candidate list. If we find such text run, we try to break it by looking at the applicable CSS properties
    (e.g. word-break, overflow-wrap). Now text runs with 1 (and 0) length and no adjacent text runs need special handling
    as they can't be broken "within word" or at boundary (they treated as "unbreakable").

    Test: fast/text/overflow-wrap-assert-with-zero-width-overflowing-content.html

    * layout/formattingContexts/inline/InlineContentBreaker.cpp:
    (WebCore::Layout::InlineContentBreaker::tryBreakingTextRun const):
    (WebCore::Layout::InlineContentBreaker::tryBreakingPreviousNonOverflowingRuns const): The trailing run starts
    at the beginning of the run and ends right before at the last character.

    LayoutTests:

    * fast/text/overflow-wrap-assert-with-zero-width-overflowing-content-expected.txt: Added.
    * fast/text/overflow-wrap-assert-with-zero-width-overflowing-content.html: Added.
    * platform/ios/fast/text/basic/015-expected.txt: Progressions.
    * platform/mac/fast/text/basic/015-expected.txt:

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-613.1.16.1-branch/LayoutTests/ChangeLog (288833 => 288834)


--- branches/safari-613.1.16.1-branch/LayoutTests/ChangeLog	2022-01-31 20:39:58 UTC (rev 288833)
+++ branches/safari-613.1.16.1-branch/LayoutTests/ChangeLog	2022-01-31 20:40:06 UTC (rev 288834)
@@ -1,3 +1,48 @@
+2022-01-31  Russell Epstein  <[email protected]>
+
+        Cherry-pick r288095. rdar://problem/88286876
+
+    [LFC][IFC] ASSERT in InlineContentBreaker::tryBreakingPreviousNonOverflowingRuns (!partialRun->length) when webinspector is open
+    https://bugs.webkit.org/show_bug.cgi?id=235286
+    
+    Reviewed by Antti Koivisto.
+    
+    Source/WebCore:
+    
+    When the overflowing run is non-breakable (in this case an "inline box end" with padding), we try to find a breakable
+    previous run in the candidate list. If we find such text run, we try to break it by looking at the applicable CSS properties
+    (e.g. word-break, overflow-wrap). Now text runs with 1 (and 0) length and no adjacent text runs need special handling
+    as they can't be broken "within word" or at boundary (they treated as "unbreakable").
+    
+    Test: fast/text/overflow-wrap-assert-with-zero-width-overflowing-content.html
+    
+    * layout/formattingContexts/inline/InlineContentBreaker.cpp:
+    (WebCore::Layout::InlineContentBreaker::tryBreakingTextRun const):
+    (WebCore::Layout::InlineContentBreaker::tryBreakingPreviousNonOverflowingRuns const): The trailing run starts
+    at the beginning of the run and ends right before at the last character.
+    
+    LayoutTests:
+    
+    * fast/text/overflow-wrap-assert-with-zero-width-overflowing-content-expected.txt: Added.
+    * fast/text/overflow-wrap-assert-with-zero-width-overflowing-content.html: Added.
+    * platform/ios/fast/text/basic/015-expected.txt: Progressions.
+    * platform/mac/fast/text/basic/015-expected.txt:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288095 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-17  Alan Bujtas  <[email protected]>
+
+            [LFC][IFC] ASSERT in InlineContentBreaker::tryBreakingPreviousNonOverflowingRuns (!partialRun->length) when webinspector is open
+            https://bugs.webkit.org/show_bug.cgi?id=235286
+
+            Reviewed by Antti Koivisto.
+
+            * fast/text/overflow-wrap-assert-with-zero-width-overflowing-content-expected.txt: Added.
+            * fast/text/overflow-wrap-assert-with-zero-width-overflowing-content.html: Added.
+            * platform/ios/fast/text/basic/015-expected.txt: Progressions.
+            * platform/mac/fast/text/basic/015-expected.txt:
+
 2022-01-25  Alan Coon  <[email protected]>
 
         Cherry-pick r288267. rdar://problem/87785288

Added: branches/safari-613.1.16.1-branch/LayoutTests/fast/text/overflow-wrap-assert-with-zero-width-overflowing-content-expected.txt (0 => 288834)


--- branches/safari-613.1.16.1-branch/LayoutTests/fast/text/overflow-wrap-assert-with-zero-width-overflowing-content-expected.txt	                        (rev 0)
+++ branches/safari-613.1.16.1-branch/LayoutTests/fast/text/overflow-wrap-assert-with-zero-width-overflowing-content-expected.txt	2022-01-31 20:40:06 UTC (rev 288834)
@@ -0,0 +1,2 @@
+PASS if no crash or ASSERT in debug
+​

Added: branches/safari-613.1.16.1-branch/LayoutTests/fast/text/overflow-wrap-assert-with-zero-width-overflowing-content.html (0 => 288834)


--- branches/safari-613.1.16.1-branch/LayoutTests/fast/text/overflow-wrap-assert-with-zero-width-overflowing-content.html	                        (rev 0)
+++ branches/safari-613.1.16.1-branch/LayoutTests/fast/text/overflow-wrap-assert-with-zero-width-overflowing-content.html	2022-01-31 20:40:06 UTC (rev 288834)
@@ -0,0 +1,16 @@
+<style>
+div {
+  width: 0px;
+  overflow-wrap: break-word;
+}
+
+span {
+  padding-right: 0.1px;
+}
+</style>
+PASS if no crash or ASSERT in debug
+<div><span>&#8203;</span></div>
+<script>
+if (window.testRunner)
+  testRunner.dumpAsText();
+</script>
\ No newline at end of file

Modified: branches/safari-613.1.16.1-branch/LayoutTests/platform/ios/fast/text/basic/015-expected.txt (288833 => 288834)


--- branches/safari-613.1.16.1-branch/LayoutTests/platform/ios/fast/text/basic/015-expected.txt	2022-01-31 20:39:58 UTC (rev 288833)
+++ branches/safari-613.1.16.1-branch/LayoutTests/platform/ios/fast/text/basic/015-expected.txt	2022-01-31 20:40:06 UTC (rev 288834)
@@ -35,9 +35,9 @@
           text run at (0,0) width 489: "The first line should break after the letter u, so that the gray border does not "
           text run at (488,0) width 184: "extend beyond the cyan box."
       RenderBlock {DIV} at (0,214) size 87x42 [border: (1px solid #00FFFF)]
-        RenderInline {SPAN} at (0,0) size 72x39 [border: none (30px solid #C0C0C0) none]
-          RenderText {#text} at (1,1) size 72x39
-            text run at (1,1) width 72: "Loremipsu"
+        RenderInline {SPAN} at (0,0) size 70x39 [border: none (30px solid #C0C0C0) none]
+          RenderText {#text} at (1,1) size 70x39
+            text run at (1,1) width 70: "Loremipsu"
             text run at (1,21) width 13: "m"
         RenderText {#text} at (0,0) size 0x0
       RenderBlock {HR} at (0,264) size 784x2 [border: (1px inset #000000)]

Modified: branches/safari-613.1.16.1-branch/LayoutTests/platform/mac/fast/text/basic/015-expected.txt (288833 => 288834)


--- branches/safari-613.1.16.1-branch/LayoutTests/platform/mac/fast/text/basic/015-expected.txt	2022-01-31 20:39:58 UTC (rev 288833)
+++ branches/safari-613.1.16.1-branch/LayoutTests/platform/mac/fast/text/basic/015-expected.txt	2022-01-31 20:40:06 UTC (rev 288834)
@@ -35,9 +35,9 @@
           text run at (0,0) width 488: "The first line should break after the letter u, so that the gray border does not "
           text run at (487,0) width 184: "extend beyond the cyan box."
       RenderBlock {DIV} at (0,202) size 87x38 [border: (1px solid #00FFFF)]
-        RenderInline {SPAN} at (0,0) size 72x36 [border: none (30px solid #C0C0C0) none]
-          RenderText {#text} at (1,1) size 72x36
-            text run at (1,1) width 72: "Loremipsu"
+        RenderInline {SPAN} at (0,0) size 70x36 [border: none (30px solid #C0C0C0) none]
+          RenderText {#text} at (1,1) size 70x36
+            text run at (1,1) width 70: "Loremipsu"
             text run at (1,19) width 13: "m"
         RenderText {#text} at (0,0) size 0x0
       RenderBlock {HR} at (0,248) size 784x2 [border: (1px inset #000000)]

Modified: branches/safari-613.1.16.1-branch/Source/WebCore/ChangeLog (288833 => 288834)


--- branches/safari-613.1.16.1-branch/Source/WebCore/ChangeLog	2022-01-31 20:39:58 UTC (rev 288833)
+++ branches/safari-613.1.16.1-branch/Source/WebCore/ChangeLog	2022-01-31 20:40:06 UTC (rev 288834)
@@ -1,3 +1,55 @@
+2022-01-31  Russell Epstein  <[email protected]>
+
+        Cherry-pick r288095. rdar://problem/88286876
+
+    [LFC][IFC] ASSERT in InlineContentBreaker::tryBreakingPreviousNonOverflowingRuns (!partialRun->length) when webinspector is open
+    https://bugs.webkit.org/show_bug.cgi?id=235286
+    
+    Reviewed by Antti Koivisto.
+    
+    Source/WebCore:
+    
+    When the overflowing run is non-breakable (in this case an "inline box end" with padding), we try to find a breakable
+    previous run in the candidate list. If we find such text run, we try to break it by looking at the applicable CSS properties
+    (e.g. word-break, overflow-wrap). Now text runs with 1 (and 0) length and no adjacent text runs need special handling
+    as they can't be broken "within word" or at boundary (they treated as "unbreakable").
+    
+    Test: fast/text/overflow-wrap-assert-with-zero-width-overflowing-content.html
+    
+    * layout/formattingContexts/inline/InlineContentBreaker.cpp:
+    (WebCore::Layout::InlineContentBreaker::tryBreakingTextRun const):
+    (WebCore::Layout::InlineContentBreaker::tryBreakingPreviousNonOverflowingRuns const): The trailing run starts
+    at the beginning of the run and ends right before at the last character.
+    
+    LayoutTests:
+    
+    * fast/text/overflow-wrap-assert-with-zero-width-overflowing-content-expected.txt: Added.
+    * fast/text/overflow-wrap-assert-with-zero-width-overflowing-content.html: Added.
+    * platform/ios/fast/text/basic/015-expected.txt: Progressions.
+    * platform/mac/fast/text/basic/015-expected.txt:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288095 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-17  Alan Bujtas  <[email protected]>
+
+            [LFC][IFC] ASSERT in InlineContentBreaker::tryBreakingPreviousNonOverflowingRuns (!partialRun->length) when webinspector is open
+            https://bugs.webkit.org/show_bug.cgi?id=235286
+
+            Reviewed by Antti Koivisto.
+
+            When the overflowing run is non-breakable (in this case an "inline box end" with padding), we try to find a breakable
+            previous run in the candidate list. If we find such text run, we try to break it by looking at the applicable CSS properties
+            (e.g. word-break, overflow-wrap). Now text runs with 1 (and 0) length and no adjacent text runs need special handling
+            as they can't be broken "within word" or at boundary (they treated as "unbreakable").
+
+            Test: fast/text/overflow-wrap-assert-with-zero-width-overflowing-content.html
+
+            * layout/formattingContexts/inline/InlineContentBreaker.cpp:
+            (WebCore::Layout::InlineContentBreaker::tryBreakingTextRun const):
+            (WebCore::Layout::InlineContentBreaker::tryBreakingPreviousNonOverflowingRuns const): The trailing run starts
+            at the beginning of the run and ends right before at the last character.
+
 2022-01-25  Alan Coon  <[email protected]>
 
         Cherry-pick r288267. rdar://problem/87785288

Modified: branches/safari-613.1.16.1-branch/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp (288833 => 288834)


--- branches/safari-613.1.16.1-branch/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp	2022-01-31 20:39:58 UTC (rev 288833)
+++ branches/safari-613.1.16.1-branch/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp	2022-01-31 20:40:06 UTC (rev 288834)
@@ -459,7 +459,7 @@
     }
 
     if (breakRules.contains(WordBreakRule::AtArbitraryPosition)) {
-        auto tryBreakingAtArbitraryPosition = [&]() -> PartialRun {
+        auto tryBreakingAtArbitraryPosition = [&]() -> std::optional<PartialRun> {
             if (!inlineTextItem.length()) {
                 // Empty text runs may be breakable based on style, but in practice we can't really split them any further.
                 return { };
@@ -472,18 +472,21 @@
                 if (nextTextRunIndex(runs, candidateTextRun.index)) {
                     // We are in-between text runs. It's okay to return the entire run triggering split at the very right edge.
                     auto trailingPartialRunWidth = TextUtil::width(inlineTextItem, fontCascade, candidateTextRun.logicalLeft);
-                    return { inlineTextItem.length(), trailingPartialRunWidth };
+                    return PartialRun { inlineTextItem.length(), trailingPartialRunWidth };
                 }
-                auto startPosition = inlineTextItem.start() + 1;
-                auto endPosition = inlineTextItem.end();
-                return { inlineTextItem.length() - 1, TextUtil::width(inlineTextItem, fontCascade, startPosition, endPosition, candidateTextRun.logicalLeft) };
+                if (inlineTextItem.length() > 1) {
+                    auto startPosition = inlineTextItem.start();
+                    auto endPosition = inlineTextItem.end() - 1;
+                    return PartialRun { inlineTextItem.length() - 1, TextUtil::width(inlineTextItem, fontCascade, startPosition, endPosition, candidateTextRun.logicalLeft) };
+                }
+                return { };
             }
             if (!lineHasRoomForContent) {
                 // Fast path for cases when there's no room at all. The content is breakable but we don't have space for it.
-                return { };
+                return PartialRun { };
             }
             auto wordBreak = TextUtil::breakWord(inlineTextItem, fontCascade, candidateRun.logicalWidth, availableWidth, candidateTextRun.logicalLeft);
-            return { wordBreak.length, wordBreak.logicalWidth };
+            return PartialRun { wordBreak.length, wordBreak.logicalWidth };
         };
         // With arbitrary breaking there's always a valid breaking position (even if it is before the first position).
         return tryBreakingAtArbitraryPosition();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to