From 11aceb370aed43d5cb23180d6493d1ce181b8ed5 Mon Sep 17 00:00:00 2001 From: James Bursa Date: Wed, 24 Jan 2007 23:16:02 +0000 Subject: Add html_dump_frameset() to help understand and debug frames. svn path=/trunk/netsurf/; revision=3148 --- render/html.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) (limited to 'render') diff --git a/render/html.c b/render/html.c index 7b7844ae8..830611d54 100644 --- a/render/html.c +++ b/render/html.c @@ -56,6 +56,8 @@ static void html_object_refresh(void *p); static void html_destroy_frameset(struct content_html_frames *frameset); static void html_destroy_iframe(struct content_html_iframe *iframe); static void html_set_status(struct content *c, const char *extra); +static void html_dump_frameset(struct content_html_frames *frame, + unsigned int depth); static const char empty_document[] = "data.html.layout->children, 0);*/ + /*if (c->data.html.frameset) + html_dump_frameset(c->data.html.frameset, 0);*/ /* extract image maps - can't do this sensibly in xml_to_box */ if (!imagemap_extract(html, c)) { @@ -1609,3 +1613,55 @@ void html_close(struct content *c) content_close(c->data.html.object[i].content); } } + + +/** + * Print a frameset tree to stderr. + */ + +void html_dump_frameset(struct content_html_frames *frame, + unsigned int depth) +{ + unsigned int i; + int row, col, index; + const char *unit[] = {"px", "%", "*"}; + const char *scrolling[] = {"auto", "yes", "no"}; + + assert(frame); + + fprintf(stderr, "%p ", frame); + + fprintf(stderr, "(%i %i) ", frame->rows, frame->cols); + + fprintf(stderr, "w%g%s ", frame->width.value, unit[frame->width.unit]); + fprintf(stderr, "h%g%s ", frame->height.value,unit[frame->height.unit]); + fprintf(stderr, "(margin w%i h%i) ", + frame->margin_width, frame->margin_height); + + if (frame->name) + fprintf(stderr, "'%s' ", frame->name); + if (frame->url) + fprintf(stderr, "<%s> ", frame->url); + + if (frame->no_resize) + fprintf(stderr, "noresize "); + fprintf(stderr, "(scrolling %s) ", scrolling[frame->scrolling]); + if (frame->border) + fprintf(stderr, "border %x ", + (unsigned int) frame->border_colour); + + fprintf(stderr, "\n"); + + if (frame->children) { + for (row = 0; row != frame->rows; row++) { + for (col = 0; col != frame->cols; col++) { + for (i = 0; i != depth; i++) + fprintf(stderr, " "); + fprintf(stderr, "(%i %i): ", row, col); + index = (row * frame->cols) + col; + html_dump_frameset(&frame->children[index], + depth + 1); + } + } + } +} -- cgit v1.2.3