@@ -166,6 +166,17 @@ typedef enum TaffyGridAutoFlow {
166166 TAFFY_GRID_AUTO_FLOW_COLUMN_DENSE ,
167167} TaffyGridAutoFlow ;
168168
169+ typedef enum TaffyMeasureMode {
170+ // A none value (used to unset optional fields)
171+ TAFFY_MEASURE_MODE_EXACT ,
172+ // Fixed Length (pixel) value
173+ TAFFY_MEASURE_MODE_FIT_CONTENT ,
174+ // Percentage value
175+ TAFFY_MEASURE_MODE_MIN_CONTENT ,
176+ // Min-content size
177+ TAFFY_MEASURE_MODE_MAX_CONTENT ,
178+ } TaffyMeasureMode ;
179+
169180// How children overflowing their container should affect layout
170181//
171182// In CSS the primary effect of this property is to control whether contents of a parent container that overflow that container should
@@ -317,8 +328,6 @@ typedef struct TaffyNodeId {
317328 uint64_t _0 ;
318329} TaffyNodeId ;
319330
320- typedef const struct TaffyTree * TaffyTreeConstRef ;
321-
322331typedef struct TaffyNodeIdResult {
323332 enum TaffyReturnCode return_code ;
324333 struct TaffyNodeId value ;
@@ -329,6 +338,13 @@ typedef struct TaffyStyleMutRefResult {
329338 TaffyStyleMutRef value ;
330339} TaffyStyleMutRefResult ;
331340
341+ typedef struct TaffySize {
342+ float width ;
343+ float height ;
344+ } TaffySize ;
345+
346+ typedef struct TaffySize (* TaffyMeasureFunction )(enum TaffyMeasureMode width_measure_mode , float width , enum TaffyMeasureMode height_measure_mode , float height , void * context );
347+
332348typedef struct TaffyLayout {
333349 float x ;
334350 float y ;
@@ -341,6 +357,8 @@ typedef struct TaffyResult_TaffyLayout {
341357 struct TaffyLayout value ;
342358} TaffyResult_TaffyLayout ;
343359
360+ typedef const struct TaffyTree * TaffyTreeConstRef ;
361+
344362#ifdef __cplusplus
345363extern "C" {
346364#endif // __cplusplus
@@ -541,7 +559,7 @@ enum TaffyReturnCode TaffyTree_ComputeLayout(TaffyTreeMutRef raw_tree,
541559 float available_height );
542560
543561// Create a new Node in the TaffyTree. Returns a NodeId handle to the node.
544- enum TaffyReturnCode TaffyTree_PrintTree (TaffyTreeConstRef raw_tree , struct TaffyNodeId node_id );
562+ enum TaffyReturnCode TaffyTree_PrintTree (TaffyTreeMutRef raw_tree , struct TaffyNodeId node_id );
545563
546564// Create a new Node in the TaffyTree. Returns a NodeId handle to the node.
547565struct TaffyNodeIdResult TaffyTree_NewNode (TaffyTreeMutRef raw_tree );
@@ -557,6 +575,12 @@ enum TaffyReturnCode TaffyTree_AppendChild(TaffyTreeMutRef raw_tree,
557575// Create a new Node in the TaffyTree. Returns a NodeId handle to the node.
558576struct TaffyStyleMutRefResult TaffyTree_GetStyleMut (TaffyTreeMutRef raw_tree , struct TaffyNodeId node_id );
559577
578+ // Create a new Node in the TaffyTree. Returns a NodeId handle to the node.
579+ enum TaffyReturnCode TaffyTree_SetNodeContext (TaffyTreeMutRef raw_tree ,
580+ struct TaffyNodeId node_id ,
581+ TaffyMeasureFunction measure_function ,
582+ void * context );
583+
560584// Create a new Node in the TaffyTree. Returns a NodeId handle to the node.
561585struct TaffyResult_TaffyLayout TaffyTree_GetLayout (TaffyTreeConstRef raw_tree , struct TaffyNodeId node_id );
562586
0 commit comments