Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

block-overflow, ::first-line, and ::first letter #2906

Closed
frivoal opened this issue Jul 11, 2018 · 6 comments
Closed

block-overflow, ::first-line, and ::first letter #2906

frivoal opened this issue Jul 11, 2018 · 6 comments

Comments

@frivoal
Copy link
Collaborator

frivoal commented Jul 11, 2018

@MatsPalmgren said in #390 (comment):

Does the inserted text affect ::first-letter/::first-line in any way? (even if it doesn't, it'd be good to spell that out explicitly for clarity)

I said in #390 (comment):

If it is in the first lines (e.g. max-lines:1), then it should take the styles that affect the first line. Otherwise, we'll get weird and inconsistent typography in the first line. I believe that is already a consequence of "placed [...] as a direct child of the block container’s root inline box", but it doesn't hurt to say so if we agree (or to argue it out and then spec it if we don't).

For ::first-letter, I am less sure. I'm not what sure what the use case would be, and neither of what the implementation complexity would be. Any suggestion?

In #390 (comment), @MatsPalmgren responded:

OK, but I disagree that that follows from "placed [...] as a direct child of the block container’s root inline box". It really is necessary to point that out explicitly if that's the behavior you intended.
Please note that list-style-position:inside ::marker boxes does not affect ::first-letter/line in current implementations, fwiw.

Anyway, the problem with the ::first-* pseudos is that some UAs construct boxes for them in the box construction phase, which happens before the layout phase, so if the inserted ellipsis should be affected by these styles then it might affect boxes that were already constructed. For example, if the ellipses is so wide that it requires the entire length of the line then any existing ::first-letter/line boxes needs to be undone somehow. For ::first-letter there's also the case where leading punctuation on the line should be included together with the first character of the ellipsis. The implementation of these pseudos is already quite messy (and buggy) in Gecko and I suspect that might be the case for other UAs too. This is why I'm asking for a detailed spec about how the interaction (or not) between these boxes should work, because otherwise we'll almost certainly end up with incompatible implementations.

I would strongly prefer to keep the block-overflow property simple though, i.e. not interacting with boxes other than shortening the last line. We can introduce a more general "::fragment-before/::fragment-after" in the future, that would magically appear at fragmentation boundaries (possibly with additional conditions that an author can control). For example, it's quite common in printed newspapers to insert a "continued from page N" at the start of a fragment when it continues from an earlier page.

In #390 (comment), @fantasai said:

Wrt ::first-line and ::first-letter, I think the ellipsis should be considered part of the first line, but not the first letter pseudo. The ::first-letter pseudo behaves much more like an inline element, and the ellipsis is placed outside of any elements. Meanwhile ::first-line encompasses the entire line, it would be weird if something on it were somehow exempted.

@frivoal frivoal added the css-overflow-3 Current Work label Jul 11, 2018
@frivoal frivoal self-assigned this Jul 11, 2018
@fantasai
Copy link
Collaborator

Actually, thinking about it some more, maybe the block ellipsis shouldn't be affected by ::first-line either. Suppose the first line were text-transform: uppercase. I don't think we'd expect “More...” to be affected.

@frivoal
Copy link
Collaborator Author

frivoal commented Sep 17, 2018

@dauwhe When it comes to all caps, it does look like not including the ellipsis in the ::first-letter is better. Can you think of other cases where the answer might go the other way?

@MatsPalmgren @FremyCompany @kojiishi From an implementation point of view, would it be hard to have stuff on the first line that isn't part of ::first-line?

@kojiishi
Copy link
Contributor

From an implementation point of view, would it be hard to have stuff on the first line that isn't part of ::first-line?

Assuming we ship our new engine soon, either option works for us.

Suppose the first line were text-transform: uppercase...

Whichever style we go, not applying text-transform is fine. It's the only property that affects the text content and that needs an additional code to apply. For text-overflow: ellipsis, we use first-line style but do not apply text-transform today.

@dauwhe
Copy link
Contributor

dauwhe commented Sep 18, 2018

@dauwhe When it comes to all caps, it does look like not including the ellipsis in the ::first-letter is better. Can you think of other cases where the answer might go the other way?

That makes sense to me, and I can't immediately think of counterexamples.

@frivoal
Copy link
Collaborator Author

frivoal commented Oct 16, 2018

Agenda+F2F to confirm that ::first-line and ::first-letter styles do not affect the block ellipsis.

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed block-overflow, ::first-line, and ::first letter, and agreed to the following:

  • RESOLVED: There is no interaction between ellipsis and first-line or first-letter
The full IRC log of that discussion <astearns> topic: block-overflow, ::first-line, and ::first letter
<astearns> github: https://github.com//issues/2906
<eae> florian: If you have max-lines 1 your ellipsis stirng will be on the first line, will it be styled by the first line style? If it is long enough to extend to start will it be styled by first-letter?
<eae> RESOLVED: There is no interaction between ellipsis and first-line or first-letter
<eae> TabAtkins: When I've seen this sort of thing show up in printing it is not styled as drop caps or first line, distinct style
<eae> fremy: If you say max-lines 1 you don't need first-line in the first case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants