Allow suppression of style dump in box tree dumps.

This commit is contained in:
Michael Drake 2014-07-13 18:07:12 +01:00
parent 36411a2ba5
commit 0d3faeb4bd
4 changed files with 10 additions and 10 deletions

View File

@ -880,7 +880,7 @@ bool box_visible(struct box *box)
* Print a box tree to a file. * Print a box tree to a file.
*/ */
void box_dump(FILE *stream, struct box *box, unsigned int depth) void box_dump(FILE *stream, struct box *box, unsigned int depth, bool style)
{ {
unsigned int i; unsigned int i;
struct box *c, *prev; struct box *c, *prev;
@ -935,7 +935,7 @@ void box_dump(FILE *stream, struct box *box, unsigned int depth)
} }
if (box->gadget) if (box->gadget)
fprintf(stream, "(gadget) "); fprintf(stream, "(gadget) ");
if (box->style) if (style && box->style)
nscss_dump_computed_style(stream, box->style); nscss_dump_computed_style(stream, box->style);
if (box->href) if (box->href)
fprintf(stream, " -> '%s'", nsurl_access(box->href)); fprintf(stream, " -> '%s'", nsurl_access(box->href));
@ -971,7 +971,7 @@ void box_dump(FILE *stream, struct box *box, unsigned int depth)
for (i = 0; i != depth; i++) for (i = 0; i != depth; i++)
fprintf(stream, " "); fprintf(stream, " ");
fprintf(stream, "list_marker:\n"); fprintf(stream, "list_marker:\n");
box_dump(stream, box->list_marker, depth + 1); box_dump(stream, box->list_marker, depth + 1, style);
} }
for (c = box->children; c && c->next; c = c->next) for (c = box->children; c && c->next; c = c->next)
@ -988,7 +988,7 @@ void box_dump(FILE *stream, struct box *box, unsigned int depth)
fprintf(stream, "warning: box->prev %p (should be " fprintf(stream, "warning: box->prev %p (should be "
"%p) (box on next line)\n", "%p) (box on next line)\n",
c->prev, prev); c->prev, prev);
box_dump(stream, c, depth + 1); box_dump(stream, c, depth + 1, style);
} }
} }

View File

@ -331,7 +331,7 @@ struct box *box_pick_text_box(struct html_content *html,
int x, int y, int dir, int *dx, int *dy); int x, int y, int dir, int *dx, int *dy);
struct box *box_find_by_id(struct box *box, lwc_string *id); struct box *box_find_by_id(struct box *box, lwc_string *id);
bool box_visible(struct box *box); bool box_visible(struct box *box);
void box_dump(FILE *stream, struct box *box, unsigned int depth); void box_dump(FILE *stream, struct box *box, unsigned int depth, bool style);
bool box_extract_link(const char *rel, nsurl *base, nsurl **result); bool box_extract_link(const char *rel, nsurl *base, nsurl **result);
bool box_handle_scrollbars(struct content *c, struct box *box, bool box_handle_scrollbars(struct content *c, struct box *box,

View File

@ -100,7 +100,7 @@ static void html_box_convert_done(html_content *c, bool success)
#if ALWAYS_DUMP_BOX #if ALWAYS_DUMP_BOX
box_dump(stderr, c->layout->children, 0); box_dump(stderr, c->layout->children, 0, true);
#endif #endif
#if ALWAYS_DUMP_FRAMESET #if ALWAYS_DUMP_FRAMESET
if (c->frameset) if (c->frameset)
@ -1981,7 +1981,7 @@ static void html_debug_dump(struct content *c, FILE *f)
assert(html != NULL); assert(html != NULL);
assert(html->layout != NULL); assert(html->layout != NULL);
box_dump(f, html->layout, 0); box_dump(f, html->layout, 0, true);
} }

View File

@ -827,7 +827,7 @@ void layout_minmax_block(struct box *block,
} }
if (max < min) { if (max < min) {
box_dump(stderr, block, 0); box_dump(stderr, block, 0, true);
assert(0); assert(0);
} }
@ -2794,7 +2794,7 @@ bool layout_line(struct box *first, int *width, int *y,
LOG(("float %p already placed", b)); LOG(("float %p already placed", b));
#endif #endif
box_dump(stderr, cont, 0); box_dump(stderr, cont, 0, true);
assert(0); assert(0);
} }
b->next_float = cont->float_children; b->next_float = cont->float_children;
@ -4139,7 +4139,7 @@ void layout_minmax_table(struct box *table,
for (i = 0; i != table->columns; i++) { for (i = 0; i != table->columns; i++) {
if (col[i].max < col[i].min) { if (col[i].max < col[i].min) {
box_dump(stderr, table, 0); box_dump(stderr, table, 0, true);
assert(0); assert(0);
} }
table_min += col[i].min; table_min += col[i].min;