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

[css-inline][css-pseudo] Interaction of root inline box and ::first-line #1384

Closed
Loirooriol opened this issue May 16, 2017 · 7 comments
Closed

Comments

@Loirooriol
Copy link
Contributor

CSS Inline defines the root inline box as

The root inline box is an anonymous inline box which is automatically generated to hold all of the inline-level contents of a block container (if it has any).

CSS Pseudo-elements defines ::first-line as

The ::first-line pseudo-element’s generated box behaves similar to that of an inline-level element, but with certain restrictions.

A user agent must act as if the fictional start tags of a ::first-line pseudo-element were nested just inside the innermost enclosing block-level element.

So ::first-line is a restricted inline-level, and inline-levels are wrapped inside the root inline box, which is inline, and inline-level fragments in the first line are wrapped inside the ::first-line.

Which one is inside of which one?

@dbaron
Copy link
Member

dbaron commented May 16, 2017

I think the root inline box should interact with ::first-line the same way any other inline boxes interact with ::first-line. I'm not sure we actually agree on what that is, though...

@Loirooriol
Copy link
Contributor Author

So the root inline box should be broken, and the fragment in the first line be wrapped inside ::first-line?

I read your Inline Box Model proposal, which says that each line has its own root inline box. And Hixie's proposal further specifies that it's that root inline box in the first line what is matched by ::first-line.

I think this made sense, but it seems currently there is a single root inline box in the block container instead of one per line. Maybe ::first-line could be the fragment in the first line of the root inline box.

@fantasai
Copy link
Collaborator

@Loirooriol What question are you trying to answer, other than the obvious theoretical one?

@Loirooriol
Copy link
Contributor Author

A practical implication would be #2282

@frivoal
Copy link
Collaborator

frivoal commented Dec 31, 2021

So I think that based on #2282, we've eliminated the possibility of ::first-line being inside the root inline.

As for the remaining possibilities, I cannot think of a case where that would make a difference, but from a mental model point of view, I think I quite like defining ::first-line to be the fragment of the root inline box , rather than wrapping it. It's easier to keep track of fewer boxes, and avoids the need to worry about "Which one is inside of which one?".

@Loirooriol
Copy link
Contributor Author

I don't think we can do that, because there can be multiple ::first-line (each one originated by a different ancestor).

https://drafts.csswg.org/css-pseudo-4/#first-text-line

When a first formatted line is represented by multiple ::first-line pseudo-elements, they are nested in the same order as their originating elements.

@css-meeting-bot
Copy link
Member

The CSS Working Group just discussed [css-inline][css-pseudo] Interaction of root inline box and ::first-line, and agreed to the following:

  • RESOLVED: root inline box is inside all the first line pseudo elements
The full IRC log of that discussion <dael> Topic: [css-inline][css-pseudo] Interaction of root inline box and ::first-line
<dael> github: https://github.com//issues/1384
<dael> oriol: I can explain unless florian prefers
<dael> oriol: The idea is that in css 2 we had concept of the strat that forced the line height to be at least the value of the line height in block container
<dael> oriol: Replaced with root inline box, but not clear how that interacts with first line. root inline is anon inline box that contains inline level contents in first line.
<dael> oriol: The first line is behaving as an inline lievel is it inside the root inline box? Inside the first line pseudo?
<dael> oriol: This was more theoretical but had practical implication we resolved in issue 2282
<dael> oriol: There resolved in first line pseudo element you can set line height to a value smaller than in block. this should reduce it.
<dael> oriol: Implication of this is that first-line pseudo element cannot be inside root inline box. Has to be the opposite
<dael> oriol: Then florian proposed that what we could do is unify the boxes and say first-line pseudo is exactly the frag of the root inline box in the first line. Don't think this works b/c can have multiple first line pseudo elements
<dael> oriol: At most what we could do is innermost is the frag of the root inline box. Otherwise we do need nesting
<dael> oriol: Only possibility we have is that the fragment of the root inline box is inside the innermost or it's equal to innermost
<Rossen_> q?
<dael> florian: Makes sense. Prop because seemed simplier but you have a case where makes a difference. Given that we're left with one possibility and go with that
<dael> fantasai: Prop: root inline box is inside all the first line pseudo elements
<dael> oriol: Yeah
<dael> Rossen_: Other opinions?
<dael> Rossen_: Obj?
<dael> RESOLVED: root inline box is inside all the first line pseudo elements

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

6 participants