-
Notifications
You must be signed in to change notification settings - Fork 155
"Traitify" the Style struct
#568
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0dec3a3 to
11e7840
Compare
Collaborator
Author
|
@vkurchatkin-miro How does this design for traitifying |
11e7840 to
71a76c2
Compare
974929a to
dd0c5dd
Compare
|
@nicoburns great stuff, even more flexible than what I thought of |
Patryk27
reviewed
Feb 8, 2024
| /// The set of styles required for a Flexbox container | ||
| pub trait FlexboxContainerStyle: CoreStyle { | ||
| /// Which direction does the main axis flow in? | ||
| #[inline(always)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, is it still worth doing considering rust-lang/rust#116505 exists? 👀
dd0c5dd to
d7ebe44
Compare
Style structStyle struct
778a2b0 to
55a0d45
Compare
4 tasks
21e44f2 to
d486843
Compare
514bbd4 to
6441efc
Compare
6441efc to
824a3fd
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
code quality
Make the code cleaner or prettier.
enhancement
New feature or request
usability
Make the library more comfortable to use
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Objective
Allow users of Taffy to bring their own style representation(s).
Context
While we have support for custom node tree representations, we currently enforce usage of a concrete style representation. Additionally, that style representation is shared across all algorithms and thus must include the styles for Flexbox, CSS Grid and Block layout, making it quite large. A problem which will only get worse if non-css algorithms are supported in future.
Feedback wanted
Todo
Displaystyle. Algorithms typically only need to know whether theDisplayisNoneor not. I am considering creating a new enum with justNoneandNormal(name tbd) variants for this purpose. This would need to be extended withContentsif we implement that, but would never need to know about individual algorithms. See also:style::Displayis not according to specifications #115Remove theTurns out this is still required for root layoutget_stylemethod from the basePartialLayoutTreetrait