Skip to content

[css-overflow] Behavior of the line-clamp ellipsis after hanging glyphs #12857

@andreubotella

Description

@andreubotella

This is a follow-up issue split from #12008.

The line-clamp ellipsis gets inserted in the line after the last soft wrap opportunity that still allows the line with the ellipsis to not overflow. In #12008 we resolved that the rendering should be as if the line broke at that soft wrap opportunity, which includes applying phase II of the whitespace processing rules, and then the ellipsis was inserted at the end.

However, if a line ends with non-collapsible whitespace, phase II of the whitespace processing rules can require it to hang. Hanging glyphs are ignored when measuring a line's contents for fit, alignment or justification, so they can literally hang off the edge of the line even if there are line breaking opportunities before them.

One important point is that only sequences of glyphs at the start or end of a line can hang. So if phase II results in a sequence of hanging whitespace at the end of the line, inserting a non-hanging ellipsis after them would necessarily make the whitespace non-hanging.

Some ways to solve this could be:

  • The ellipsis prevents any glyph sequence before it from hanging.
  • Hanging whitespace before the ellipsis get removed instead. (How does this apply to conditionally hanging whitespace? What about hanging-punctuation?)
  • If the ellipsis follows at least one hanging glyph, then the ellipsis hangs as well. This would work similarly to hanging-punctuation, which also allows hanging non-whitespace glyphs. (Should this also apply to user-provided ellipsis strings? Also, currently only WebKit ships hanging-punctuation, although Chromium sent an Intent to Prototype a few months ago.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    css-overflow-4topic: line-clampline-clamp, -webkit-line-clamp, and related long hands, not including continue:discard

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions