-
Notifications
You must be signed in to change notification settings - Fork 715
[css-flexbox] Percentage height resolution of children of flex items with indefinite flex basis #6822
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
That's not what I get in my local webkit, I get 100px instead, it's resolving against the computed This seems wrong to me, the percentage should either behave as |
That's very likely because I've landed the |
I have updated my repo to latest https://trac.webkit.org/changeset/286061/webkit, and I still get a red 100x100 square. Anyways, I'm curious what happens if you use |
That's another bug then. Anyway the dilema still stands. |
https://drafts.csswg.org/css-sizing-3/#cyclic-percentage-contribution
In this case the dependency comes from |
My understanding is that no matter what |
This section only applies when calculating min-content and max-content contributions, though, right? And min-content and max-content contributions don't affect this issue, right? |
@davidsgrogan The percentage is cyclic since the height of the containing block comes from |
I don't have strong feelings about this. I think it is in the spirit of CSS2 for the percentage height to resolve against auto to zero in this case, but I also think that authors are better served when percents resolve against something real. I'm interested in hearing from @dholbert @fantasai @aethanyc @tabatkins. If y'all think Webkit's behavior here is better, I'll change Blink to match. |
I feel the spirit of CSS2 still applies here because flexbox's main size property (
Also, Re Option 2 (WebKit) in the first comment:
Similarly, we don't want to resolve the inner
|
Fwiw, I agree with @davidsgrogan and @aethanyc's positions in the two comments above. I think it shouldn't resolve per CSS2; I can also see why we might want it to, and could be convinced otherwise if we agreed it helped authors. But generally cyclic percentage resolution is weird, and often results in overflow, so I'm not sure how helpful it is.
I think the fact that it doesn't mention flex-basis is an oversight: we didn't consider such a case hitting this clause. |
The CSS Working Group just discussed
The full IRC log of that discussion<emeyer> Topic: [css-flexbox] Percentage height resolution of children of flex items with indefinite flex basis<emeyer> github: https://github.com//issues/6822 <emeyer> dgrogan: This is also an interop issue. Chrome recently switched from WebKit to Firefox behavior, which we think is what’s specced. Sergei from Igalia has a good argument for why WebKit might be better and should be specced. <emeyer> TabAtkins: Elika says she agrees with dgrogan that we should try not to introduce new exceptions unless there’s a strong reason and we can describe it clearly. <astearns> aethanyc = Ting-Yu Lin <emeyer> dgrogan: When you have a column flexbox and the item’s flex basis is content, and a child of that item has a percent height do we resolve it in the final pass or do we make the flex item’s height indefinite? <emeyer> …The spec currently roughly says it’s indefinite. Proposal from Igalia is to make the child of an item with content flex basis resolve its height. <emeyer> Rossen: When you say this, are you talking about the measurement of item in the last pass when you would have already computed all of the contributions of flex items? <emeyer> fantasai: And the child with the percent is a block level box. <emeyer> Rossen: I’m struggling to figure out why we would resolve the percent height, and mroe importantly how, if we don’t do it anywhere else. <emeyer> dgrogan: The debate is around when do we resolve that height. Are we on the same page for that? <emeyer> dgrogan: The argument is, we already have a bunch of definiteness exceptions, so why not do another? <emeyer> Rossen: In the contribution pass, you are not resolving percentages. Which will most likely give the item a height based on its content. When you go to the last pass, if you resolve the percentage of the block child, it will probably overflow or underflow. So do we allow that overflow or underflow to satisfy the percentages? <emeyer> dgrogan: That’s a good restatement. <emeyer> …I don’t know that I can defend this. <emeyer> oriol: I haven’t been following this in detail. I also felt like WebKit is doing something different than the proposal. I don]t have a strong opinion here. <emeyer> iank_: I believe WebKit has a bug that it’s resolving during the contribution phase. So looking at its output is a little complicated for teasing out the intended result. <emeyer> …I somewhat prefer the Firefox behavior currently. It’s aligned somewhat with other behaviors. <emeyer> fremy: If you have the exact same scenario, but the page size is bigger, does that mean the thing won’t get shrunk? <emeyer> dholbert: I think it would depend on other things, and I think uinrelated to this issue. <emeyer> Rossen: It’s hard to argue about later stages if the earlier stages are inconsistent. <emeyer> …I don’t know if we have good progress here. This should maybe go back to the issue. it sounds like the current spec [carrier lost] <emeyer> astearns: It sounds like we’re converging against the original proposal? <emeyer> iank_: I think Firefox and Blink are correct as per the spec’s definition of definiteness. <emeyer> dgrogan: Correct. <dholbert> (agreed) <emeyer> astearns: Is what’s in the spec at the moment sufficient or does it need to be more clear? <emeyer> dgrogan: I think there’s a part of the contribution spec that needs to be tightened up. <emeyer> fantasai: I agree, we need to clarification in the spec. <emeyer> RESOLVED: Reject the proposed change but clarify the specification; we invite Sergio to comment further if they have objections to this resolution |
OK, we've made edits in 82b9212; @svillar @Loirooriol Please let us know if those edits seem to adequately address the issue? |
LGTM |
Uh oh!
There was an error while loading. Please reload this page.
For reference, this was filled after @davidsgrogan and me having different opinions in this chrome bug.
This is the scenario
ToT Gecko and Blink size the red
<div>
with a percentage height as 0px while WebKit computes a 30px height. That computation happens in two stepsOption 1 (Blink and Gecko)
@davidsgrogan cites the following text from the CSS2 specs
and from that concludes that red's percent height computes to
auto
because the height of its containing block (i.e. the flex item) depends on content height. So because red's percent height computes toauto
, the final height is its content height, which is 0px.Option 2 (WebKit)
In this case the engine considers that as the flex item is 30px height, then the div with the percentage height should be 30px as well.
I think the second option is the correct one for some reasons:
auto
height having a child with a percentage height (and similar ones).Anyway it's indeed controversial so I'll let more informed people to give their opinions.
PS: this affects 3 WPT tests
css/css-flexbox/percentage-heights-016.html
css/css-flexbox/percentage-heights-017.html
css/css-flexbox/percentage-heights-018.html
The text was updated successfully, but these errors were encountered: