- From: Florian Rivoal via GitHub <sysbot+gh@w3.org>
- Date: Mon, 04 Nov 2024 08:18:47 +0000
- To: public-css-archive@w3.org
@bfgeek, @andreubotella: I think the discussions we had at TPAC were converging towards the idea that: 1. First you do layout normally. 2. Then, regardless of whether it's based on a line count or a height, you pick your clamp point. (if the content is short enough that there's no clamp, stop here) 3. Then you insert your ellipsis in the last line. 4. then if `text-wrap-style` is `balance`, you re-run balancing on the lines before the clamp point, with the added constraint (if your original algo didn't have that) that it cannot change the number of lines nor grow the height. Importantly, even if you're clamping based on a height, you *do not* then re-run the selection of the clamp point after step 3 nor 4 to account for the fact that displacing content to insert the ellipsis or the rebalancing might have made the height shrink. Taking `text-wrap-style` into account at step 1 is important because: * when `text-wrap-style` is `pretty`, if you end up showing more/less lines (due to resizing, animations, transitions…), you want the whole thing to be largely stable and not have the already viewable lines re-giggle when you uncover more. (this is also why you don't re-run wrapping on the visible lines at step 4 if `text-wrap-style` is `pretty`). * there's a chance your line count or height is big enough that you don't end up actually clamping, and you don't want to need to run layout again to balance/prettify after all when you find that out. As for step 4, this is because if you have `text-wrap-style: balance`, and the lines you keep aren't balanced, that doesn't satisfy author intent (and IIRC there are chrome bugs report to prove it). And not only is there a chance that maybe you can balance the visible lines a little bit better if you don't take into account the hidden ones, even more importantly, the ellipsis may be a very different length than the content it displaces, if if you don't re-balance after that, it may look really out of whack. In terms of "the added constraint", we could relax it a bit saying that if you picked your clamp point based on a number of lines, then re-balancing cannot change the line count (but it could change the height), and if you picked it based on a height, then it cannot grow the height (but could change the number of lines) -- GitHub Notification of comment by frivoal Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10827#issuecomment-2454066089 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Monday, 4 November 2024 08:18:47 UTC