Title: [286000] trunk
- Revision
- 286000
- Author
- [email protected]
- Date
- 2021-11-18 06:43:13 -0800 (Thu, 18 Nov 2021)
Log Message
[LFC][IFC] Inline boxes with unbreakable decoration can produce a breaking position with no trailing run
https://bugs.webkit.org/show_bug.cgi?id=233302
Reviewed by Antti Koivisto.
Source/WebCore:
This is a rare case when the overflowing run is the first inline box start with unbreakable decoration while its content is breakable.
e.g.
<div style="width: 0xp"><span style="border: solid; word-break: break-word;">breakable</span></div>
While the overflowing run (inline box start) is unbreakable (border), we find the first breaking position right between
the <span> (inline box start) and its content (inline text item).
However we also don't want to separate the content from its parent inline box (i.e. should not be breaking between these 2 inline items)
so we start searching for a trailing run candidate by looking at the previous set of runs.
Now if this <span> is the first run in this set we won't find a trailing run and we should just return the breaking position with no trailing content.
Test: fast/inline/inline-box-with-unbreakable-decoration-and-word-break.html
* layout/formattingContexts/inline/InlineContentBreaker.cpp:
(WebCore::Layout::InlineContentBreaker::tryBreakingNextOverflowingRuns const):
LayoutTests:
* fast/inline/inline-box-with-unbreakable-decoration-and-word-break-expected.html: Added.
* fast/inline/inline-box-with-unbreakable-decoration-and-word-break.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (285999 => 286000)
--- trunk/LayoutTests/ChangeLog 2021-11-18 14:20:45 UTC (rev 285999)
+++ trunk/LayoutTests/ChangeLog 2021-11-18 14:43:13 UTC (rev 286000)
@@ -1,3 +1,13 @@
+2021-11-18 Alan Bujtas <[email protected]>
+
+ [LFC][IFC] Inline boxes with unbreakable decoration can produce a breaking position with no trailing run
+ https://bugs.webkit.org/show_bug.cgi?id=233302
+
+ Reviewed by Antti Koivisto.
+
+ * fast/inline/inline-box-with-unbreakable-decoration-and-word-break-expected.html: Added.
+ * fast/inline/inline-box-with-unbreakable-decoration-and-word-break.html: Added.
+
2021-11-18 Ziran Sun <[email protected]>
Images as grid items should use the overridingLogicalWidth when defined to compute the logical Height
Added: trunk/LayoutTests/fast/inline/inline-box-with-unbreakable-decoration-and-word-break-expected.html (0 => 286000)
--- trunk/LayoutTests/fast/inline/inline-box-with-unbreakable-decoration-and-word-break-expected.html (rev 0)
+++ trunk/LayoutTests/fast/inline/inline-box-with-unbreakable-decoration-and-word-break-expected.html 2021-11-18 14:43:13 UTC (rev 286000)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<style>
+pre {
+ position: absolute;
+ font-family: Ahem;
+ color: green;
+ font-size: 100px;
+ margin: 0px;
+}
+</style>
+<pre> X
+X</pre>
Added: trunk/LayoutTests/fast/inline/inline-box-with-unbreakable-decoration-and-word-break.html (0 => 286000)
--- trunk/LayoutTests/fast/inline/inline-box-with-unbreakable-decoration-and-word-break.html (rev 0)
+++ trunk/LayoutTests/fast/inline/inline-box-with-unbreakable-decoration-and-word-break.html 2021-11-18 14:43:13 UTC (rev 286000)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<style>
+div {
+ position: absolute;
+ font-family: Ahem;
+ color: green;
+ font-size: 100px;
+}
+
+.test {
+ width: 0px;
+}
+
+.reference {
+ color: red;
+ white-space: pre;
+}
+
+span {
+ padding-left: 100px;
+ word-break: break-word;
+}
+</style>
+<!-- we should be able to break the inline box content after the first 'X' -->
+<div class="reference"> X
+X</div>
+
+<div class=test><span>XX</span></div>
Modified: trunk/Source/WebCore/ChangeLog (285999 => 286000)
--- trunk/Source/WebCore/ChangeLog 2021-11-18 14:20:45 UTC (rev 285999)
+++ trunk/Source/WebCore/ChangeLog 2021-11-18 14:43:13 UTC (rev 286000)
@@ -1,5 +1,27 @@
2021-11-18 Alan Bujtas <[email protected]>
+ [LFC][IFC] Inline boxes with unbreakable decoration can produce a breaking position with no trailing run
+ https://bugs.webkit.org/show_bug.cgi?id=233302
+
+ Reviewed by Antti Koivisto.
+
+ This is a rare case when the overflowing run is the first inline box start with unbreakable decoration while its content is breakable.
+ e.g.
+ <div style="width: 0xp"><span style="border: solid; word-break: break-word;">breakable</span></div>
+
+ While the overflowing run (inline box start) is unbreakable (border), we find the first breaking position right between
+ the <span> (inline box start) and its content (inline text item).
+ However we also don't want to separate the content from its parent inline box (i.e. should not be breaking between these 2 inline items)
+ so we start searching for a trailing run candidate by looking at the previous set of runs.
+ Now if this <span> is the first run in this set we won't find a trailing run and we should just return the breaking position with no trailing content.
+
+ Test: fast/inline/inline-box-with-unbreakable-decoration-and-word-break.html
+
+ * layout/formattingContexts/inline/InlineContentBreaker.cpp:
+ (WebCore::Layout::InlineContentBreaker::tryBreakingNextOverflowingRuns const):
+
+2021-11-18 Alan Bujtas <[email protected]>
+
[LFC][IFC] Glyphs that conditionally hang are taken into account for max-content only
https://bugs.webkit.org/show_bug.cgi?id=233287
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp (285999 => 286000)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp 2021-11-18 14:20:45 UTC (rev 285999)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp 2021-11-18 14:43:13 UTC (rev 286000)
@@ -577,10 +577,13 @@
// We managed to break this text run mid content. It has to be either an arbitrary mid-word or a hyphen break.
return OverflowingTextContent::BreakingPosition { index, OverflowingTextContent::BreakingPosition::TrailingContent { true, partialRun } };
}
- auto trailingRunIndex = *findTrailingRunIndex(runs, index);
- // At worst we are back to the overflowing run, like in the example above.
- ASSERT(trailingRunIndex >= overflowingRunIndex);
- return OverflowingTextContent::BreakingPosition { trailingRunIndex, OverflowingTextContent::BreakingPosition::TrailingContent { true } };
+ if (auto trailingRunIndex = findTrailingRunIndex(runs, index)) {
+ // At worst we are back to the overflowing run, like in the example above.
+ ASSERT(*trailingRunIndex >= overflowingRunIndex);
+ return OverflowingTextContent::BreakingPosition { *trailingRunIndex, OverflowingTextContent::BreakingPosition::TrailingContent { true } };
+ }
+ // This happens when the overflowing run is also the first run in this set, no trailing run.
+ return OverflowingTextContent::BreakingPosition { overflowingRunIndex, { } };
}
nextContentWidth += run.logicalWidth;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes