Title: [287504] trunk
Revision
287504
Author
[email protected]
Date
2022-01-01 14:54:52 -0800 (Sat, 01 Jan 2022)

Log Message

[LFC][IFC] Unexpected line break with leading collapsed whitespace
https://bugs.webkit.org/show_bug.cgi?id=234786

Reviewed by Antti Koivisto.

Source/WebCore:

We use Line::hasContent to decide whether an overflowing content should be wrapped to the next line.
Line is considered empty unless it has at least one content-type run.

Test: fast/inline/unexpected-line-break-on-empty-content.html

* layout/formattingContexts/inline/InlineLine.h:
(WebCore::Layout::Line::hasContent const):

LayoutTests:

* fast/inline/unexpected-line-break-on-empty-content-expected.html: Added.
* fast/inline/unexpected-line-break-on-empty-content.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (287503 => 287504)


--- trunk/LayoutTests/ChangeLog	2022-01-01 21:03:23 UTC (rev 287503)
+++ trunk/LayoutTests/ChangeLog	2022-01-01 22:54:52 UTC (rev 287504)
@@ -1,5 +1,15 @@
 2022-01-01  Alan Bujtas  <[email protected]>
 
+        [LFC][IFC] Unexpected line break with leading collapsed whitespace
+        https://bugs.webkit.org/show_bug.cgi?id=234786
+
+        Reviewed by Antti Koivisto.
+
+        * fast/inline/unexpected-line-break-on-empty-content-expected.html: Added.
+        * fast/inline/unexpected-line-break-on-empty-content.html: Added.
+
+2022-01-01  Alan Bujtas  <[email protected]>
+
         [LFC][IFC] Incorrect word-spacing gaps between RTL runs
         https://bugs.webkit.org/show_bug.cgi?id=234771
 

Added: trunk/LayoutTests/fast/inline/unexpected-line-break-on-empty-content-expected.html (0 => 287504)


--- trunk/LayoutTests/fast/inline/unexpected-line-break-on-empty-content-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/unexpected-line-break-on-empty-content-expected.html	2022-01-01 22:54:52 UTC (rev 287504)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<style>
+div {
+  width: 0px;
+  font-family: Ahem;
+  font-size: 20px;
+  color: green;
+  white-space: pre;
+}
+</style>
+<div>X</div>
+<div>X</div>
+<div>X</div>
+<div>X</div>
+<div> X</div>
+<div> X</div>
+<div>X</div>
+<div>X</div>
+<div>X</div>
+<div>X</div>
+<div>X</div>
+<div>X</div>
+<div> X</div>
+<div> X</div>

Added: trunk/LayoutTests/fast/inline/unexpected-line-break-on-empty-content.html (0 => 287504)


--- trunk/LayoutTests/fast/inline/unexpected-line-break-on-empty-content.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/unexpected-line-break-on-empty-content.html	2022-01-01 22:54:52 UTC (rev 287504)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<style>
+div {
+  width: 0px;
+  font-family: Ahem;
+  font-size: 20px;
+  color: green;
+}
+</style>
+<div> X</div>
+<div> <span>X</span></div>
+<div><span> X</span></div>
+<div> <span> X</span></div>
+<div> <span style="margin: 20px;"> X</span></div>
+<div> <span style="padding: 20px;"> X</span></div>
+<div> <span><span>X</span></span></div>
+<div> <span></span><span><span>X</span></span></div>
+<div><span></span> <span></span><span><span>X</span></span></div>
+<div><span></span><span></span> <span><span>X</span></span></div>
+<div><span></span><span></span><span> <span>X</span></span></div>
+<div><span></span><span></span><span><span> X</span></span></div>
+<div><span></span><span></span><span><span style="margin: 20px"> X</span></span></div>
+<div><span></span><span></span><span><span style="padding: 20px"> X</span></span></div>

Modified: trunk/Source/WebCore/ChangeLog (287503 => 287504)


--- trunk/Source/WebCore/ChangeLog	2022-01-01 21:03:23 UTC (rev 287503)
+++ trunk/Source/WebCore/ChangeLog	2022-01-01 22:54:52 UTC (rev 287504)
@@ -1,3 +1,18 @@
+2022-01-01  Alan Bujtas  <[email protected]>
+
+        [LFC][IFC] Unexpected line break with leading collapsed whitespace
+        https://bugs.webkit.org/show_bug.cgi?id=234786
+
+        Reviewed by Antti Koivisto.
+
+        We use Line::hasContent to decide whether an overflowing content should be wrapped to the next line.
+        Line is considered empty unless it has at least one content-type run. 
+
+        Test: fast/inline/unexpected-line-break-on-empty-content.html
+
+        * layout/formattingContexts/inline/InlineLine.h:
+        (WebCore::Layout::Line::hasContent const):
+
 2022-01-01  Jeff Miller  <[email protected]>
 
         Update user-visible copyright strings to include 2022

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.h (287503 => 287504)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.h	2022-01-01 21:03:23 UTC (rev 287503)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.h	2022-01-01 22:54:52 UTC (rev 287504)
@@ -47,7 +47,7 @@
 
     void append(const InlineItem&, const RenderStyle&, InlineLayoutUnit logicalWidth);
 
-    bool hasContent() const { return !m_runs.isEmpty() && !m_runs.last().isLineSpanningInlineBoxStart(); }
+    bool hasContent() const;
 
     bool contentNeedsBidiReordering() const { return m_hasNonDefaultBidiLevelRun; }
 
@@ -233,6 +233,16 @@
     bool m_hasNonDefaultBidiLevelRun { false };
 };
 
+
+inline bool Line::hasContent() const
+{
+    for (auto& run : makeReversedRange(m_runs)) {
+        if (run.isText() || run.isBox() || run.isLineBreak())
+            return true;
+    }
+    return false;
+}
+
 inline void Line::TrimmableTrailingContent::reset()
 {
     m_hasFullyTrimmableContent = false;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to