Reset child position/sizes before calculating layout

This commit is contained in:
Pieter De Baets
2016-03-25 22:37:00 +01:00
parent 8d5cdd4e6c
commit b157ab4a00
9 changed files with 334 additions and 14 deletions

View File

@@ -137,8 +137,8 @@ struct css_node {
int children_count;
int line_index;
css_node_t* next_absolute_child;
css_node_t* next_flex_child;
css_node_t *next_absolute_child;
css_node_t *next_flex_child;
css_dim_t (*measure)(void *context, float width, float height);
void (*print)(void *context);
@@ -147,7 +147,6 @@ struct css_node {
void *context;
};
// Lifecycle of nodes and children
css_node_t *new_css_node(void);
void init_css_node(css_node_t *node);
@@ -161,8 +160,12 @@ typedef enum {
} css_print_options_t;
void print_css_node(css_node_t *node, css_print_options_t options);
// Function that computes the layout!
void layoutNode(css_node_t *node, float maxWidth, float maxHeight, css_direction_t parentDirection);
bool isUndefined(float value);
// Function that computes the layout!
void layoutNode(css_node_t *node, float maxWidth, float maxHeight, css_direction_t parentDirection);
// Reset the calculated layout values for a given node. You should call this before `layoutNode`.
void resetNodeLayout(css_node_t *node);
#endif