Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c08be6c4e5a8edc3bd9ef1ca45be67d349847eda
https://github.com/WebKit/WebKit/commit/c08be6c4e5a8edc3bd9ef1ca45be67d349847eda
Author: Alan Baradlay <[email protected]>
Date: 2026-10-12 (Mon, 12 Oct 2026)
Changed paths:
M LayoutTests/TestExpectations
M Source/WebCore/rendering/LineClampUpdater.cpp
M Source/WebCore/rendering/LineClampUpdater.h
M Source/WebCore/rendering/RenderBlockFlow.cpp
Log Message:
-----------
[line-clamp] line-clamp: auto ignores collapsed block-end margins when
finding the clamp point
https://bugs.webkit.org/show_bug.cgi?id=327180
<rdar://problem/189767053>
Reviewed by Antti Koivisto.
<div style="line-clamp: auto; max-height: 6lh"><div style="margin: 17px">Line
1<br>Line 2<br>Line 3<br>Line 4<br>Line 5<br>Line 6</div></div>
Five lines plus the block's margins (17px + 5 * 32px + 17px) do not fit in 6lh
(192px), but the line-clamp container shows five lines.
"The auto clamp point will be set to the last possible clamp point such that,
for it and all previous possible clamp points,
the line-clamp container's automatic block size (as determined below) is not
greater than the block size the box would have
if its automatic block size were infinite."
https://drafts.csswg.org/css-overflow-4/#line-clamp-containers
The auto clamp point was computed from the unclamped geometry, either without
the block-end margins that follow the content once
it is clamped, or (for a block child) with its own uncollapsed block-end margin.
Now LineClampUpdater::autoClampPoints collects the possible clamp points up to
the last one whose content (without block-end margins)
ends within the block size limit. Block layout lays out the content clamped at
the last one, and when the line-clamp container
still ends up past the block size limit (block-end margins collapsed by block
layout), it takes the clamp point back to the previous one.
* LayoutTests/TestExpectations: line-clamp-auto-027.tentative.html and
line-clamp-auto-032.tentative.html pass now.
* Source/WebCore/rendering/LineClampUpdater.cpp:
(WebCore::contentLogicalBottom):
(WebCore::LineClampUpdater::fitsAutoClampBlockSizeLimit const):
(WebCore::LineClampUpdater::autoClampPoints const):
(WebCore::LineClampUpdater::autoClampPoint const): Deleted.
* Source/WebCore/rendering/LineClampUpdater.h:
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutInFlowChildren):
Canonical link: https://commits.webkit.org/323468@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications