[line-clamp] Always clamp immediately after a line box #48482
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In our initial implementation of
line-clamp: auto
, we allowedclamping after lineless boxes, in order to better match the behavior
of
line-clamp
as it follows from the spec'scontinue: discard
model, even though our implementation uses a different model which is
not yet in the specification (see
w3c/csswg-drafts#7708).
However, in hallway conversations in TPAC 2024, we agreed that it
would be better for this model to instead only allow clamping
immediately after a line. If the first line does not fit, we calmp at
the first line even if that overflows the clamp height. If there are
no lines, we do not clamp. This patch implements this.
Additionally, a previous patch (https://crrev.com/c/5868971) had
increased the memory size of
LineClampData
from 8 to 20 bytes,causing a memory regression. This patch shrinks it to 12 bytes, since
LineClampData
no longer needs to keep track of how many block boxesthere are between the last line and the clmap point, and now OOFs
after the clamped line behave the same when clamping by a number of
lines or by a height, so there is no need for a flag to distinguish
these behaviors. This patch also adds a size assertion for
LineClampData
.This patch also changes or removes some WPT tests that were written
assuming the previous behavior.
Bug: 40336192, 368114054
Change-Id: I8c8afebb5dc566de92112cee2fcf24a2e60b42c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5904459
Reviewed-by: Ian Kilpatrick <[email protected]>
Commit-Queue: Andreu Botella <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1364495}