summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-08-04 00:36:14 +0100
committerVincent Sanders <vince@kyllikki.org>2014-08-04 00:37:21 +0100
commitaf16c38d2dbe2decfc45015bd4ee020cb52c608b (patch)
treede33b2d3448dd65272c6df813dfb217d5f963d27 /render
parentc4d1ece421b3c7fb5f0b13c042d124671734afe2 (diff)
downloadnetsurf-af16c38d2dbe2decfc45015bd4ee020cb52c608b.tar.gz
netsurf-af16c38d2dbe2decfc45015bd4ee020cb52c608b.tar.bz2
fix DOM tree dump debug
Diffstat (limited to 'render')
-rw-r--r--render/html.c40
1 files changed, 33 insertions, 7 deletions
diff --git a/render/html.c b/render/html.c
index 9e576486f..12c173f0d 100644
--- a/render/html.c
+++ b/render/html.c
@@ -1971,17 +1971,43 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file)
/**
* Dump debug info concerning the html_content
*
- * \param bw The browser window
- * \param bw The file to dump to
+ * \param bw The browser window
+ * \param f The file to dump to
*/
-static void html_debug_dump(struct content *c, FILE *f)
+static nserror
+html_debug_dump(struct content *c, FILE *f, enum content_debug op)
{
- html_content *html = (html_content *) c;
+ html_content *htmlc = (html_content *)c;
+ dom_node *html;
+ dom_exception exc; /* returned by libdom functions */
+ nserror ret;
+
+ assert(htmlc != NULL);
- assert(html != NULL);
- assert(html->layout != NULL);
+ if (op == CONTENT_DEBUG_RENDER) {
+ assert(htmlc->layout != NULL);
+ box_dump(f, htmlc->layout, 0, true);
+ ret = NSERROR_OK;
+ } else {
+ if (htmlc->document == NULL) {
+ LOG(("No document to dump"));
+ return NSERROR_DOM;
+ }
+
+ exc = dom_document_get_document_element(htmlc->document, (void *) &html);
+ if ((exc != DOM_NO_ERR) || (html == NULL)) {
+ LOG(("Unable to obtain root node"));
+ return NSERROR_DOM;
+ }
+
+ ret = libdom_dump_structure(html, f, 0);
+
+ LOG(("DOM structure dump returning %d", ret));
+
+ dom_node_unref(html);
+ }
- box_dump(f, html->layout, 0, true);
+ return ret;
}