Title: [288095] trunk
Revision
288095
Author
[email protected]
Date
2022-01-17 09:21:20 -0800 (Mon, 17 Jan 2022)

Log Message

[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:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (288094 => 288095)


--- trunk/LayoutTests/ChangeLog	2022-01-17 14:31:42 UTC (rev 288094)
+++ trunk/LayoutTests/ChangeLog	2022-01-17 17:21:20 UTC (rev 288095)
@@ -1,3 +1,15 @@
+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-17  Youenn Fablet  <[email protected]>
 
         Make ServiceWorkerClient.id a UUID instead of a string derived from a ScriptExecutionContextIdentifier

Added: trunk/LayoutTests/fast/text/overflow-wrap-assert-with-zero-width-overflowing-content-expected.txt (0 => 288095)


--- trunk/LayoutTests/fast/text/overflow-wrap-assert-with-zero-width-overflowing-content-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/text/overflow-wrap-assert-with-zero-width-overflowing-content-expected.txt	2022-01-17 17:21:20 UTC (rev 288095)
@@ -0,0 +1,2 @@
+PASS if no crash or ASSERT in debug
+​

Added: trunk/LayoutTests/fast/text/overflow-wrap-assert-with-zero-width-overflowing-content.html (0 => 288095)


--- trunk/LayoutTests/fast/text/overflow-wrap-assert-with-zero-width-overflowing-content.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/overflow-wrap-assert-with-zero-width-overflowing-content.html	2022-01-17 17:21:20 UTC (rev 288095)
@@ -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: trunk/LayoutTests/platform/ios/fast/text/basic/015-expected.txt (288094 => 288095)


--- trunk/LayoutTests/platform/ios/fast/text/basic/015-expected.txt	2022-01-17 14:31:42 UTC (rev 288094)
+++ trunk/LayoutTests/platform/ios/fast/text/basic/015-expected.txt	2022-01-17 17:21:20 UTC (rev 288095)
@@ -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: trunk/LayoutTests/platform/mac/fast/text/basic/015-expected.txt (288094 => 288095)


--- trunk/LayoutTests/platform/mac/fast/text/basic/015-expected.txt	2022-01-17 14:31:42 UTC (rev 288094)
+++ trunk/LayoutTests/platform/mac/fast/text/basic/015-expected.txt	2022-01-17 17:21:20 UTC (rev 288095)
@@ -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: trunk/Source/WebCore/ChangeLog (288094 => 288095)


--- trunk/Source/WebCore/ChangeLog	2022-01-17 14:31:42 UTC (rev 288094)
+++ trunk/Source/WebCore/ChangeLog	2022-01-17 17:21:20 UTC (rev 288095)
@@ -1,3 +1,22 @@
+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-17  Youenn Fablet  <[email protected]>
 
         Make ServiceWorkerClient.id a UUID instead of a string derived from a ScriptExecutionContextIdentifier

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp (288094 => 288095)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp	2022-01-17 14:31:42 UTC (rev 288094)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp	2022-01-17 17:21:20 UTC (rev 288095)
@@ -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