From 8c2cfecfb5e83d023609914dd101c23777fd2906 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 6 Nov 2014 22:51:46 +0000 Subject: Allow content handlers to have debug values set through API Previously content handler debugging features were accessed by global variables. This allows the setting of debugging parameters via a content API giving per content control over debugging features. Currently only used by the html content handler to toggle global redraw debugging. --- render/html.c | 19 ++++++++++++++++++- render/html.h | 3 --- render/html_internal.h | 3 ++- 3 files changed, 20 insertions(+), 5 deletions(-) (limited to 'render') diff --git a/render/html.c b/render/html.c index d4ce3366f..4e9347aa5 100644 --- a/render/html.c +++ b/render/html.c @@ -1977,11 +1977,27 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file) } +/** + * set debug status. + * + * \param c The content to debug + * \param op The debug operation type + */ +static nserror +html_debug(struct content *c, enum content_debug op) +{ + html_redraw_debug = !html_redraw_debug; + + return NSERROR_OK; +} + + /** * Dump debug info concerning the html_content * - * \param bw The browser window + * \param c The content to debug * \param f The file to dump to + * \param op The debug dump type */ static nserror html_debug_dump(struct content *c, FILE *f, enum content_debug op) @@ -2261,6 +2277,7 @@ static const content_handler html_content_handler = { .search = html_search, .search_clear = html_search_clear, .debug_dump = html_debug_dump, + .debug = html_debug, .clone = html_clone, .get_encoding = html_encoding, .type = html_content_type, diff --git a/render/html.h b/render/html.h index 145471827..6503c91fe 100644 --- a/render/html.h +++ b/render/html.h @@ -149,9 +149,6 @@ struct content_html_iframe { #define STYLESHEET_USER 3 /* user stylesheet */ #define STYLESHEET_START 4 /* start of document stylesheets */ -/** Render padding and margin box outlines in html_redraw(). */ -extern bool html_redraw_debug; - nserror html_init(void); void html_redraw_a_box(struct hlcache_handle *h, struct box *box); diff --git a/render/html_internal.h b/render/html_internal.h index b57f240bd..1a878031b 100644 --- a/render/html_internal.h +++ b/render/html_internal.h @@ -176,7 +176,8 @@ typedef struct html_content { } html_content; - +/** Render padding and margin box outlines in html_redraw(). */ +extern bool html_redraw_debug; void html_set_status(html_content *c, const char *extra); -- cgit v1.2.3