CSS Grid algorithm 1/N: data structures#1923
CSS Grid algorithm 1/N: data structures#1923intergalacticspacehighway wants to merge 2 commits intofacebook:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| size_t columnEnd; | ||
| size_t rowStart; | ||
| size_t rowEnd; | ||
| yoga::Node* node; |
There was a problem hiding this comment.
Why does this need a full back-reference to the Yoga node?
There was a problem hiding this comment.
We use node reference to call measure methods in TrackSizing algorithm. e.g. calling calculateLayoutInternal. Also to get style from node like item.node->hasDefiniteLength(), item.node->style().computeMarginForAxis etc in track sizing.
NickGerleman
left a comment
There was a problem hiding this comment.
This mostly LGTM. Just a couple questions.
yoga/algorithm/grid/GridTrack.h
Outdated
|
|
||
| namespace facebook::yoga { | ||
|
|
||
| // Represents a resolved grid track size during layout computation. |
There was a problem hiding this comment.
nit: If all this after resolution step, can we make fields in struct const? That way, we would know, that it isn't mutated after-the-fact, during the layout algorithm, like some other structures.
There was a problem hiding this comment.
Yes, made the trackSize const. Other fields (baseSize, growthLimit, infinitelyGrowable) need to be mutable, added comments for them referring to the spec definitions.
d5c2977 to
0edcd33
Compare
0edcd33 to
8d4b7ff
Compare
First in a series of PRs splitting the grid layout algorithm into reviewable chunks. Addresses feedback from #1894.
Summary
style/GridTrack.htostyle/GridTrackSize.hto match the type it defines and CSS grid naming spec.baseSize,growthLimit,infinitelyGrowable) fromGridTrackSize— these belong in the algorithm layer, not the style definitionalgorithm/grid/GridTrack.h, wrapsGridTrackSizewith layout state via composition (removed inheritance)algorithm/grid/GridItem.h, represents a grid item with its resolved position (after autoplacement algorithm) and flags used during track sizing algorithm