[wpt-sync] Sync PR 51539 - [line-clamp] Fix bug with line-breaking ellipsis inserted in last line
Categories
(Core :: CSS Parsing and Computation, task, P4)
Tracking
()
Tracking | Status | |
---|---|---|
firefox138 | --- | fixed |
People
(Reporter: wpt-sync, Unassigned)
References
()
Details
(Whiteboard: [wptsync downstream])
Sync web-platform-tests PR 51539 into mozilla-central (this bug is closed when the sync is complete).
PR: https://github.com/web-platform-tests/wpt/pull/51539
Details from upstream follow.
Andreu Botella <abotella@igalia.com> wrote:
[line-clamp] Fix bug with line-breaking ellipsis inserted in last line
With line-clamp, if the line that would have the ellipsis happens to
be the last line in the line-clamp container, then it must not have
the ellipsis. In the spec's terms, there cannot be a region break (or
a clamp point) at the end of the container. The way this was
implemented was by laying out first with the ellipsis, and then doing
a relayout without ellipsizing if we detected that there were no lines
after it.However, this was implemented when the ellipsis simply hid content
from the line. With the line breaking ellipsis the spec requires,
which we are implementing under theCSSLineClampLineBreakingEllipsis
flag, the presence of the ellipsis can push content to the next line,
which can make a line no longer the last line.The behavior that is almost certainly expected is that in such cases,
the line would not have the ellipsis. To implement this, we detect
whether an ellipsized line would be the last line of its IFC if it
didn't have the ellipsis. We implement this in
InlineLayoutAlgorithm::DoesRemainderFitInLineWithoutEllipsis
, which
tries to compute that based on item metrics, and it returnsnullopt
to indicate that this cannot be computed withoutLineBreaker
. Then,
theLayoutResult::WouldBeLastLineIfNotForEllipsis
flag is set.In the block layout algorithm's
BlockLineClampData
, if we're
clamping by a number of lines, and we've just laid out a line box with
theWouldBeLastLineIfNotForEllipsis
, then we set a flag that will
make any further calls toBlockLineClampData::UpdateAfterLayout
ignore any further lines for the purposes of decreasing the number of
lines until clamp. This will mean that any remaining lines in the same
IFC will not be counted when determining whether we should relayout
without ellipsizing.Bug: 40336192
Change-Id: Ie28f65b02f1adcb5b7f55ac52e55d0103788ea56
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6361775
Commit-Queue: Andreu Botella \<abotella@igalia.com>
Reviewed-by: Koji Ishii \<kojii@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1436702}
Assignee | ||
Updated•5 months ago
|
Assignee | ||
Comment 1•5 months ago
|
||
Assignee | ||
Comment 2•5 months ago
|
||
CI Results
Ran 7 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI
Total 2 tests
Status Summary
Firefox
PASS
: 1
FAIL
: 1
Chrome
PASS
: 1
FAIL
: 1
Safari
FAIL
: 2
Links
Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base
Details
New Tests That Don't Pass
- /css/css-overflow/line-clamp/block-ellipsis-012.tentative.html [wpt.fyi]:
FAIL
(Chrome:FAIL
, Safari:FAIL
)
Comment 4•5 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/a25e6e1bb5ee
https://hg.mozilla.org/mozilla-central/rev/08263cd19fc5
Description
•