Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

[Layout] Add extensibility support to ASLayoutElementStyle#2943

Closed
maicki wants to merge 20 commits intofacebookarchive:masterfrom
maicki:MSASLayoutElementStyleExtensibility
Closed

[Layout] Add extensibility support to ASLayoutElementStyle#2943
maicki wants to merge 20 commits intofacebookarchive:masterfrom
maicki:MSASLayoutElementStyleExtensibility

Conversation

@maicki
Copy link
Copy Markdown
Contributor

@maicki maicki commented Jan 28, 2017

With the introduction of ASLayoutElementStyle that combines all style related properties for a ASLayoutElement we need to provide some kind of extensibility support. This is important as it should be possible to add custom layout specs and extend the ASLayoutElementStyle for usage within the custom layout specs.

This PR relies on #2941 to land before.

The general idea is outline in this gist via examples: https://gist.github.com/maicki/2630b51f62cbedc0cb34e0bcac96d6c9

Original diff: #2294

TODO:

@appleguy
Copy link
Copy Markdown
Contributor

appleguy commented Jan 28, 2017

@maicki Also, thanks for putting this up so quickly! It will be very useful.

I'd be happy to help review & collaborate on the Layout cleanup diff this depends on, both because that cleanup is a great step in itself, and also because it will allow us to land this and close out two PRs that make nice steps forward :).

I will very likely be able to take on the Yoga integration test, although due to an offsite next week and other projects at the moment, I think it will take until the first week of February to start. I may get further delayed, but I think it's surprisingly feasible that we might have a prototype by mid-Feb!

Personally, I think keeping the ASLayoutSpec API is an absolute must. It should be possible to use the Yoga "style" through an explicit .children array that is different than .subnodes, but I really do think ASLayoutSpec should stick around.

I already have in mind exactly how they can be "powered" internally by Yoga, with trees that exist separately at each level in the node hierarchy and calls into them are driven by the -calculateLayoutThatFits method (the C structs from Yoga would be converted into ASLayouts, and most critically, the *Measure function pointer that Yoga has will be connected to something like layoutThatFits: on each child node -- which will continue the recursive propagation into calculateLayoutThatFits:/calculateSizeThatFits:, while also flawlessly encapsulating the .preferredSize / .layoutSize integration you masterfully integrated into the constrainedSize calculation stage!!

@maicki
Copy link
Copy Markdown
Contributor Author

maicki commented Feb 3, 2017

Closing this as new implementation based on master is in #2975

@maicki maicki closed this Feb 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants