-
Notifications
You must be signed in to change notification settings - Fork 707
[css-display][css-flexbox][css-grid] Interaction of 'display: contents' and 'run of text' #1281
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
which I think makes it's clear that Firefox and Chrome is implementing the intent of the spec for the given example (there's only one flex item). |
OK, but since I can't find any definition of "run of text", I was not sure if it was a box-generation-and-layout thingie, or a element-tree thingie. |
Hum that's weird. They would occupy in the same grid/flex area but have two different formattings? This seems a bit contradictory but I have no strong opinion. https://jsfiddle.net/p63c5uyt/1/ |
Yes, it also seems a bit strange to me that text nodes with different styles become a single run of text. I think |
Doesn't that defeat the purpose of it? It isn't supposed to generate any boxes. I don't see how it could take any styling of its own, once it was display:contents, if it didn't have its own box. Even font-size could affect layout. If it was just text, it wouldn't have its own color either. I don't think this value is described very completely. |
I mean, it is supposed to react to some things, like 'flex' as if it was a contiguous part of its parent and taking on its parent's non-inherited property values, but react to other properties as though it still was its own element. |
@bradkemper Yes, currently |
I see no problem with text of different formatting occupiying the same flex/grid area. Single runs of text with different formatting aren't new in CSS, they occur quite often because of the font fallbacks. Can we generalize the rules of this behavior and reuse it for our case? Making element with So my suggestion is to treat 'run of text' as 'run of text nodes in a text box', or even just as 'run of differently formatted text fragments in a text box' — in the similar way as text rendered with different fonts of the font stack or bidirectional text is treated. |
@SelenIT From your description it seems you meant you want a run of text to be a run of multiple text box instead of a single text box, right? In the example from the first comment, Foo and Bar will need to be in different text boxes, because that's the mechanism which allows different styles, or that's what I understood. I'm not interested in fonts so I don't know about font fallbacks. But I'm not convinced it's exactly the same, even if some character is not supported by the font and a fallback is used, its text box will still have the same specified font. Anyways, I don't have a strong opinion, I just think some spec should clarify the meaning of 'run of text' when mixed with |
Even though I find inheriting from a box that has been removed a bit surprising, I could see it being useful. I agree with @Loirooriol. Foo and Bar in the example should be in the same run of text, and children should become siblings. |
@Loirooriol I can agree with any interpretation that would not require 'Foo' and 'Bar' in the example becoming separate flex items :). I believe that the ability to place content of different elements in the same 'run of text' (whatever that means) is one of the key advantages of I agree with @MatsPalmgren that the current implementations of Gecko and Blink match the intent of the spec. I believe that the spec should reflect this behavior and this behavior should not be changed. As I understand the comment by @bzbarsky, we already have the concept of styleable 'text', separate from 'anonymous inline box', in reality. May be we should specify it?
I didn't suggest it's exactly the same, but I see many similarities between these situations from the rendering perspective. Different characters in the same run of text already can have different actual values of |
…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>
I agree in general: "Foo" and "Bar" should be in a single flex item, because there's no inline box to get blockified into a flex item in the first place! When #1118 is fixed, the layout algos will have a properly defined concept of "text" which we'll fix up flexbox and others to reference (probably we'll define the term "text run", meaning a maximal contiguous sequence of sibling texts in the box tree, and use that in most places). |
Okay, we've proposed a diff in #1118 (comment) that resolves this issue. Let us know if there's something not accounted for. (It supports the "Foo and Bar wind up in a single flex item" interpretation.) |
I've committed the diff, so closing this issue as solved. |
…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
Various specifications use the term 'run of text'. For example, CSS Flexbox and CSS Grid:
But as far as I know, this term is not defined anywhere. So I don't know how it should interact with
display: contents
. For example, https://jsfiddle.net/p63c5uyt/Should Bar appear next to or below Foo?
Both Firefox and Chrome consider that
display: contents
makes both Foo and Bar to be in the same run of text. This is not obvious to me.Tab wants (#1118 (comment))
not sure if this has any impact, given that Foo and Bar are different text nodes in the DOM.
The text was updated successfully, but these errors were encountered: