Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 758dccb228d2e6bc03c4568494ab24bdb84e97c8
https://github.com/WebKit/WebKit/commit/758dccb228d2e6bc03c4568494ab24bdb84e97c8
Author: Alan Baradlay <[email protected]>
Date: 2026-05-19 (Tue, 19 May 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/reference/white-space-intrinsic-size-024-ref.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/white-space-intrinsic-size-024-expected.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/white-space-intrinsic-size-024.html
M Source/WebCore/rendering/RenderBlockFlow.cpp
Log Message:
-----------
Preferred width does not trim trailing whitespace before preserved newline
https://bugs.webkit.org/show_bug.cgi?id=315032
Reviewed by Antti Koivisto.
<div style="width: max-content">
X <span style="white-space: pre-line">
X</span>
</div>
The div should be one X wide. Instead it was one X plus a trailing space wide.
When a preserved newline shows up inside text, the closing line's
width was recorded without trimming the trailing whitespace. <br>
already trims via resetLineForForcedLineBreak; the text branch was
missing the same step, so the previous text node's trailing space
leaked into the max-content size.
Trim the trailing whitespace when this text begins with the forced
break (widths.hasBreak && !widths.beginMax) and the trailing-space
renderer collapses whitespace.
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::computeInlinePreferredLogicalWidths):
*
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/white-space-intrinsic-size-024{,-expected}.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-text/white-space/reference/white-space-intrinsic-size-024-ref.html:
Added.
Canonical link: https://commits.webkit.org/313480@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications