Move style_owned to box flags.

svn path=/trunk/netsurf/; revision=11887
This commit is contained in:
Michael Drake 2011-03-02 18:27:41 +00:00
parent f744c9dfa0
commit 77f67bccb6
2 changed files with 4 additions and 5 deletions

View File

@ -85,7 +85,7 @@ void *box_style_alloc(void *ptr, size_t len, void *pw)
static int static int
free_box_style(struct box *b) free_box_style(struct box *b)
{ {
if (b->style_owned && b->style != NULL) { if ((b->flags & STYLE_OWNED) && b->style != NULL) {
css_computed_style_destroy(b->style); css_computed_style_destroy(b->style);
b->style = NULL; b->style = NULL;
} }
@ -132,9 +132,9 @@ struct box * box_create(css_select_results *styles, css_computed_style *style,
box->type = BOX_INLINE; box->type = BOX_INLINE;
box->flags = 0; box->flags = 0;
box->flags = style_owned ? box->flags | STYLE_OWNED : box->flags;
box->styles = styles; box->styles = styles;
box->style = style; box->style = style;
box->style_owned = style_owned;
box->x = box->y = 0; box->x = box->y = 0;
box->width = UNKNOWN_WIDTH; box->width = UNKNOWN_WIDTH;
box->height = 0; box->height = 0;

View File

@ -118,7 +118,8 @@ typedef enum {
/** Type of a struct box. */ /** Type of a struct box. */
typedef enum { typedef enum {
NEW_LINE = 1 << 0 /* first inline on a new line */ NEW_LINE = 1 << 0, /* first inline on a new line */
STYLE_OWNED = 1 << 1 /* style is owned by this box */
} box_flags; } box_flags;
/* Sides of a box */ /* Sides of a box */
@ -149,8 +150,6 @@ struct box {
* a box's 'styles' select results, except for implied boxes, where it * a box's 'styles' select results, except for implied boxes, where it
* is a pointer to an owned computed style. */ * is a pointer to an owned computed style. */
css_computed_style *style; css_computed_style *style;
/** Whether the style is owned by this box. */
bool style_owned;
/** Coordinate of left padding edge relative to parent box, or relative /** Coordinate of left padding edge relative to parent box, or relative
* to ancestor that contains this box in float_children for FLOAT_. */ * to ancestor that contains this box in float_children for FLOAT_. */