Skip final loop on absolute children, if possible

There's no need to go through all absolute children at the end of the
layout calculation if the node at hand doesn't have any. This also
ensures only absolutely positioned children are traversed in the final
loop.
This commit is contained in:
Lucas Rocha
2015-09-04 17:37:07 +01:00
parent 996f2a03d5
commit 793220faf8
6 changed files with 148 additions and 95 deletions

View File

@@ -129,18 +129,21 @@ typedef struct {
float maxDimensions[2];
} css_style_t;
typedef struct css_node {
typedef struct css_node css_node_t;
struct css_node {
css_style_t style;
css_layout_t layout;
int children_count;
int line_index;
css_node_t* next_absolute_child;
css_dim_t (*measure)(void *context, float width);
void (*print)(void *context);
struct css_node* (*get_child)(void *context, int i);
bool (*is_dirty)(void *context);
void *context;
} css_node_t;
};
// Lifecycle of nodes and children