Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
[css-display][css-ruby][css-contain] Becoming a formatting context #1457
Comments
frivoal
added
the
css-display-3
label
May 24, 2017
|
This note also needs to be fixed:
Maybe it would be better to say that inline (and ruby?) are pseudo-formatting contexts or some thing different than "real" formatting contexts. |
frivoal
assigned
frivoal,
tabatkins and
fantasai
May 24, 2017
Loirooriol
referenced this issue
Jun 2, 2017
Open
[css-display] Make 'flow-root' an independent keyword #1496
fantasai
added
the
css-contain-1
label
Jul 5, 2017
tabatkins
referenced this issue
Jul 5, 2017
Closed
[css-contain] `contain` should not affect `display` #1581
|
Wow, I didn't even notice this section being added. The whole thing makes no sense. For example, it's saying that Imho, either this needs a proper definition that makes sense, is appropriate to the issues in paint containment, and doesn't conflict with the rest of CSS, or Origin of section: https://github.com/w3c/csswg-drafts/pull/831/files |
As Tab commented in #1581 (comment)
I agree, this exception should be called out.
Ok, that was the wrong way to go about it. Would there be a problem with simply moving this fix-up to computed value time?
I don't think it is saying that:
That said, as @Loirooriol pointed out, this may be insufficient, and we may need to come up with something better. That said, maybe this should be excluded from css-contain? css-contain already layout and paint containment do not take effect on internal table elements. Maybe ruby elements should be excluded as well? I have a bit of a hard time thinking of legitimate use cases of containment on ruby or ruby parts.
For internal table parts, neither css-contain nor css-multicol invoke "becomes a formatting context". For ruby internal parts, multicol does not, and (as discussed above) maybe contain shouldn't either. This doesn't mean that we don't need to define what this does, but there is no particular expectation from the current places that invoke this. |
added a commit
to frivoal/csswg-drafts
that referenced
this issue
Jul 7, 2017
frivoal
referenced this issue
Jul 7, 2017
Open
[css-multicol] Revert part of a change about formatting contexts #1588
|
In #1496 there are some ideas about how to treat a ruby that becomes a formatting context. Probably the independent I think it makes sense to exclude |
fantasai
added
the
Agenda+ F2F
label
Jul 11, 2017
|
Another thing: I initially described this as used value time on the display property, which was wrong because there isn't really such a thing, but the intent behind this attempt was:
Regardless of what we do, I do not think that we should affect the computed value of the display property, as that would introduce a behavior change through inheritance. I don't expect that the following code is particularly common, but there's no reason to introduce a breaking change if we can avoid it:
This should not result in the nested div having a display flow-root. Maybe we can just change this to "has the same effect as". |
|
I think the approach proposed in #1550 by @Loirooriol is likely to solve this issue as well. |
Loirooriol
referenced this issue
Jul 19, 2017
Open
[css-display][css-inline] Block containers should never establish an inline formatting context #1617
astearns
removed
the
Agenda+ F2F
label
Aug 1, 2017
css-meeting-bot
commented
Aug 3, 2017
|
The CSS Working Group just discussed
The full IRC log of that discussion<fantasai> Topic: Becoming a formatting context<astearns> github: https://github.com/w3c/csswg-drafts/issues/1457 <fantasai> TabAtkins: big issue is 'contain' property <fantasai> TabAtkins: which requires element to establish a formatting context <fantasai> TabAtkins: But it's not meaningful, can't just say it establish a formatting context out of the blue, e.g. an 'inline' can <fantasai> TabAtkins: can't establish a formatting context <fantasai> TabAtkins: could say that it turns into an inline-block, tho <fantasai> TabAtkins: But can't do that to Ruby <fantasai> TabAtkins: So what should we do here? <fantasai> TabAtkins: Most cases it's a no-op, grid/table/etc is a no-op <fantasai> TabAtkins: block has an easy answer: switch to flow-root <fantasai> TabAtkins: inline has an easy answer: switch to inline-block <fantasai> TabAtkins: ruby is the only one that has a difficult issue <fantasai> Florian: In other cases, we haven't had a problem with this <fantasai> Florian: e.g. 'overflow' doesn't apply to inline/ruby, so don't have to worry about these cases <fantasai> Florian: similarly column-span only applies to block-level elements, so no problem there <fantasai> Florian: The only case where we have a problem is 'contain' <fantasai> Florian: which needed to apply to 'inline' and 'ruby' <fantasai> Florian: So we need to establish terminology, and oriol's suggestion works for this <nainar> fantasai: ruby cant block <astearns> s/cant/can/ <nainar> fantasai: ruby spec defines block ruby. AYOu cant turn into a inline block ruby which is what you were trying to say <fantasai> Florian: The alternative is to not add terminology for this, and just say that these things blockify and th <fantasai> (shift that up) <fantasai> Florian: Might be worth leaving existing places the way they are <fantasai> Florian: and have 'contain' blockify, and the rest is obvious <fantasai> Florian: If there's an easy way to define this, then we should, and then call into it ffrom all these places <fantasai> Florian: Oriol's suggestion solves this case <fantasai> TabAtkins: So what should we do for ruby <nainar> fantasai: two solutions here. third one is what you were trying to do - ruby makes an inline block ruby thing. No use case - not a good idea <nainar> fantasai: second thing we could do - florian mentioned to blocify ruby and the inline. That is inconsitent with inline block. They get to stay as inline-blocks <nainar> fantasai: weird to have ruby turn into a block element <nainar> fantasai: you could turn all inline level things into block level things <nainar> fantasai: last thing, this aspect of contain doesnt apply to inline/ruby - the author should change it into a block first. Author then chooses to make the display transformation <fantasai> TabAtkins: No reason not to apply contain to inline-block <fantasai> TabAtkins: you mentioned block ruby <nainar> fantasai: confirms that if you specify display block ruby you get a block with ruby inside it <fantasai> fremy: ruby does special alignment things <fantasai> Florian, fantasai: it's not different from iline <fantasai> inline <fantasai> TabAtkins: Can we make block ruby a BFC? <fantasai> TabAtkins: Only thing is that if you have a float, it won't intrude the way it does for regular blocks <fantasai> Rossen: No reason to have inline layout of ruby be different from regular inline layout <nainar> fantasai: why not go with the last option? <fantasai> TabAtkins: ... <nainar> fantasai: to apply to neither inline/ruby - you the author must turn it into an inline-block or block (preferred) <fantasai> TabAtkins: Ok, I'm down with that <fantasai> s/preferred/depending on the author's preference/ <fantasai> dbaron: Issue is that contain is that authors won't know what effects to get <fantasai> TabAtkins: Then it's a no-op, they're putting it there for trash reasons <fantasai> fremy: They're not getting worse performance <fantasai> ... <fantasai> dbaron: Elements nested inside each other, and accidentally stuck property on inline instead of the inline-block <fantasai> fremy: dom inspector can show that it doesn't apply <fantasai> astearns: What if they applied it to a box that was block, and then changed it to an inline and now they lose the perf benefits <nainar> fantasai: keep in mind that if you had a contain on there - when you turned it into an inline you would not get the layout you expected. <nainar> fantasai: if we didnt ignore it we would be forcing it into an inline then <fantasai> fremy: Your question is like someone getting perf benefit from ? and then turning it off and wondering why benefit is gone... <fantasai> astearns: I like the fact that 'contain' doesn't have the blockification transformation <fantasai> TabAtkins: That would be a significant layout change, whereas for other things its relatively minor <fantasai> Florian: After understandign it, you used oriol's terminology, so regardless of whether we become an FC, i would support adopting oriol's terminology <fantasai> Florian: It seems to me that we are getting closer to fantasai's position, which is to not define the idea of becoming an FC, and for all the situations except contain that may have been ambiguous it was good enough <fantasai> Florian: and for contain we will eliminate the problematic situations so that it is also good enough <fantasai> TabAtkins: First resolution is for 1457, which is "what does it mean to become a formatting context" <fantasai> TabAtkins: resolution is that blocks become flow roots, inlines and rubies can't establish a formatting context, and so any property that tries ot nvoke this must exclude them somehow <fantasai> TabAtkins: so we will change 'contain' accordingly <fantasai> astearns: dbaron? <fantasai> dbaron: I think ppl often have a bunch of nested elements and the display types are pretty random, and that usually just work <fantasai> TabAtkins: Kinda, until people are like "why is there a 2px gap below this thing?" and it's because they have an inline-block instead of a block <fantasai> TabAtkins: You have to learn that <fantasai> Florian: Or fix it with margin-bottom: -2px :D <fantasai> T_T <fantasai> dbaron: If they have a baseline, won't have that problem tho <fantasai> dbaron: only if they fail to have a baseline <fantasai> astearns: So we could resolve on what Tab said, or resolve part of it <Loirooriol> Hi CSSWG, what about 'block ruby'? The block container could establish a BFC. <fantasai> astearns actually just asked that question to dbaron, didn't get a chance to type it yet :) <fantasai> 2nd question was also asked earlier, no answer yet <fantasai> dbaron: I'm okay with resolving but kinda concerned about making 'contain' even more random <fantasai> dbaron: I think one thing that is hard about web dev is that it's hard to understand perf effects of things <fantasai> dbaron: Part of why contain is useful is it provides a way to make them more predictable <fantasai> dbaron: by forcing various types of isolation <TabAtkins> Loirooriol, It would be rather unfortunate if it was impossible to have block-ruby flow around a float; there's no reason to restrict that. <fremy> q+ <fantasai> dbaron: If you make contain less reliable, then you're back to unreliable <fantasai> fremy: I have a solution <astearns> ack fremy <fantasai> fremy: display: none <fantasai> fremy: then author will find out it's a problem <fantasai> fantasai: we don't do dataloss by default <fantasai> s/solution/solution but no one will like it/ <fantasai> Florian: Do we also need to stop confusing formatting contexts and formatting contexts? <fantasai> TabAtkins: not directly relevant <Loirooriol> Tabatkins, I meant only when 'contain' needs a formatting context <TabAtkins> Loirooriol, then there's no way to create a block-ruby FC without side-effects. :( <fantasai> s/without/without using/ ? :) <fantasai> TabAtkins: Thinking to leave 'contain' issue undef for now <fantasai> TabAtkins: or figure out something for ruby <fantasai> TabAtkins: or say that contain doesn't apply to inline ruby <fantasai> TabAtkins: which do you like best? <fantasai> dbaron: I guess I don't feel that strongly <astearns> s/inline ruby/inline and ruby/ <fantasai> dbaron: I think you could say they become inline flow root or ... <nainar> fantasai: I think we imply ... the container <nainar> fantasai: I think if you turn display:ruby into flow-root you will.. Ruby does the same thing as table. <nainar> fantasai: set display:flow-root on a ruby element you will get a block ruby BFC - all boxes in ruby will generate correctly. <nainar> TabAtkins: you get a contained block and all the perf benefits there <nainar> fantasai: you have sideeffects like we turn of inlinification <fremy> s/of/off <nainar> fantasai: you have block boxes inside a ruby container they inlineify. They wont anymore <nainar> fantasai: there will be some differences in behaviour. <nainar> fantasai: it woudl break the case of not using rb elements to wrap bases? <nainar> fantasai: because parent is no longer ruby container <nainar> fantasai: scooping algo would ... <fantasai> s/.../not scoop up ruby bases that aren't in explicit elements/ <fantasai> TabAtkins: Then let's go ahead and do Loirooriol's thing of having "used value of flow-root" terminology for all of our BFCs <fantasai> astearns: Any resolution for becoming a formatting context? <fantasai> TabAtkins: not yet <fantasai> astearns: proposed resolution to take Oriol's proposal in 1550 <fantasai> TabAtkins: This is just an editorial change <fantasai> RESOLVE: Accept 1550 <fantasai> s/RESOLVE/RESOLVED/ <fantasai> fantasai: Could say that the "becoming a formatting context" section is css-contain's problem, remove it from css-display <fantasai> TabAtkins: yeah, since it's no longer affecting anythng other than contain <fantasai> TabAtkins: so let's move to 'contain' spec, mark ruby and stuff as open issues <fantasai> RESOLVED: Move "becoming a formatting context" section back to css-contain, mark ruby/inline as open issues to figure out |
|
I'm confused, if in #1550 you approved that |
|
possibly, but we haven't figured out what to do with ruby yet, and don't want to block the display spec on something that only matters for css-contain. Once we figure it out, it is possible it will make its way back to the display spec. |
|
But after #1550 I don't think this is only a css-contain problem. Now if Now I'm more convinced that this should be explained by adding a new inner display type: This should all be CSS Display things, then in CSS Contain you can decide whether |
|
That might end up being how we solve it, yes, but in the meantime we don't need to worry about it, because aside from Contain, every instance of something becoming a formatting context also blockifies it. |
added a commit
that referenced
this issue
Sep 22, 2017
|
The above resolution (moving the definion back to css-contain and noting an issue about ruby) is done. We still need to resolve that issue. |
frivoal
added
the
Agenda+ F2F
label
Nov 3, 2017
astearns
removed
the
Agenda+ F2F
label
Nov 6, 2017
css-meeting-bot
commented
Nov 7, 2017
|
The Working Group just discussed The full IRC log of that discussion<fantasai> Topic: becoming a formatting context root<astearns> github: https://github.com/w3c/csswg-drafts/issues/1457 <fantasai> TabAtkins: we addressed this a bit in the past, text we had was bad <fantasai> TabAtkins: layout containment needs a formatting context root <fantasai> TabAtkins: wanted to say that the element ends up being an FC root somehow <fantasai> TabAtkins: only a few places where that's difficult <fantasai> TabAtkins: Some are easy <fantasai> TabAtkins: flow root, table, flex, grid, all satisfy condition <fantasai> TabAtkins: for display: flow, becomes flow-root <fantasai> TabAtkins: Next issue is with ruby <fantasai> TabAtkins: ruby is effectively inline element <fantasai> TabAtkins: wanted to create a ruby inline block thing <fantasai> florian: we don't have that yet. If it's not useful, do we really want to add it? <fantasai> TabAtkins: Better to fill the boxes, so this is consistent and defined <fantasai> fantasai: How about saying layout containment doesn't apply to inlines. If you want it to apply, turn it into an inline block <fantasai> Xidorn: create a wrapper box? <fantasai> TabAtkins: wrapper boxes are scary and bad <fantasai> fantasai: We have block ruby, it just creates a wrapper <fantasai> TabAtkins: Make something block-like, either inline-block or block or somehting <fantasai> fantasai: For most of these layout modes, the FCR-ification doesn't have much effect. Layout is fundamentally the same <fantasai> fantasai: but for inlines and ruby, it's a very significant change to layout <fantasai> fantasai: I'd rather say that layout containment just doesn't apply here, so the author is making an explicit decision about the layout change they're getting <fantasai> TabAtkins: My two constraints for this problem is that contain should work on ruby because it works on inline, and that whatever effect it has should be possible to get without using 'contain' for its side-effect <fantasai> florian: Suggestion is to apply contain to neither inline nor ruby <fantasai> fantasai: that is my suggestion, yes <fantasai> astearns: We don't have contain and inline ruby <fantasai> astearns: is there a use case for contain on inlines? <fantasai> fantasai: You can't get that. It turns into inline-block <fantasai> astearns: So if we do this, what do we lose? <fantasai> TabAtkins: Just that authors have to take an extra step of declaring inline-block <fantasai> fantasai: I'm arguing that's a feature, not a bug <astearns> s/if we do this/if we choose not to apply contain to inlines/ <fantasai> fantasai: If the author wants to have an inline block, should be explicit about it. if they didn't, then they're not going to be happy anyway <fantasai> TabAtkins: internal table elements? <fantasai> florian: We already resolved they don't apply |
|
My preference here would be to say that layout containment doesn't apply to inlines or ruby, just like it doesn't apply to internal table elements. Turning blocks into BFCs is straightforward, a lot of other CSS properties do it as a side-effect, and it doesn't change layout much. But turning an inline into inline-block or ruby into inline-block-ruby-thing would make a major difference to the layout, and I think that if the author wants that they should be requesting it explicitly. Making it a side effect of a perf tweak doesn't make much sense to me. |
|
OK, but note that For example, Additionally, someone may use I agree wrapper boxes are not much desirable, but since there already is |
Loirooriol commentedMay 23, 2017
I see various problems with the Becoming a formatting context section.
"See" should be lowercase.
Situations that CSS2.1 said produced a block formatting context when in fact they only needed to become a formatting context should be listed here. This includes out-of-flow boxes, and boxes to which
overflowapplies and is different thanvisible. Maybe also mention block containers that are not block boxes.Except for inline formatting contexts! Inline formatting contexts are not contained at all, they are e.g. affected by floats, so
contain: layoutis not satisfied by a block container that establishes an inline formatting context, it must establish a block formatting context instead.And what about ruby formatting contexts? I know very little about them, but I don't think establishing a ruby formatting context is enough neither.
I propose:
flow-root,table,flexorgrid, the condition is satisfied.flow, it is changed toflow-root.rubyinner display type always (not just if the outer display type is different thaninline) generates two boxes: a principal box with the inner display type set toflowand the outer display type set to the outer display type of the element, and an inline-level ruby container. "Becoming a formatting context" only affects the principal box, changing its inner display type toflow-root.