Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e3e3003de50fb5686ce6ae0fc145b6fc94f84a95
https://github.com/WebKit/WebKit/commit/e3e3003de50fb5686ce6ae0fc145b6fc94f84a95
Author: Alan Baradlay <[email protected]>
Date: 2026-10-06 (Tue, 06 Oct 2026)
Changed paths:
M LayoutTests/TestExpectations
M
Source/WebCore/layout/integration/LayoutIntegrationFormattingContextLayout.cpp
M Source/WebCore/rendering/LineClampUpdater.cpp
M Source/WebCore/rendering/LineClampUpdater.h
M Source/WebCore/rendering/RenderBlock.cpp
M Source/WebCore/rendering/RenderBlockFlow.cpp
M Source/WebCore/rendering/RenderLayoutState.h
Log Message:
-----------
[line-clamp] line-clamp: auto cannot clamp between sibling blocks
https://bugs.webkit.org/show_bug.cgi?id=326257
<rdar://problem/189124610>
Reviewed by Antti Koivisto.
<div style="line-clamp: auto; max-height: 6lh; white-space: pre">Line 1
Line 2
Line 3
Line 4
<div style="display: flow-root">Line 5
Line 6</div><div style="display: flow-root">Line 7
Line 8</div>Line 9</div>
The content should be clamped between the two flow-roots with no block
ellipsis. The auto clamp point could only be
after a line, so the content got clamped by lines. A flow-root establishes an
independent formatting context, so its
lines do not count, and a clamp point between two sibling blocks is preceded by
no line box: no line should get the
block ellipsis there.
Now
1. 'display: flow-root' establishes an independent formatting context, and
2. when the last possible clamp point that fits is after a block of the
line-clamp container with no line box before it, content is clamped after that
block instead of after a number of lines.
In the example:
1. The line-clamp container is laid out without clamping first (max-lines is
auto).
2. The auto clamp point is computed: Lines 1-4 fit, the first flow-root fits
and has no line of this formatting context,
the second flow-root does not fit, so the clamp point is after the first
flow-root.
3. The container becomes the line-clamp root with the first flow-root as the
box to clamp after, and its content is laid
out again: no line runs out of the line-clamp budget, and once the first
flow-root is laid out the budget drops to 0,
so whatever follows it (Line 9) is after the clamp point.
* LayoutTests/TestExpectations: line-clamp-auto-039, -040, -043, -044, -046 and
line-clamp-with-abspos-023 pass now.
*
Source/WebCore/layout/integration/LayoutIntegrationFormattingContextLayout.cpp:
(WebCore::LayoutIntegration::updateRenderTreeLineClampBeforeLayout):
* Source/WebCore/rendering/LineClampUpdater.cpp:
(WebCore::LineClampUpdater::~LineClampUpdater):
(WebCore::LineClampUpdater::isAutoLineClampRoot const):
(WebCore::LineClampUpdater::setClampAfterBox):
(WebCore::LineClampUpdater::autoClampPoint const):
(WebCore::LineClampUpdater::maximumLinesForAutoClampPoint const): Deleted.
* Source/WebCore/rendering/LineClampUpdater.h:
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::establishesIndependentFormattingContext const):
(WebCore::RenderBlock::createsNewFormattingContext const):
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutInFlowChildren):
(WebCore::RenderBlockFlow::layoutBlockChildren):
* Source/WebCore/rendering/RenderLayoutState.h:
Canonical link: https://commits.webkit.org/322836@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications