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
Implement flexbox automatic min-size #12610
Comments
Gecko's reference implementation is in |
Chromium code: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp?sq=package:chromium&l=1224 ( Gecko code: http://searchfox.org/mozilla-central/source/layout/generic/nsFlexContainerFrame.cpp# |
IMO for inline mode the |
Here are my planned step to implement this (at least the inline mode):
|
Done 1 and 2. 3 is harder then I think, there are too many conditional branches in the spec, I'll start by implementing the branch that doesn't require the aspect ratio first. |
Spec bug filed: w3c/csswg-drafts#671 |
I sort out the test cases as a giant truth table:
|
@shinglyu Impressive sum up! That said, we do need some methods to handle the min-max size clamping more carefully, which currently layout does not pay much attention to(And that's the reason why I still left the On the other hand, IMHO most of the complexity of intrinsic size calculation involved with intrinsic aspect ratio goes to |
@stshine I noticed that if I specify |
@shinglyu I believe that is the desired behavior since 'content size' is what we use to avoid fall into zero length when the style does not specify the actual size. And that is why the content size of element with intrinsic ratio is so complex since is may be determined by size property in the other direction. |
One thing I found worth to mention that may be confusing when I was reviewing |
@stshine I assume you are referencing the Gecko implementation, which skips content-size calculation if it's not needed? But I wants to follow the Chromium implementation, which is more like the spec. I write some pseudo logic here, would you mind giving me some feedback? I'm also confused about the role of I'm also not quite sure how we would get the Based on your knowledge about Servo's status, which conditions in the algorithm is doable? Which is blocked by other issue? Seems like I need to land a patch that implement part of the conditions first, then follow up on other blockers. |
Oops... sorry! I have not read flexbox spec quite a while, just thought about the main size; please ignore my previous two comments. (stshine felt so embarrassed.) So I took a closer look at the To fix this, note that since elements in flex container is blockified, the only possible child types is IMO your logic is correct, but the code can be much simplified. Sorry for the confusion again. |
@shinglyu I created #14490 , which exposed the intrinsic aspect ratio info with |
I find it challenging to implement all the cases in one run. Any suggestions on how to splitting it into smaller chunks? I tried implement one of the condition at a time, but I keep regressing the reftests. |
https://drafts.csswg.org/css-flexbox/#min-size-auto
As @stshine said in #12453 :
The text was updated successfully, but these errors were encountered: