Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 2977b592ad531f1886d011484f62f442138f6086
https://github.com/WebKit/WebKit/commit/2977b592ad531f1886d011484f62f442138f6086
Author: Yulun Wu <[email protected]>
Date: 2026-06-08 (Mon, 08 Jun 2026)
Changed paths:
A
LayoutTests/fast/css3-text/css3-text-wrap/text-wrap-balance-line-clamp-1-expected.html
A
LayoutTests/fast/css3-text/css3-text-wrap/text-wrap-balance-line-clamp-1.html
M LayoutTests/platform/glib/TestExpectations
M
Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.cpp
Log Message:
-----------
[text-wrap: balance] Not applied to content with -webkit-line-clamp: 2
https://bugs.webkit.org/show_bug.cgi?id=316033
rdar://172715503
Reviewed by Alan Baradlay.
InlineContentConstrainer is essentially disabled when
-webkit-line-clamp: 2 is applied because it causes an off-by-one
error in m_numberOfLinesInOriginalLayout.
InlineContentConstrainer::initialize() uses a greedy layout loop to
get information such as the numebr of lines used, original line widths, etc.
However, this greedy layout has an early break for line-clamp
when incrementing the line index would cause us to reach the line limit.
This would fire before lineIndex++, causing pages with webkit-line-clamp: 2
to set m_numberOfLinesInOriginalLayout to 1. This would trigger the
m_hasSingleLineVisibleContent short-circuit in computeParagraphLevelConstraints
and entirely disable balance.
Derive the count from m_originalLineConstraints.size() instead. The
Vector is appended to once per laid-out line, so its size is the
source-of-truth count regardless of how the loop exits.
Drop the glib [ Pass ] override for WPT text-wrap-balance-line-clamp-002.html
This test was passing due to the text expectation for balance being satisfied
by greedy text wrapping, which is what we fall back to when we short-circuit
computeParagraphLevelConstraints.
*
LayoutTests/fast/css3-text/css3-text-wrap/text-wrap-balance-line-clamp-1-expected.html:
Added.
*
LayoutTests/fast/css3-text/css3-text-wrap/text-wrap-balance-line-clamp-1.html:
Added.
* LayoutTests/platform/glib/TestExpectations:
* Source/WebCore/layout/formattingContexts/inline/InlineContentConstrainer.cpp:
(WebCore::Layout::InlineContentConstrainer::initialize):
Canonical link: https://commits.webkit.org/314783@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications