Closed Bug 2042986 Opened 3 months ago Closed 1 month ago

Implement parsing of `line-clamp` as a longhand

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement
Points:
1

Tracking

()

RESOLVED FIXED
154 Branch
Tracking Status
firefox154 --- fixed

People

(Reporter: dshin, Assigned: kyoety)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete, Whiteboard: css-line-clamp, [wptsync upstream])

Attachments

(1 file, 1 obsolete file)

... For phase 1 implementation, it will be a longhand.
Parsing this should be gated behind a pref.

Assignee: nobody → kye

Extend existing line-clamp value to store max-lines, block-ellipsis, and
legacy behavior.

Enable line-clamp parsing for WPTs with updated expectations and
regenerate CSS use-counter metrics.

Attachment #9598468 - Attachment is obsolete: true
Points: --- → 1
Whiteboard: css-line-clamp
Pushed by dshin@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/dc7f1346c1e9 https://hg.mozilla.org/integration/autoland/rev/1e46f2442987 Add pref-gated parsing for line-clamp longhand. r=dshin,firefox-style-system-reviewers,layout-reviewers,emilio

Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/61271 for changes under testing/web-platform/tests

Whiteboard: css-line-clamp → css-line-clamp, [wptsync upstream]
Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 154 Branch

Upstream PR merged by moz-wptsync-bot

Keywords: dev-doc-needed
QA Whiteboard: [qa-triage-done-c155/b154]

This should have been named:

Implement parsing of line-clamp as a shorthand

right?
As it is a shorthand for:

  • max-lines
  • block-ellipsis
  • legacy behavior

(In reply to Dave Letorey from comment #7)

This should have been named:

Implement parsing of line-clamp as a shorthand

right?
As it is a shorthand for:

  • max-lines
  • block-ellipsis
  • legacy behavior

My bad, I should have read the description

I have been doing some testing in the following browsers:

  • Firefox Nightly 155 - layout.css.line-clamp.enabled - true
  • Chrome Canary 153 - Experimental Web Platform features enabled
  • Safari Technical Preview Release 245

All these browsers support:

.selector {
  line-clamp: 2; /* <integer> only */
}

Only Chrome Canary supports no-ellipsis value:

.selector {
  line-clamp: 2 no-ellipsis; /* <integer> and no-ellipsis */
}

Only Safari TP supports "custom string":

.selector {
  line-clamp: 2 "… custom string"; /* <integer> and "custom string" */
}

Both Chrome & Safari respect the @supports but Firefox Nightly does not:

@supports not (line-clamp: 2 no-ellipsis) {
  .card:has(.no-ellipsis) .supported {
    display: block;
  }
}
@supports not (line-clamp: 2 "string") {
  .card:has(.string) .supported {
    display: block;
  }
}
Flags: needinfo?(kye)

Ah, ellipsis-related values are tracked in Bug 2043000.

That said, overall, the feature isn't yet ready for general testing (Hence being behind the pref). @supports is hooked up to the parsing machinery, and we can't really guarantee its correctness for behind-the-pref features. Still, thanks for the interest & testing it out.

When we do reach a point more suitable for general testing, we will be flipping the pref on for Nightly. That will be a blocking bug for Bug 1540681.

Related Pull Requests

Flags: needinfo?(kye)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: