Title: [269238] trunk
Revision
269238
Author
[email protected]
Date
2020-11-01 14:03:36 -0800 (Sun, 01 Nov 2020)

Log Message

[LegacyInlineLayout] Remove collapsible trailing whitespace when it is followed by a hard line break
https://bugs.webkit.org/show_bug.cgi?id=216902
<rdar://problem/69812136>

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-text/white-space/trailing-space-before-br-001-expected.txt:

Source/WebCore:

Ignore collapsible trailing whitespace followed by hard linebreak while computing the preferred width.
Such content is input to the trimming logic, and it should be handled accordingly.

* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):

LayoutTests:

* fast/text/trimmable-whitespace-followed-by-br-expected.html: Added.
* fast/text/trimmable-whitespace-followed-by-br.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (269237 => 269238)


--- trunk/LayoutTests/ChangeLog	2020-11-01 20:14:18 UTC (rev 269237)
+++ trunk/LayoutTests/ChangeLog	2020-11-01 22:03:36 UTC (rev 269238)
@@ -1,3 +1,14 @@
+2020-11-01  Zalan Bujtas  <[email protected]>
+
+        [LegacyInlineLayout] Remove collapsible trailing whitespace when it is followed by a hard line break
+        https://bugs.webkit.org/show_bug.cgi?id=216902
+        <rdar://problem/69812136>
+
+        Reviewed by Darin Adler.
+
+        * fast/text/trimmable-whitespace-followed-by-br-expected.html: Added.
+        * fast/text/trimmable-whitespace-followed-by-br.html: Added.
+
 2020-11-01  Tyler Wilcock  <[email protected]>
 
         background-size should not accept negative values

Added: trunk/LayoutTests/fast/text/trimmable-whitespace-followed-by-br-expected.html (0 => 269238)


--- trunk/LayoutTests/fast/text/trimmable-whitespace-followed-by-br-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/trimmable-whitespace-followed-by-br-expected.html	2020-11-01 22:03:36 UTC (rev 269238)
@@ -0,0 +1,11 @@
+<style>
+div {
+  position: absolute;
+  font-size: 100px;
+  font-family: Ahem;
+  color: green;
+  background-color: green
+}
+</style>
+PASS if no red.
+<div>X</div>

Added: trunk/LayoutTests/fast/text/trimmable-whitespace-followed-by-br.html (0 => 269238)


--- trunk/LayoutTests/fast/text/trimmable-whitespace-followed-by-br.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/trimmable-whitespace-followed-by-br.html	2020-11-01 22:03:36 UTC (rev 269238)
@@ -0,0 +1,11 @@
+<style>
+div {
+  position: absolute;
+  font-size: 100px;
+  font-family: Ahem;
+  color: green;
+}
+</style>
+PASS if no red.
+<div style="background-color: red">X <br></div>
+<div style="background-color: green">X<br></div>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (269237 => 269238)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2020-11-01 20:14:18 UTC (rev 269237)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2020-11-01 22:03:36 UTC (rev 269238)
@@ -1,3 +1,13 @@
+2020-11-01  Zalan Bujtas  <[email protected]>
+
+        [LegacyInlineLayout] Remove collapsible trailing whitespace when it is followed by a hard line break
+        https://bugs.webkit.org/show_bug.cgi?id=216902
+        <rdar://problem/69812136>
+
+        Reviewed by Darin Adler.
+
+        * web-platform-tests/css/css-text/white-space/trailing-space-before-br-001-expected.txt:
+
 2020-11-01  Tyler Wilcock  <[email protected]>
 
         background-size should not accept negative values

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/trailing-space-before-br-001-expected.txt (269237 => 269238)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/trailing-space-before-br-001-expected.txt	2020-11-01 20:14:18 UTC (rev 269237)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/trailing-space-before-br-001-expected.txt	2020-11-01 22:03:36 UTC (rev 269238)
@@ -5,8 +5,8 @@
 PASS &#x20;1111&#x20;
 PASS 1111<br>
 PASS 1111<br>&#x20;
-FAIL 1111&#x20;<br> assert_approx_equals: expected 19 +/- 1 but got 21
-FAIL 1111&#x20;<br>&#x20; assert_approx_equals: expected 19 +/- 1 but got 21
+PASS 1111&#x20;<br>
+PASS 1111&#x20;<br>&#x20;
 1111 1111  1111 1111  1111
  1111
  1111

Modified: trunk/Source/WebCore/ChangeLog (269237 => 269238)


--- trunk/Source/WebCore/ChangeLog	2020-11-01 20:14:18 UTC (rev 269237)
+++ trunk/Source/WebCore/ChangeLog	2020-11-01 22:03:36 UTC (rev 269238)
@@ -1,3 +1,17 @@
+2020-11-01  Zalan Bujtas  <[email protected]>
+
+        [LegacyInlineLayout] Remove collapsible trailing whitespace when it is followed by a hard line break
+        https://bugs.webkit.org/show_bug.cgi?id=216902
+        <rdar://problem/69812136>
+
+        Reviewed by Darin Adler.
+
+        Ignore collapsible trailing whitespace followed by hard linebreak while computing the preferred width.
+        Such content is input to the trimming logic, and it should be handled accordingly.  
+
+        * rendering/RenderBlockFlow.cpp:
+        (WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths const):
+
 2020-11-01  Tyler Wilcock  <[email protected]>
 
         background-size should not accept negative values

Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (269237 => 269238)


--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-11-01 20:14:18 UTC (rev 269237)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp	2020-11-01 22:03:36 UTC (rev 269238)
@@ -4404,6 +4404,8 @@
             if (child->isListMarker())
                 stripFrontSpaces = true;
         } else {
+            if (styleToUse.collapseWhiteSpace())
+                stripTrailingSpace(inlineMax, inlineMin, trailingSpaceChild);
             minLogicalWidth = preferredWidth(minLogicalWidth, inlineMin);
             maxLogicalWidth = preferredWidth(maxLogicalWidth, inlineMax);
             inlineMin = inlineMax = 0;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to