summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--content/content.c16
-rw-r--r--content/content.h11
-rw-r--r--content/content_protected.h1
-rw-r--r--desktop/browser.c14
-rw-r--r--desktop/browser.h14
-rw-r--r--gtk/scaffolding.c9
-rw-r--r--render/html.c19
-rw-r--r--render/html.h3
-rw-r--r--render/html_internal.h3
-rw-r--r--riscos/window.c3
-rw-r--r--windows/gui.c3
11 files changed, 80 insertions, 16 deletions
diff --git a/content/content.c b/content/content.c
index 728147f31..83fdacf78 100644
--- a/content/content.c
+++ b/content/content.c
@@ -872,6 +872,22 @@ nserror content_debug_dump(struct hlcache_handle *h, FILE *f, enum content_debug
return c->handler->debug_dump(c, f, op);
}
+/* exported interface documented in content/content.h */
+nserror content_debug(struct hlcache_handle *h, enum content_debug op)
+{
+ struct content *c = hlcache_handle_get_content(h);
+
+ if (c == NULL) {
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ if (c->handler->debug == NULL) {
+ return NSERROR_NOT_IMPLEMENTED;
+ }
+
+ return c->handler->debug(c, op);
+}
+
void content_add_error(struct content *c, const char *token,
unsigned int line)
diff --git a/content/content.h b/content/content.h
index 67a519df6..bc47ffef0 100644
--- a/content/content.h
+++ b/content/content.h
@@ -90,7 +90,8 @@ typedef enum {
/** Debugging dump operations */
enum content_debug {
CONTENT_DEBUG_RENDER, /** Debug the contents rendering. */
- CONTENT_DEBUG_DOM /** Debug teh contents Document Object. */
+ CONTENT_DEBUG_DOM, /** Debug the contents Document Object. */
+ CONTENT_DEBUG_REDRAW /** Debug redraw operations. */
};
/** RFC5988 metadata link */
@@ -300,6 +301,14 @@ void content_search_clear(struct hlcache_handle *h);
*/
nserror content_debug_dump(struct hlcache_handle *h, FILE *f, enum content_debug op);
+/**
+ * Control debug con a content.
+ *
+ * \param h content handle to debug.
+ * \param op Debug operation type.
+ */
+nserror content_debug(struct hlcache_handle *h, enum content_debug op);
+
struct content_rfc5988_link *content_find_rfc5988_link(struct hlcache_handle *c,
lwc_string *rel);
diff --git a/content/content_protected.h b/content/content_protected.h
index ce161befc..af274ef5a 100644
--- a/content/content_protected.h
+++ b/content/content_protected.h
@@ -77,6 +77,7 @@ struct content_handler {
const char *string);
void (*search_clear)(struct content *c);
nserror (*debug_dump)(struct content *c, FILE *f, enum content_debug op);
+ nserror (*debug)(struct content *c, enum content_debug op);
nserror (*clone)(const struct content *old, struct content **newc);
bool (*matches_quirks)(const struct content *c, bool quirks);
const char *(*get_encoding)(const struct content *c);
diff --git a/desktop/browser.c b/desktop/browser.c
index f7acec491..528fb1fe5 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -736,11 +736,19 @@ void browser_window_set_gadget_filename(struct browser_window *bw,
nserror browser_window_debug_dump(struct browser_window *bw,
FILE *f, enum content_debug op)
{
- if (bw->current_content == NULL) {
- return NSERROR_OK;
+ if (bw->current_content != NULL) {
+ return content_debug_dump(bw->current_content, f, op);
}
+ return NSERROR_OK;
+}
- return content_debug_dump(bw->current_content, f, op);
+/* exported interface, documented in browser.h */
+nserror browser_window_debug(struct browser_window *bw, enum content_debug op)
+{
+ if (bw->current_content != NULL) {
+ return content_debug(bw->current_content, op);
+ }
+ return NSERROR_OK;
}
/** slow script handler
diff --git a/desktop/browser.h b/desktop/browser.h
index c384c7f65..b24885d4f 100644
--- a/desktop/browser.h
+++ b/desktop/browser.h
@@ -668,9 +668,19 @@ int browser_get_dpi(void);
/**
* Dump debug info concerning the browser window's contents to file
*
- * \param bw The browser window
- * \param f The file to dump to
+ * \param bw The browser window.
+ * \param f The file to dump to.
+ * \param op The debug operation type to dump.
+ * \return NSERROR_OK on success or error code on faliure.
*/
nserror browser_window_debug_dump(struct browser_window *bw, FILE *f, enum content_debug op);
+/**
+ * set debug options on a window
+ * \param bw The browser window.
+ * \param op The debug operation type.
+ * \return NSERROR_OK on success or error code on faliure.
+ */
+nserror browser_window_debug(struct browser_window *bw, enum content_debug op);
+
#endif
diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c
index ce3dae962..ff0b2b82c 100644
--- a/gtk/scaffolding.c
+++ b/gtk/scaffolding.c
@@ -45,7 +45,6 @@
#include "desktop/searchweb.h"
#include "desktop/textinput.h"
#include "desktop/font.h"
-#include "render/html.h"
#include "content/hlcache.h"
#include "gtk/compat.h"
@@ -1267,8 +1266,14 @@ MULTIHANDLER(savewindowsize)
MULTIHANDLER(toggledebugging)
{
- html_redraw_debug = !html_redraw_debug;
+ struct browser_window *bw;
+
+ bw = nsgtk_get_browser_window(g->top_level);
+
+ browser_window_debug(bw, CONTENT_DEBUG_REDRAW);
+
nsgtk_reflow_all_windows();
+
return TRUE;
}
diff --git a/render/html.c b/render/html.c
index d4ce3366f..4e9347aa5 100644
--- a/render/html.c
+++ b/render/html.c
@@ -1978,10 +1978,26 @@ 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);
diff --git a/riscos/window.c b/riscos/window.c
index 76c4105bb..1c8d8bd95 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -2000,7 +2000,8 @@ bool ro_gui_window_handle_local_keypress(struct gui_window *g, wimp_key *key,
case IS_WIMP_KEY + wimp_KEY_SHIFT + wimp_KEY_F11:
/* Toggle display of box outlines. */
- html_redraw_debug = !html_redraw_debug;
+ browser_window_debug(g->bw, CONTENT_DEBUG_REDRAW);
+
gui_window_redraw_window(g);
return true;
diff --git a/windows/gui.c b/windows/gui.c
index 653bf44e1..3c1d201e5 100644
--- a/windows/gui.c
+++ b/windows/gui.c
@@ -42,7 +42,6 @@
#include "utils/nsoption.h"
#include "desktop/plotters.h"
#include "desktop/textinput.h"
-#include "render/html.h"
#include "desktop/gui_window.h"
#include "desktop/gui_clipboard.h"
#include "desktop/gui_misc.h"
@@ -1013,8 +1012,8 @@ nsws_window_command(HWND hwnd,
break;
case IDM_VIEW_TOGGLE_DEBUG_RENDERING:
- html_redraw_debug = !html_redraw_debug;
if (gw->bw != NULL) {
+ browser_window_debug(gw->bw, CONTENT_DEBUG_REDRAW);
/* TODO: This should only redraw, not reformat.
* (Layout doesn't change, so reformat is a waste of time) */
browser_window_reformat(gw->bw, false, gw->width, gw->height);