-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[RFC] adding height to the measure function #154
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
Conversation
|
This sounds good to me. If you port the changes to C and Java I'll gladly merge the pull request :) |
36f00a2 to
0020fe0
Compare
|
I've fixed all three C, java and C# flavors and their tests, each of them is in a sperate commit. There are two more things (not directly related to adding the width) I've added:
I'm not sure why, but they seem to be run by Travis. ¯_(ツ)_/¯ I can submit both of these improvements as a separate PRs if you wish. |
|
@majak What probably happened is that I could reproduce this on CentOS7. There are two packages, |
|
@pragmatrix You are right. I have |
|
@majak No need to, these new Assert methods are supported by NUnit 2.6 and your branch compiles in Visual Studio 2015 just fine, nice work! |
|
This is looking good overall, thanks! I'd be more confident about these changes if it contained a more thorough set of unit tests. |
d9021fd to
d5f9134
Compare
|
@lucasr I've did changes you asked for. There is a commit for each of them, but I also had to fix issues in existing commits' titles, so I had to force push and all of your inlines are gone... |
|
ping :) |
|
Looks good to me! @vjeux any objections? Otherwise we can merge this. (Personally, I'd prefer all these commits to be merged into a single atomic change before merging.) |
|
lgtm |
This diff: * adds height as another parameter passed to the measure function, computed the same way width is * adds tests for this extension, which has involved adding a new measure function to all of js, c, java and c# tests
|
I've squashed everything into a single commit and modified one last place where the |
Reviewed By: foghina Differential Revision: D2757965 fb-gh-sync-id: 061ff38ae59783edb36ff66516866e4a22fd6e25
|
Thanks a lot @majak! |
|
@paramaggarwal one caveat: If your node has set both width and height its measure function won't be called. |
|
Yes, makes sense. @majak, but if the measure function does get called, it will still continue to layout the children right? Specifically, if I have a box which has a measure function on it, and then two boxes inside it both with |
|
@paramaggarwal To be honest I'm not really sure. We didn't care about that in our use-case, so I didn't even try. However based on some chats we had internally, my impression is that it wouldn't work as you'd like :( |
Summary: This diff pulls in my changes to css-layout algorithm. (The change: facebook/yoga#154) This is a breaking change, since it adds a new `height` parameter to all measure functions. So I've fixed all existing implementations just by adding a new unused parameter `height` - it's up to owners of these functions whether they want to use it or not. Reviewed By: foghina Differential Revision: D2757965
Summary: This diff pulls in my changes to css-layout algorithm. (The change: facebook/yoga#154) This is a breaking change, since it adds a new `height` parameter to all measure functions. So I've fixed all existing implementations just by adding a new unused parameter `height` - it's up to owners of these functions whether they want to use it or not. Reviewed By: foghina Differential Revision: D2757965
The flexbox algorithm is considering text as only thing that does its own layout. Since text usually flows horizontally, the important information for laying it out is the width of its enclosing container (we are assuming its height is unbounded).
In my case I plan to use nodes that do their own layout too, but they are not constrained in same way as text is. (You can imagine this node as a view provided by a different layout engine.)
That means they can be provided height and be unbounded in width. In order to achieve this I need to pass information about height to the measure function as well.
This PR does that and adds some tests too.
Few things to note:
My changes were made mostly im mechanical copy-paste fashion to mimick what's happening with width, since I believe there shouldn't be any differences based on the flex direction.
Looking forward to comments and suggestions!