-
Notifications
You must be signed in to change notification settings - Fork 707
[css-display] Sort out interaction of "display:contents" with font-size and line-height #1249
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
Comments
I think This would have implications like Foo and Bar becoming distinct flex items in
which I don't think is bad. |
In this testcase:
is there one run of text or two runs of text? I think you'd propose two, right? |
Yes, I think they should be two runs of texts, each one in its anonymous inline box wrapper. Otherwise different parts of the text can have different styles despite being in the same box, which doesn't seem intuitive. In my opinion, it seems more natural for CSS to solve this with anonymous boxes instead of introducing text nodes in the box tree with their own properties. |
In fact, would it have any impact if runs of text directly contained inside an element were always wrapped in anonymous inline boxes, independently on When I say 'element' I include |
Yes, this is another instance of #1118, and I think will be solved by that when I address it in the way I suggested in #1118 (comment). Namely, "text" becomes an object capable of having properties and interacting in inheritance. In bz's first example, the text inherits the "text-size: 50px" and sizes accordingly, regardless of the presence of |
Just defining text as something that has properties is not enough. You also have to change the actual algorithm of inline layout to consider the text boxes. Right now it explicitly does not, afaict. |
Just a side note, my reading of the spec to think that the line box height should be the one of the text + 2 times the half-leading was from https://www.w3.org/TR/CSS21/visudet.html#inline-box-height:
But of course that's contradictory with https://www.w3.org/TR/CSS21/visuren.html#anonymous in this case, in the case the font-size of the text should the one specified in the |
The point is, the text itself isn't a box in the CSS spec right now. It's just a paint-time effect. |
…combine. r=xidorn Instead of the parent style context itself. This also fixes bug 1360530. It's not clear what should we use in this case, it depends on the resolution in [1] and [2]. While those get resolved, this is probably ok, and gets rid of the only styleContext->GetParent() outside nsRuleNode. [1]: w3c/csswg-drafts#1249 [2]: w3c/csswg-drafts#1281 MozReview-Commit-ID: LSOgFCwQi1W Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
…combine. r=xidorn Instead of the parent style context itself. This also fixes bug 1360530. It's not clear what should we use in this case, it depends on the resolution in [1] and [2]. While those get resolved, this is probably ok, and gets rid of the only styleContext->GetParent() outside nsRuleNode. [1]: w3c/csswg-drafts#1249 [2]: w3c/csswg-drafts#1281 MozReview-Commit-ID: LSOgFCwQi1W Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
…combine. r=xidorn Instead of the parent style context itself. This also fixes bug 1360530. It's not clear what should we use in this case, it depends on the resolution in [1] and [2]. While those get resolved, this is probably ok, and gets rid of the only styleContext->GetParent() outside nsRuleNode. [1]: w3c/csswg-drafts#1249 [2]: w3c/csswg-drafts#1281 MozReview-Commit-ID: LSOgFCwQi1W Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
…combine. r=xidorn Instead of the parent style context itself. This also fixes bug 1360530. It's not clear what should we use in this case, it depends on the resolution in [1] and [2]. While those get resolved, this is probably ok, and gets rid of the only styleContext->GetParent() outside nsRuleNode. [1]: w3c/csswg-drafts#1249 [2]: w3c/csswg-drafts#1281 MozReview-Commit-ID: LSOgFCwQi1W Signed-off-by: Emilio Cobos Álvarez <emiliocrisal.io> UltraBlame original commit: 7ac1b8bcb88f5ce4f2644d195af6608d304daa6d
…combine. r=xidorn Instead of the parent style context itself. This also fixes bug 1360530. It's not clear what should we use in this case, it depends on the resolution in [1] and [2]. While those get resolved, this is probably ok, and gets rid of the only styleContext->GetParent() outside nsRuleNode. [1]: w3c/csswg-drafts#1249 [2]: w3c/csswg-drafts#1281 MozReview-Commit-ID: LSOgFCwQi1W Signed-off-by: Emilio Cobos Álvarez <emiliocrisal.io> UltraBlame original commit: 7ac1b8bcb88f5ce4f2644d195af6608d304daa6d
…combine. r=xidorn Instead of the parent style context itself. This also fixes bug 1360530. It's not clear what should we use in this case, it depends on the resolution in [1] and [2]. While those get resolved, this is probably ok, and gets rid of the only styleContext->GetParent() outside nsRuleNode. [1]: w3c/csswg-drafts#1249 [2]: w3c/csswg-drafts#1281 MozReview-Commit-ID: LSOgFCwQi1W Signed-off-by: Emilio Cobos Álvarez <emiliocrisal.io> UltraBlame original commit: 7ac1b8bcb88f5ce4f2644d195af6608d304daa6d
CSS 2.1 has an invariant that can be summarized as follows: "any piece of text is contained in an inline box whose computed values for font-size and line-height match those of the text". That's to the extent that text has computed values at all, of course.
Now consider this testcase:
What is the expected layout? In terms of the box tree, the
<span>
doesn't exist. The box tree is constructed as if "Text" were a child of the<div>
and per https://www.w3.org/TR/CSS21/visuren.html#anonymous (which nothing supersedes, afaict) there is an anonymous inline box whose computed font-size is "10px" and computed line-height is "normal".Obvious questions:
<span>
had a line-height specified, would that have any effect on anything? As far as I can tell from current spec language, no, because the text itself is not a box and hence does not participate in the line layout algorithm. What participates is the anonymous inline wrapping it, and that has a line-height that doesn't depend on the<span>
in any way.<span>
has a font-family style that differs from that of the<div>
, what font is used by the text?<span>
has a font-family style that differs from that of the<div>
, which font is used to determine the ascent/descent of the anonymous inline box? Presumably that of the<div>
, since that's what it inherits per the linked spec above. But that can be quite different from the actual ascent/descent of the text involved; seems wrong to me.Basically, it would make the most sense to me if the anonymous inline for a piece of text inherited from the parent element of the text, not from the block. Without display:contents those are the same thing, but with display:contents they're not the same at all.
Note also that this would mean that this testcase:
would need two separate anonymous inlines, whereas CSS2.1 somewhat implies that this case would only have one anonymous inline. Of course without display:contents the number of anonymous inlines wrapping a piece of text, is not observable, nor are their boundaries....
The text was updated successfully, but these errors were encountered: