Title: [288800] trunk
- Revision
- 288800
- Author
- [email protected]
- Date
- 2022-01-30 07:58:47 -0800 (Sun, 30 Jan 2022)
Log Message
[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.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (288799 => 288800)
--- trunk/LayoutTests/ChangeLog 2022-01-30 13:19:24 UTC (rev 288799)
+++ trunk/LayoutTests/ChangeLog 2022-01-30 15:58:47 UTC (rev 288800)
@@ -1,3 +1,13 @@
+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-01-29 Alexey Shvayka <[email protected]>
[WebIDL] Add a sensible error message for a primitive non-null EventListener
Added: trunk/LayoutTests/fast/inline/nested-inline-box-with-word-break-expected.html (0 => 288800)
--- trunk/LayoutTests/fast/inline/nested-inline-box-with-word-break-expected.html (rev 0)
+++ trunk/LayoutTests/fast/inline/nested-inline-box-with-word-break-expected.html 2022-01-30 15:58:47 UTC (rev 288800)
@@ -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: trunk/LayoutTests/fast/inline/nested-inline-box-with-word-break.html (0 => 288800)
--- trunk/LayoutTests/fast/inline/nested-inline-box-with-word-break.html (rev 0)
+++ trunk/LayoutTests/fast/inline/nested-inline-box-with-word-break.html 2022-01-30 15:58:47 UTC (rev 288800)
@@ -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: trunk/Source/WebCore/ChangeLog (288799 => 288800)
--- trunk/Source/WebCore/ChangeLog 2022-01-30 13:19:24 UTC (rev 288799)
+++ trunk/Source/WebCore/ChangeLog 2022-01-30 15:58:47 UTC (rev 288800)
@@ -1,3 +1,23 @@
+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-01-30 Philippe Normand <[email protected]>
[GStreamer] GstStructure to JSON serialization
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp (288799 => 288800)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp 2022-01-30 13:19:24 UTC (rev 288799)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp 2022-01-30 15:58:47 UTC (rev 288800)
@@ -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