Skip to content
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

Allow Multiple dependencies for states in the RealDom (native core) #412

Merged
merged 23 commits into from Jul 7, 2022

Conversation

ealmloff
Copy link
Member

@ealmloff ealmloff commented May 17, 2022

Depends on #rust-lang/rust#96709 for GATs unless someone has a workaround

Refactor and generalize the incremental computation system for the RealDom to allow for mixed parent and child dependent state, and multiple dependencies for NodeDepState. The new trait for NodeDepState requires generic associated types to allow borrowing the elements of a tuple.

Why do we need this?
It allows some property of a node to depend on both the state of it's children and it's parent. Specifically this would make text wrapping, and overflow possible (#371). The layout of a parent node depends on the the layout of the children, and the layout of a text node depends on the text-wrap property of the parent.

packages/native-core/src/state.rs Outdated Show resolved Hide resolved
packages/native-core/src/state.rs Outdated Show resolved Hide resolved
@ealmloff
Copy link
Member Author

ealmloff commented Jul 6, 2022

I think GATs would be a cleaner solution, but this is possible with an associated type on the trait.

@ealmloff ealmloff marked this pull request as ready for review July 6, 2022 14:12
@jkelleyrtp
Copy link
Member

This seems like a rather complex system that might be worth refactoring in the future to be less trait-heavy so we don't run into issues with GATS/associated types since that gets pretty gnarly.

I dug into Taffy recently and was happy with a their ECS approach. We might be able to move some of the function values into an ECS-type structure and get a similar system but with less complexity.

http://github.com/dioxusLabs/taffy

But, we don't have a public facing crate with compatibility to worry about, so there's no harm in getting to a working point and then refactoring or cleaning up some structures later.

@jkelleyrtp jkelleyrtp merged commit 4a5ae75 into DioxusLabs:master Jul 7, 2022
@ealmloff ealmloff deleted the GAT_multable_dependancies branch July 7, 2022 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants