-webkit-line-clamp not working on Play Store pages
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox106 | --- | fixed |
People
(Reporter: twisniewski, Assigned: emilio)
References
(Blocks 1 open bug, )
Details
Attachments
(4 files)
Unlike in webkit/blink, the -webkit-line-clamp:6
on the app description text at the Play Store is not working, leading to strange overlapping text and other layout quirks. I'm not sure why this is the case. I wonder if this is related to https://bugzilla.mozilla.org/show_bug.cgi?id=1720119, but I'm not sure.
Reporter | ||
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
Can you elaborate? I see the same behavior in WebKit, for the record. So this is a difference with Blink, but not with WebKit, afaict.
Assignee | ||
Comment 2•2 years ago
|
||
Afaict this is expected from our current -webkit-line-clamp
implementation, which matches what WebKit and Blink implemented at the time, at least.
Basically, we clamp each flex item individually. Since there's no wrapper block across all the description text, that's clamping each text-node individually, causing the weird effect.
Wrapping all the contents of class="clamp"
in a single flex item works.
Assignee | ||
Comment 3•2 years ago
|
||
It seems Blink now special-cases "old flex box with line-clamp" and just creates a single block: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/layout/layout_object.cc;l=356;drc=312b74e385e6aba98ab31fd911238c0dc16b396c
Which explains this difference.
Assignee | ||
Comment 4•2 years ago
|
||
No behavior change, but simplifies the following patch.
Updated•2 years ago
|
Assignee | ||
Comment 5•2 years ago
|
||
This is a hack, similar to Chromium's (comment 2) except at computed-value
rather than used-value time, because it's both simpler to reason about and
prevents lying in the computed style.
This fixes the relevant test-case, and matches closer what Chromium does. I
need to update some tests so take it as a request-for-feedback for now.
Depends on D155180
Assignee | ||
Comment 6•2 years ago
|
||
It's always true, so remove it. Add another pref to allow -webkit-line-clamp to
work on all blocks rather than just legacy -webkit-boxes, which seems something
we should try to look into, eventually.
Depends on D155181
Reporter | ||
Comment 7•2 years ago
|
||
Ah, I didn't realize that the webkit behavior differed here, actually. I should have checked that, thanks for finding out what happened. This seems like something we should let Apple know about as well.
Reporter | ||
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 8•2 years ago
|
||
FYI Karl, since Safari behaves like (current) Firefox.
Comment 9•2 years ago
|
||
Thanks Emilio, Opened https://bugs.webkit.org/show_bug.cgi?id=244286
The commit for when it was added to blink is:
https://github.com/chromium/chromium/commit/383112a
unfortunately there is no associated bug number.
Comment 10•2 years ago
|
||
Hey Emilio - yeah we actually did this work in response to Firefox implementing the -webkit-line-clamp behaviour. We did this to match the spec for line-clamp (https://drafts.csswg.org/css-overflow-3/#line-clamp) so that we could transparently switch over our -webkit-line-clamp implementation when we implement the more complex line-clamp behaviour. We discussed our intentions with various folks (I think heycam from FF at the time).
This work also had the side-effect of matching Firefox for more complex cases like:
https://www.software.hixie.ch/utilities/js/live-dom-viewer/?saved=10632
(effectively the -webkit-line-clamp "counts" within the formatting-context, and doesn't descent into new formatting contexts).
The previous behaviour was slightly bananas and doesn't really match developer expectations, e.g. https://twitter.com/davatron5000/status/1428751058822647810
We didn't find anyone relying on "flex" behaviours (e.g. flexing behaviour, alignment, etc).
There will be about ~3 WPT tests that will need to be updated.
Let me know if you have any questions.
Ian
Updated•2 years ago
|
Comment 11•2 years ago
|
||
Assignee | ||
Updated•2 years ago
|
Comment 12•2 years ago
|
||
Reporter | ||
Updated•2 years ago
|
Comment 13•2 years ago
|
||
bugherder |
Updated•2 years ago
|
Comment 14•2 years ago
|
||
Comment 16•2 years ago
|
||
bugherder |
Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Description
•