-
Notifications
You must be signed in to change notification settings - Fork 1.5k
CSS Grid #1865
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
base: main
Are you sure you want to change the base?
CSS Grid #1865
Conversation
|
@intergalacticspacehighway is attempting to deploy a commit to the Meta Open Source Team on Vercel. A member of the Team first needs to authorize it. |
c394ca6 to
69cf662
Compare
f5dc467 to
ded011f
Compare
74c932a to
3ad6a75
Compare
|
Oo, I haven't looked at the implementation yet, but I wanted to point you at https://github.com/DioxusLabs/taffy/tree/main/test_fixtures/grid where we have 250+ test cases for CSS Grid in almost the same format as Yoga's gentests (Taffy was originally a port/rewrite of Yoga to Rust, and it's test generation setup is very similar). There are a couple of slightly differences in the test format:
But the actual HTML snippets should be compatible, and you should be able to script a conversion fairly easily if you want to use them. |
5e039ac to
c9840a0
Compare
5366a48 to
02aa523
Compare
|
@intergalacticspacehighway I see you're adding benchmarks, and wanted to note that we have comparative benchmarks between Yoga and Taffy over at https://github.com/DioxusLabs/taffy/tree/main/benches which work by using the Rust bindings to Yoga (https://github.com/bschwind/yoga-rs) Currently only the Flexbox benchmarks have a Yoga version, but I would be very interested to see this extended to the Grid benchmarks now that Yoga is getting Grid support. |
087b644 to
196d320
Compare
196d320 to
32b7899
Compare
2d76996 to
9d1d1ae
Compare
Why?
How?
By extending Yoga to support CSS Grid spec. The implementation is open to suggestions, improvements, including anything I might have missed.
Supported APIs in this PR
Properties
grid-template-columns,grid-template-rows,grid-column-start,grid-column-end,grid-row-start,grid-row-end,grid-auto-columns,grid-auto-rowsSizing Functions/Units
minmax(),auto,Percentage,Fixed(pxunit),Flex(frunit)Unsupported APIs (Future scope)
To limit the scope of the PR below features are omitted. We can introduce them gradually.
grid-[column|row]-[start|end]for absolute grid items. Right now, grid container can only be the containing block for absolute items.grid-template-areasgrid-areamasonrygrid-auto-flowgrid-column/grid-rowshorthandsrepeat()auto-fill,auto-fit,fit-content,max-content,min-content)Spec differences
[justify|align]-contentis set to flex-start in yoga by default, it behaves asstartfor grid. We can introducenormalkeyword which is the default keyword for these properties. It's not introduced in this PR. Visually it should behave the same.max-contentfor intrinsic item size calculations for intrinsic track size operations. We can revisit this if we add min-content support in yoga.Notes for reviewer 🙏
Main files that include grid layout algorithm are:
AutoPlacement.h- Implements Grid Placement AlgorithmTrackSizing.h- Implements Grid Sizing Algorithm and Track Sizing AlgorithmGridLayout.cpp- Grid layout entry point. CallsAutoPlacement,TrackSizingand performs final layout of grid items.More
cc - @joevilches @NickGerleman