summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--content/content.c18
-rw-r--r--content/content.h179
-rw-r--r--content/content_factory.h2
-rw-r--r--content/content_protected.h25
-rw-r--r--content/fetchers/about.c1
-rw-r--r--content/handlers/image/bmp.c6
-rw-r--r--content/handlers/image/gif.c6
-rw-r--r--content/handlers/image/ico.c4
-rw-r--r--content/handlers/image/image.c4
-rw-r--r--content/handlers/image/image.h2
-rw-r--r--content/handlers/image/image_cache.c5
-rw-r--r--content/handlers/image/image_cache.h1
-rw-r--r--content/handlers/image/jpeg.c3
-rw-r--r--content/handlers/image/nssprite.c8
-rw-r--r--content/handlers/image/png.c15
-rw-r--r--content/handlers/image/svg.c5
-rw-r--r--content/hlcache.c2
-rw-r--r--content/hlcache.h7
-rw-r--r--content/urldb.h3
-rw-r--r--desktop/browser.c8
-rw-r--r--desktop/browser_history.c7
-rw-r--r--desktop/browser_private.h1
-rw-r--r--desktop/frames.c19
-rw-r--r--desktop/print.c172
-rw-r--r--desktop/save_complete.c35
-rw-r--r--desktop/save_text.c5
-rw-r--r--desktop/searchweb.c1
-rw-r--r--desktop/treeview.c8
-rw-r--r--frontends/amiga/arexx.c4
-rw-r--r--frontends/amiga/bitmap.c5
-rw-r--r--frontends/amiga/clipboard.c2
-rw-r--r--frontends/amiga/ctxmenu.c4
-rw-r--r--frontends/amiga/download.c4
-rw-r--r--frontends/amiga/drag.c4
-rw-r--r--frontends/amiga/dt_anim.c4
-rw-r--r--frontends/amiga/dt_picture.c3
-rw-r--r--frontends/amiga/dt_sound.c20
-rw-r--r--frontends/amiga/file.c6
-rw-r--r--frontends/amiga/filetype.c15
-rw-r--r--frontends/amiga/filetype.h6
-rw-r--r--frontends/amiga/gui.c29
-rwxr-xr-xfrontends/amiga/gui_options.c1
-rw-r--r--frontends/amiga/icon.c5
-rw-r--r--frontends/amiga/iff_dr2d.c3
-rw-r--r--frontends/amiga/menu.c6
-rw-r--r--frontends/amiga/plugin_hack.c17
-rw-r--r--frontends/amiga/print.c7
-rw-r--r--frontends/amiga/tree.c4
-rw-r--r--frontends/atari/ctxmenu.c5
-rw-r--r--frontends/atari/gui.c10
-rw-r--r--frontends/beos/bitmap.cpp4
-rw-r--r--frontends/cocoa/bitmap.m2
-rw-r--r--frontends/framebuffer/bitmap.c2
-rw-r--r--frontends/gtk/bitmap.c4
-rw-r--r--frontends/gtk/scaffolding.c5
-rw-r--r--frontends/gtk/viewsource.c3
-rw-r--r--frontends/gtk/window.c14
-rw-r--r--frontends/riscos/bitmap.c2
-rw-r--r--frontends/riscos/content-handlers/artworks.c4
-rw-r--r--frontends/riscos/content-handlers/draw.c4
-rw-r--r--frontends/riscos/content-handlers/sprite.c4
-rw-r--r--frontends/riscos/filetype.c8
-rw-r--r--frontends/riscos/filetype.h2
-rw-r--r--frontends/riscos/gui.c8
-rw-r--r--frontends/riscos/gui/url_bar.c10
-rw-r--r--frontends/riscos/print.c14
-rw-r--r--frontends/riscos/save.c32
-rw-r--r--frontends/riscos/save_draw.c5
-rw-r--r--frontends/riscos/search.c5
-rw-r--r--frontends/riscos/theme_install.c2
-rw-r--r--frontends/riscos/url_suggest.c5
-rw-r--r--frontends/riscos/window.c14
-rw-r--r--frontends/windows/bitmap.c2
-rw-r--r--include/netsurf/content.h188
-rw-r--r--include/netsurf/content_type.h (renamed from content/content_type.h)33
-rw-r--r--javascript/duktape/Document.bnd2
-rw-r--r--javascript/duktape/Window.bnd1
-rw-r--r--render/box.c6
-rw-r--r--render/box_textarea.c3
-rw-r--r--render/html.c11
-rw-r--r--render/html.h2
-rw-r--r--render/html_css.c5
-rw-r--r--render/html_forms.c1
-rw-r--r--render/html_interaction.c12
-rw-r--r--render/html_object.c3
-rw-r--r--render/html_redraw.c9
-rw-r--r--render/html_script.c2
-rw-r--r--render/layout.c5
-rw-r--r--render/textplain.c1
89 files changed, 650 insertions, 505 deletions
diff --git a/content/content.c b/content/content.c
index 888202e6e..f650af22c 100644
--- a/content/content.c
+++ b/content/content.c
@@ -28,11 +28,12 @@
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/messages.h"
+#include "netsurf/browser_window.h"
+#include "netsurf/bitmap.h"
+#include "netsurf/content.h"
#include "desktop/knockout.h"
#include "desktop/gui_internal.h"
-#include "netsurf/browser_window.h"
-#include "netsurf/bitmap.h"
#include "content/content_protected.h"
#include "content/content_debug.h"
#include "content/hlcache.h"
@@ -542,12 +543,8 @@ void content__request_redraw(struct content *c,
content_broadcast(c, CONTENT_MSG_REDRAW, data);
}
-/**
- * Display content on screen with optional tiling.
- *
- * Calls the redraw function for the content.
- */
+/* exported interface, documented in content/content.h */
bool content_redraw(hlcache_handle *h, struct content_redraw_data *data,
const struct rect *clip, const struct redraw_context *ctx)
{
@@ -1050,12 +1047,7 @@ bool content__add_rfc5988_link(struct content *c,
-/**
- * Retrieve URL associated with content
- *
- * \param c Content to retrieve URL from
- * \return Pointer to URL, or NULL if not found.
- */
+/* exported interface documented in content/content.h */
nsurl *content_get_url(struct content *c)
{
if (c == NULL)
diff --git a/content/content.h b/content/content.h
index 1c7507721..308b2113b 100644
--- a/content/content.h
+++ b/content/content.h
@@ -17,8 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * Content handling (interface).
+/**
+ * \file
+ * Content handling interface.
*
* The content functions manipulate struct contents, which correspond to URLs.
*/
@@ -30,10 +31,8 @@
#include "utils/errors.h"
#include "content/content_factory.h"
-#include "content/content_type.h"
#include "desktop/search.h" /* search flags enum */
#include "netsurf/mouse.h" /* mouse state enums */
-#include "desktop/plot_style.h" /* color typedef */
struct browser_window;
struct browser_window_features;
@@ -81,18 +80,6 @@ typedef enum {
CONTENT_MSG_GADGETCLICK/**< A gadget has been clicked on (mainly for file) */
} content_msg;
-/** Debugging dump operations */
-enum content_debug {
- CONTENT_DEBUG_RENDER, /** Debug the contents rendering. */
- CONTENT_DEBUG_DOM, /** Debug the contents Document Object. */
- CONTENT_DEBUG_REDRAW /** Debug redraw operations. */
-};
-
-/** Content encoding informstion types */
-enum content_encoding_type {
- CONTENT_ENCODING_NORMAL, /** The content encoding */
- CONTENT_ENCODING_SOURCE /** The content encoding source */
-};
/** RFC5988 metadata link */
struct content_rfc5988_link {
@@ -208,44 +195,35 @@ union content_msg_data {
} gadget_click;
};
-/** parameters to content redraw */
-struct content_redraw_data {
- int x; /**< coordinate for top-left of redraw */
- int y; /**< coordinate for top-left of redraw */
- /** dimensions to render content at
- * (for scaling contents with intrinsic dimensions) */
- int width; /**< horizontal dimension */
- int height; /**< vertical dimension */
+/* The following are for hlcache */
+void content_destroy(struct content *c);
- /** The background colour */
- colour background_colour;
- /** Scale for redraw
- * (for scaling contents without intrinsic dimensions) */
- float scale; /**< Scale factor for redraw */
+bool content_add_user(struct content *h, void (*callback)(struct content *c, content_msg msg, union content_msg_data data, void *pw), void *pw);
- bool repeat_x; /**< whether content is tiled in x direction */
- bool repeat_y; /**< whether content is tiled in y direction */
-};
-/* The following are for hlcache */
-void content_destroy(struct content *c);
+void content_remove_user(struct content *c, void (*callback)(struct content *c, content_msg msg, union content_msg_data data, void *pw), void *pw);
-bool content_add_user(struct content *h,
- void (*callback)(struct content *c, content_msg msg,
- union content_msg_data data, void *pw),
- void *pw);
-void content_remove_user(struct content *c,
- void (*callback)(struct content *c, content_msg msg,
- union content_msg_data data, void *pw),
- void *pw);
uint32_t content_count_users(struct content *c);
+
+
bool content_matches_quirks(struct content *c, bool quirks);
+
+
bool content_is_shareable(struct content *c);
+/* only used by cocoa apple image handling and for getting nsurl of content */
const struct llcache_handle *content_get_llcache_handle(struct content *c);
+
+
+/**
+ * Retrieve URL associated with content
+ *
+ * \param c Content to retrieve URL from
+ * \return Pointer to URL, or NULL if not found.
+ */
struct nsurl *content_get_url(struct content *c);
struct content *content_clone(struct content *c);
@@ -254,42 +232,29 @@ nserror content_abort(struct content *c);
/* Client functions */
bool content_can_reformat(struct hlcache_handle *h);
+
void content_reformat(struct hlcache_handle *h, bool background,
int width, int height);
+
void content_request_redraw(struct hlcache_handle *h,
int x, int y, int width, int height);
+
void content_mouse_track(struct hlcache_handle *h, struct browser_window *bw,
browser_mouse_state mouse, int x, int y);
+
void content_mouse_action(struct hlcache_handle *h, struct browser_window *bw,
browser_mouse_state mouse, int x, int y);
-bool content_keypress(struct hlcache_handle *h, uint32_t key);
-bool content_redraw(struct hlcache_handle *h, struct content_redraw_data *data,
- const struct rect *clip, const struct redraw_context *ctx);
+bool content_keypress(struct hlcache_handle *h, uint32_t key);
-/**
- * Redraw a content with scale set for horizontal fit.
- *
- * Redraws the content at a specified width and height with the
- * content drawing scaled to fit within the area.
- *
- * \param content The content to redraw
- * \param width The target width
- * \param height The target height
- * \param ctx current redraw context
- * \return true if successful, false otherwise
- *
- * The thumbnail is guaranteed to be filled to its width/height extents, so
- * there is no need to render a solid background first.
- *
- * Units for width and height are pixels.
- */
-bool content_scaled_redraw(struct hlcache_handle *content, int width, int height, const struct redraw_context *ctx);
void content_open(struct hlcache_handle *h, struct browser_window *bw,
struct content *page, struct object_params *params);
+
void content_close(struct hlcache_handle *h);
+
void content_clear_selection(struct hlcache_handle *h);
+
char * content_get_selection(struct hlcache_handle *h);
/**
@@ -305,13 +270,16 @@ nserror content_get_contextual_content(struct hlcache_handle *h,
bool content_scroll_at_point(struct hlcache_handle *h,
int x, int y, int scrx, int scry);
+
bool content_drop_file_at_point(struct hlcache_handle *h,
int x, int y, char *file);
void content_search(struct hlcache_handle *h, void *context,
search_flags_t flags, const char *string);
+
void content_search_clear(struct hlcache_handle *h);
+
/**
* Control debug con a content.
*
@@ -320,6 +288,7 @@ void content_search_clear(struct hlcache_handle *h);
*/
nserror content_debug(struct hlcache_handle *h, enum content_debug op);
+
/**
* find link in content that matches the rel string.
*
@@ -328,34 +297,8 @@ nserror content_debug(struct hlcache_handle *h, enum content_debug op);
* \return A matching rfc5988 link or NULL if none is found.
*
*/
-struct content_rfc5988_link *content_find_rfc5988_link(struct hlcache_handle *h,
- lwc_string *rel);
+struct content_rfc5988_link *content_find_rfc5988_link(struct hlcache_handle *h, lwc_string *rel);
-/* Member accessors */
-
-/**
- * Retrieve computed type of content
- *
- * \param h handle to the content to retrieve tyoe of.
- * \return Computed content type
- */
-content_type content_get_type(struct hlcache_handle *h);
-
-/**
- * Retrieve mime-type of content
- *
- * \param h handle to the content to retrieve mime type from
- * \return Pointer to referenced mime type, or NULL if not found.
- */
-lwc_string *content_get_mime_type(struct hlcache_handle *h);
-
-/**
- * Retrieve title associated with content
- *
- * \param h handle to the content to retrieve title from
- * \return Pointer to title, or NULL if not found.
- */
-const char *content_get_title(struct hlcache_handle *h);
/**
* Retrieve status of content
@@ -365,6 +308,7 @@ const char *content_get_title(struct hlcache_handle *h);
*/
content_status content_get_status(struct hlcache_handle *h);
+
/**
* Retrieve status of content
*
@@ -373,6 +317,7 @@ content_status content_get_status(struct hlcache_handle *h);
*/
content_status content__get_status(struct content *c);
+
/**
* Retrieve status message associated with content
*
@@ -381,21 +326,6 @@ content_status content__get_status(struct content *c);
*/
const char *content_get_status_message(struct hlcache_handle *h);
-/**
- * Retrieve width of content
- *
- * \param h handle to the content to get width of.
- * \return Content width
- */
-int content_get_width(struct hlcache_handle *h);
-
-/**
- * Retrieve height of content
- *
- * \param h handle to the content to get height of.
- * \return Content height
- */
-int content_get_height(struct hlcache_handle *h);
/**
* Retrieve available width of content
@@ -405,26 +335,6 @@ int content_get_height(struct hlcache_handle *h);
*/
int content_get_available_width(struct hlcache_handle *h);
-/**
- * Retrieve source of content
- *
- * \param h Content handle to retrieve source of
- * \param size Pointer to location to receive byte size of source
- * \return Pointer to source data
- */
-const char *content_get_source_data(struct hlcache_handle *h,
- unsigned long *size);
-
-/**
- * Invalidate content reuse data.
- *
- * causes subsequent requests for content URL to query server to
- * determine if content can be reused. This is required behaviour for
- * forced reloads etc.
- *
- * \param h Content handle to invalidate.
- */
-void content_invalidate_reuse_data(struct hlcache_handle *h);
/**
* Retrieve the refresh URL for a content
@@ -434,13 +344,6 @@ void content_invalidate_reuse_data(struct hlcache_handle *h);
*/
struct nsurl *content_get_refresh_url(struct hlcache_handle *h);
-/**
- * Retrieve the bitmap contained in an image content
- *
- * \param h handle to the content.
- * \return Pointer to bitmap, or NULL if none.
- */
-struct bitmap *content_get_bitmap(struct hlcache_handle *h);
/**
* Determine if a content is opaque from handle
@@ -451,6 +354,7 @@ struct bitmap *content_get_bitmap(struct hlcache_handle *h);
*/
bool content_get_opaque(struct hlcache_handle *h);
+
/**
* Retrieve quirkiness of a content
*
@@ -459,14 +363,6 @@ bool content_get_opaque(struct hlcache_handle *h);
*/
bool content_get_quirks(struct hlcache_handle *h);
-/**
- * Retrieve the encoding of a content
- *
- * \param h handle to the content.
- * \param op encoding operation.
- * \return Pointer to content info or NULL if none.
- */
-const char *content_get_encoding(struct hlcache_handle *h, enum content_encoding_type op);
/**
* Return whether a content is currently locked
@@ -476,4 +372,7 @@ const char *content_get_encoding(struct hlcache_handle *h, enum content_encoding
*/
bool content_is_locked(struct hlcache_handle *h);
+
+
+
#endif
diff --git a/content/content_factory.h b/content/content_factory.h
index 22205dc02..9beeb193c 100644
--- a/content/content_factory.h
+++ b/content/content_factory.h
@@ -23,7 +23,7 @@
#include <libwapcaplet/libwapcaplet.h>
-#include "content/content_type.h"
+#include "netsurf/content_type.h"
#include "utils/errors.h"
#define CONTENT_FACTORY_REGISTER_TYPES(HNAME, HTYPELIST, HHANDLER) \
diff --git a/content/content_protected.h b/content/content_protected.h
index fb810bd07..ef38cb12d 100644
--- a/content/content_protected.h
+++ b/content/content_protected.h
@@ -26,29 +26,22 @@
#ifndef _NETSURF_CONTENT_CONTENT_PROTECTED_H_
#define _NETSURF_CONTENT_CONTENT_PROTECTED_H_
-#include <stdint.h>
-#include <time.h>
#include <stdio.h>
-#include "utils/config.h"
+#include "utils/nsurl.h"
+#include "netsurf/content_type.h"
#include "content/content.h"
-#include "content/content_factory.h"
-#include "content/llcache.h"
-#include "utils/errors.h"
-
-struct bitmap;
-struct content;
-struct rect;
-struct redraw_context;
+
+struct content_redraw_data;
struct http_parameter;
struct content_handler {
void (*fini)(void);
- nserror (*create)(const content_handler *handler,
+ nserror (*create)(const struct content_handler *handler,
lwc_string *imime_type,
const struct http_parameter *params,
- llcache_handle *llcache,
+ struct llcache_handle *llcache,
const char *fallback_charset, bool quirks,
struct content **c);
@@ -108,11 +101,11 @@ struct content_user
/** Corresponds to a single URL. */
struct content {
- llcache_handle *llcache; /**< Low-level cache object */
+ struct llcache_handle *llcache; /**< Low-level cache object */
lwc_string *mime_type; /**< Original MIME type of data */
- const content_handler *handler; /**< Handler for content */
+ const struct content_handler *handler; /**< Handler for content */
content_status status; /**< Current status. */
@@ -161,7 +154,7 @@ struct content {
extern const char * const content_type_name[];
extern const char * const content_status_name[];
-nserror content__init(struct content *c, const content_handler *handler,
+nserror content__init(struct content *c, const struct content_handler *handler,
lwc_string *imime_type, const struct http_parameter *params,
struct llcache_handle *llcache, const char *fallback_charset,
bool quirks);
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index 69ca0aed2..5fbdd225e 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -40,7 +40,6 @@
#include "content/fetch.h"
#include "content/fetchers.h"
#include "content/fetchers/about.h"
-#include "content/content_type.h"
#include "content/handlers/image/image_cache.h"
diff --git a/content/handlers/image/bmp.c b/content/handlers/image/bmp.c
index 114a551a6..8f787de37 100644
--- a/content/handlers/image/bmp.c
+++ b/content/handlers/image/bmp.c
@@ -28,10 +28,12 @@
#include "utils/utils.h"
#include "utils/messages.h"
-#include "content/content_protected.h"
-#include "desktop/gui_internal.h"
#include "netsurf/plotters.h"
#include "netsurf/bitmap.h"
+#include "netsurf/content.h"
+#include "content/llcache.h"
+#include "content/content_protected.h"
+#include "desktop/gui_internal.h"
#include "bmp.h"
diff --git a/content/handlers/image/gif.c b/content/handlers/image/gif.c
index 93970f96d..2a8ce3d20 100644
--- a/content/handlers/image/gif.c
+++ b/content/handlers/image/gif.c
@@ -39,10 +39,12 @@
#include "utils/utils.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
-#include "content/content_protected.h"
#include "netsurf/misc.h"
-#include "desktop/gui_internal.h"
#include "netsurf/bitmap.h"
+#include "netsurf/content.h"
+#include "content/llcache.h"
+#include "content/content_protected.h"
+#include "desktop/gui_internal.h"
#include "image.h"
#include "gif.h"
diff --git a/content/handlers/image/ico.c b/content/handlers/image/ico.c
index 5ea29bfab..7b1e1271c 100644
--- a/content/handlers/image/ico.c
+++ b/content/handlers/image/ico.c
@@ -27,9 +27,11 @@
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/messages.h"
+#include "netsurf/bitmap.h"
+#include "netsurf/content.h"
+#include "content/llcache.h"
#include "content/content_protected.h"
#include "desktop/gui_internal.h"
-#include "netsurf/bitmap.h"
#include "image.h"
#include "ico.h"
diff --git a/content/handlers/image/image.c b/content/handlers/image/image.c
index da5eea117..0b1ddc0e0 100644
--- a/content/handlers/image/image.c
+++ b/content/handlers/image/image.c
@@ -22,10 +22,10 @@
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/messages.h"
-#include "content/content.h"
#include "netsurf/plotters.h"
-#include "desktop/gui_internal.h"
#include "netsurf/bitmap.h"
+#include "netsurf/content.h"
+#include "desktop/gui_internal.h"
#include "bmp.h"
#include "gif.h"
diff --git a/content/handlers/image/image.h b/content/handlers/image/image.h
index eb9482583..dac586c34 100644
--- a/content/handlers/image/image.h
+++ b/content/handlers/image/image.h
@@ -25,6 +25,8 @@
#include "utils/errors.h"
+struct content_redraw_data;
+
/** Initialise the content handlers for image types.
*/
nserror image_init(void);
diff --git a/content/handlers/image/image_cache.c b/content/handlers/image/image_cache.c
index 4c008b7a9..dcb01dd87 100644
--- a/content/handlers/image/image_cache.c
+++ b/content/handlers/image/image_cache.c
@@ -25,10 +25,11 @@
#include "utils/utils.h"
#include "utils/log.h"
-#include "content/content_protected.h"
#include "netsurf/misc.h"
-#include "desktop/gui_internal.h"
#include "netsurf/bitmap.h"
+#include "content/llcache.h"
+#include "content/content_protected.h"
+#include "desktop/gui_internal.h"
#include "image_cache.h"
#include "image.h"
diff --git a/content/handlers/image/image_cache.h b/content/handlers/image/image_cache.h
index 2f1a5caee..d57a3a956 100644
--- a/content/handlers/image/image_cache.h
+++ b/content/handlers/image/image_cache.h
@@ -38,6 +38,7 @@
#define NETSURF_IMAGE_IMAGE_CACHE_H_
#include "utils/errors.h"
+#include "netsurf/content_type.h"
struct content_redraw_data;
struct redraw_context;
diff --git a/content/handlers/image/jpeg.c b/content/handlers/image/jpeg.c
index 179b8fc5b..e3af00f9f 100644
--- a/content/handlers/image/jpeg.c
+++ b/content/handlers/image/jpeg.c
@@ -30,9 +30,10 @@
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/messages.h"
+#include "netsurf/bitmap.h"
+#include "content/llcache.h"
#include "content/content_protected.h"
#include "desktop/gui_internal.h"
-#include "netsurf/bitmap.h"
#include "image_cache.h"
diff --git a/content/handlers/image/nssprite.c b/content/handlers/image/nssprite.c
index 8912f8356..9c4717fd6 100644
--- a/content/handlers/image/nssprite.c
+++ b/content/handlers/image/nssprite.c
@@ -28,10 +28,12 @@
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/messages.h"
-#include "content/content_protected.h"
-#include "desktop/gui_internal.h"
#include "netsurf/plotters.h"
#include "netsurf/bitmap.h"
+#include "netsurf/content.h"
+#include "content/llcache.h"
+#include "content/content_protected.h"
+#include "desktop/gui_internal.h"
#include "nssprite.h"
@@ -62,7 +64,7 @@ typedef struct nssprite_content {
static nserror nssprite_create(const content_handler *handler,
lwc_string *imime_type, const struct http_parameter *params,
- llcache_handle *llcache, const char *fallback_charset,
+ struct llcache_handle *llcache, const char *fallback_charset,
bool quirks, struct content **c)
{
nssprite_content *sprite;
diff --git a/content/handlers/image/png.c b/content/handlers/image/png.c
index 04083d8a4..45f415a6b 100644
--- a/content/handlers/image/png.c
+++ b/content/handlers/image/png.c
@@ -25,9 +25,10 @@
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/messages.h"
+#include "netsurf/bitmap.h"
+#include "content/llcache.h"
#include "content/content_protected.h"
#include "desktop/gui_internal.h"
-#include "netsurf/bitmap.h"
#include "image_cache.h"
#include "png.h"
@@ -277,10 +278,14 @@ static nserror nspng_create_png_data(nspng_content *png_c)
return NSERROR_OK;
}
-static nserror nspng_create(const content_handler *handler,
- lwc_string *imime_type, const struct http_parameter *params,
- llcache_handle *llcache, const char *fallback_charset,
- bool quirks, struct content **c)
+static nserror
+nspng_create(const content_handler *handler,
+ lwc_string *imime_type,
+ const struct http_parameter *params,
+ struct llcache_handle *llcache,
+ const char *fallback_charset,
+ bool quirks,
+ struct content **c)
{
nspng_content *png_c;
nserror error;
diff --git a/content/handlers/image/svg.c b/content/handlers/image/svg.c
index 82c85ac4c..b4532646c 100644
--- a/content/handlers/image/svg.c
+++ b/content/handlers/image/svg.c
@@ -29,8 +29,9 @@
#include "utils/messages.h"
#include "utils/utils.h"
-#include "content/content_protected.h"
#include "netsurf/plotters.h"
+#include "netsurf/content.h"
+#include "content/content_protected.h"
#include "svg.h"
@@ -71,7 +72,7 @@ no_memory:
static nserror svg_create(const content_handler *handler,
lwc_string *imime_type, const struct http_parameter *params,
- llcache_handle *llcache, const char *fallback_charset,
+ struct llcache_handle *llcache, const char *fallback_charset,
bool quirks, struct content **c)
{
svg_content *svg;
diff --git a/content/hlcache.c b/content/hlcache.c
index 65210d5a8..042e1895e 100644
--- a/content/hlcache.c
+++ b/content/hlcache.c
@@ -30,9 +30,9 @@
#include "utils/ring.h"
#include "utils/utils.h"
#include "netsurf/misc.h"
+#include "netsurf/content.h"
#include "desktop/gui_internal.h"
-#include "content/content.h"
#include "content/mimesniff.h"
#include "content/hlcache.h"
diff --git a/content/hlcache.h b/content/hlcache.h
index e0bf4161d..0dd102062 100644
--- a/content/hlcache.h
+++ b/content/hlcache.h
@@ -175,12 +175,5 @@ struct content *hlcache_handle_get_content(const hlcache_handle *handle);
*/
nserror hlcache_handle_clone(hlcache_handle *handle, hlcache_handle **result);
-/**
- * Retrieve the URL associated with a high level cache handle
- *
- * \param handle The handle to inspect
- * \return Pointer to URL.
- */
-nsurl *hlcache_handle_get_url(const hlcache_handle *handle);
#endif
diff --git a/content/urldb.h b/content/urldb.h
index d7ca8b0f8..ddbac6a00 100644
--- a/content/urldb.h
+++ b/content/urldb.h
@@ -25,8 +25,9 @@
#include <stdbool.h>
#include <time.h>
+
#include "utils/nsurl.h"
-#include "content/content_type.h"
+#include "netsurf/content_type.h"
typedef enum {
COOKIE_NETSCAPE = 0,
diff --git a/desktop/browser.c b/desktop/browser.c
index c0db76abc..47b7341eb 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -47,7 +47,10 @@
#include "utils/utils.h"
#include "utils/utf8.h"
#include "utils/nsoption.h"
-#include "content/content.h"
+#include "netsurf/misc.h"
+#include "netsurf/window.h"
+#include "netsurf/content.h"
+#include "netsurf/plotters.h"
#include "content/content_debug.h"
#include "content/fetch.h"
#include "content/hlcache.h"
@@ -68,10 +71,7 @@
#include "desktop/knockout.h"
#include "desktop/scrollbar.h"
#include "desktop/selection.h"
-#include "netsurf/plotters.h"
#include "desktop/theme.h"
-#include "netsurf/misc.h"
-#include "netsurf/window.h"
#include "desktop/gui_internal.h"
diff --git a/desktop/browser_history.c b/desktop/browser_history.c
index a8c8ee041..5cd98cde6 100644
--- a/desktop/browser_history.c
+++ b/desktop/browser_history.c
@@ -29,18 +29,17 @@
#include <time.h>
#include "utils/log.h"
-#include "utils/nsurl.h"
#include "utils/utils.h"
-#include "content/content.h"
+#include "netsurf/layout.h"
+#include "netsurf/plotters.h"
+#include "netsurf/content.h"
#include "content/hlcache.h"
#include "content/urldb.h"
#include "netsurf/bitmap.h"
-#include "netsurf/layout.h"
#include "desktop/gui_internal.h"
#include "desktop/browser_history.h"
#include "desktop/browser_private.h"
-#include "netsurf/plotters.h"
#define WIDTH 100
#define HEIGHT 86
diff --git a/desktop/browser_private.h b/desktop/browser_private.h
index 2641a0e44..64c698beb 100644
--- a/desktop/browser_private.h
+++ b/desktop/browser_private.h
@@ -28,6 +28,7 @@
#include "netsurf/browser_window.h"
#include "desktop/frame_types.h"
+#include "desktop/plot_style.h"
struct box;
struct hlcache_handle;
diff --git a/desktop/frames.c b/desktop/frames.c
index 7be75ce77..70e51e754 100644
--- a/desktop/frames.c
+++ b/desktop/frames.c
@@ -29,18 +29,17 @@
#include <time.h>
#include <math.h>
-#include "utils/config.h"
-#include "content/hlcache.h"
-#include "desktop/browser_private.h"
-#include "desktop/frames.h"
-#include "desktop/scrollbar.h"
-#include "desktop/selection.h"
#include "utils/log.h"
-#include "utils/messages.h"
#include "utils/utils.h"
+#include "netsurf/content.h"
+#include "content/hlcache.h"
#include "render/html.h"
#include "render/box.h"
+#include "desktop/browser_private.h"
+#include "desktop/frames.h"
+#include "desktop/scrollbar.h"
+
/** maximum frame resize margin */
#define FRAME_RESIZE 6
@@ -98,7 +97,7 @@ void browser_window_scroll_callback(void *client_data,
/* exported interface, documented in browser.h */
void browser_window_handle_scrollbars(struct browser_window *bw)
{
- hlcache_handle *h = bw->current_content;
+ struct hlcache_handle *h = bw->current_content;
bool scroll_x;
bool scroll_y;
int c_width = 0;
@@ -380,8 +379,8 @@ nserror browser_window_create_frameset(struct browser_window *bw,
/* Use the URL of the first ancestor window containing html content
* as the referer */
for (window = bw; window->parent; window = window->parent) {
- if (window->current_content &&
- content_get_type(window->current_content) ==
+ if (window->current_content &&
+ content_get_type(window->current_content) ==
CONTENT_HTML)
break;
}
diff --git a/desktop/print.c b/desktop/print.c
index 8daec887c..2d9a0d5f9 100644
--- a/desktop/print.c
+++ b/desktop/print.c
@@ -30,12 +30,12 @@
#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/talloc.h"
-#include "content/content.h"
+#include "netsurf/content.h"
+#include "netsurf/plotters.h"
#include "content/hlcache.h"
#include "content/handlers/css/utils.h"
#include "render/box.h"
-#include "netsurf/plotters.h"
#include "desktop/print.h"
#include "desktop/printer.h"
@@ -44,11 +44,8 @@
#define DEFAULT_PAGE_HEIGHT 840
#define DEFAULT_COPIES 1
-static hlcache_handle *print_init(hlcache_handle *, struct print_settings *);
-static bool print_apply_settings(hlcache_handle *, struct print_settings *);
-
static float page_content_width, page_content_height;
-static hlcache_handle *printed_content;
+static struct hlcache_handle *printed_content;
static float done_height;
bool html_redraw_printing = false;
@@ -71,7 +68,7 @@ bool print_basic_run(hlcache_handle *content,
bool ret = true;
assert(content != NULL && printer != NULL && settings != NULL);
-
+
if (print_set_up(content, printer, settings, NULL))
return false;
@@ -80,10 +77,62 @@ bool print_basic_run(hlcache_handle *content,
}
print_cleanup(content, printer, settings);
-
+
return ret;
}
+
+/**
+ * The content passed to the function is duplicated with its boxes, font
+ * measuring functions are being set.
+ *
+ * \param content The content to be printed
+ * \param settings The settings for printing to use
+ * \return true if successful, false otherwise
+ */
+static struct hlcache_handle *
+print_init(struct hlcache_handle *content, struct print_settings *settings)
+{
+ struct hlcache_handle* printed_content;
+
+ hlcache_handle_clone(content, &printed_content);
+
+ return printed_content;
+}
+
+
+/**
+ * The content is resized to fit page width.
+ *
+ * \param content The content to be printed
+ * \param settings The settings for printing to use
+ * \return true if successful, false otherwise
+ */
+static bool
+print_apply_settings(hlcache_handle *content, struct print_settings *settings)
+{
+ if (settings == NULL)
+ return false;
+
+ /* Apply settings - adjust page size etc */
+
+ page_content_width = (settings->page_width -
+ FIXTOFLT(FSUB(settings->margins[MARGINLEFT],
+ settings->margins[MARGINRIGHT]))) / settings->scale;
+
+ page_content_height = (settings->page_height -
+ FIXTOFLT(FSUB(settings->margins[MARGINTOP],
+ settings->margins[MARGINBOTTOM]))) / settings->scale;
+
+ content_reformat(content, false, page_content_width, 0);
+
+ LOG("New layout applied.New height = %d ; New width = %d ",
+ content_get_height(content), content_get_width(content));
+
+ return true;
+}
+
+
/**
* This function prepares the content to be printed. The current browser content
* is duplicated and resized, printer initialization is called.
@@ -99,20 +148,20 @@ bool print_set_up(hlcache_handle *content,
double *height)
{
printed_content = print_init(content, settings);
-
+
if (printed_content == NULL)
return false;
-
+
print_apply_settings(printed_content, settings);
if (height)
*height = content_get_height(printed_content);
-
+
printer->print_begin(settings);
done_height = 0;
-
- return true;
+
+ return true;
}
/**
@@ -158,59 +207,12 @@ bool print_draw_next_page(const struct printer *printer,
done_height += page_content_height -
(html_redraw_printing_top_cropped != INT_MAX ?
- clip.y1 - html_redraw_printing_top_cropped : 0) /
+ clip.y1 - html_redraw_printing_top_cropped : 0) /
settings->scale;
return true;
}
-/**
- * The content passed to the function is duplicated with its boxes, font
- * measuring functions are being set.
- *
- * \param content The content to be printed
- * \param settings The settings for printing to use
- * \return true if successful, false otherwise
- */
-hlcache_handle *print_init(hlcache_handle *content,
- struct print_settings *settings)
-{
- hlcache_handle* printed_content;
-
- hlcache_handle_clone(content, &printed_content);
-
- return printed_content;
-}
-
-/**
- * The content is resized to fit page width.
- *
- * \param content The content to be printed
- * \param settings The settings for printing to use
- * \return true if successful, false otherwise
- */
-bool print_apply_settings(hlcache_handle *content,
- struct print_settings *settings)
-{
- if (settings == NULL)
- return false;
-
- /* Apply settings - adjust page size etc */
-
- page_content_width = (settings->page_width -
- FIXTOFLT(FSUB(settings->margins[MARGINLEFT],
- settings->margins[MARGINRIGHT]))) / settings->scale;
-
- page_content_height = (settings->page_height -
- FIXTOFLT(FSUB(settings->margins[MARGINTOP],
- settings->margins[MARGINBOTTOM]))) / settings->scale;
-
- content_reformat(content, false, page_content_width, 0);
-
- LOG("New layout applied.New height = %d ; New width = %d ", content_get_height(content), content_get_width(content));
-
- return true;
-}
/**
* Memory allocated during printing is being freed here.
@@ -224,16 +226,16 @@ bool print_cleanup(hlcache_handle *content, const struct printer *printer,
struct print_settings *settings)
{
printer->print_end();
-
+
html_redraw_printing = false;
-
+
if (printed_content) {
hlcache_handle_release(printed_content);
}
-
+
free((void *)settings->output);
free(settings);
-
+
return true;
}
@@ -252,57 +254,57 @@ struct print_settings *print_make_settings(print_configuration configuration,
struct print_settings *settings;
css_fixed length = 0;
css_unit unit = CSS_UNIT_MM;
-
+
switch (configuration){
- case PRINT_DEFAULT:
- settings = (struct print_settings*)
+ case PRINT_DEFAULT:
+ settings = (struct print_settings*)
malloc(sizeof(struct print_settings));
if (settings == NULL)
return NULL;
-
+
settings->page_width = DEFAULT_PAGE_WIDTH;
settings->page_height = DEFAULT_PAGE_HEIGHT;
settings->copies = DEFAULT_COPIES;
settings->scale = DEFAULT_EXPORT_SCALE;
-
+
length = INTTOFIX(DEFAULT_MARGIN_LEFT_MM);
- settings->margins[MARGINLEFT] =
+ settings->margins[MARGINLEFT] =
nscss_len2px(length, unit, NULL);
length = INTTOFIX(DEFAULT_MARGIN_RIGHT_MM);
- settings->margins[MARGINRIGHT] =
+ settings->margins[MARGINRIGHT] =
nscss_len2px(length, unit, NULL);
length = INTTOFIX(DEFAULT_MARGIN_TOP_MM);
- settings->margins[MARGINTOP] =
+ settings->margins[MARGINTOP] =
nscss_len2px(length, unit, NULL);
length = INTTOFIX(DEFAULT_MARGIN_BOTTOM_MM);
- settings->margins[MARGINBOTTOM] =
+ settings->margins[MARGINBOTTOM] =
nscss_len2px(length, unit, NULL);
break;
/* use settings from the Export options tab */
case PRINT_OPTIONS:
- settings = (struct print_settings*)
+ settings = (struct print_settings*)
malloc(sizeof(struct print_settings));
if (settings == NULL)
return NULL;
-
+
settings->page_width = DEFAULT_PAGE_WIDTH;
settings->page_height = DEFAULT_PAGE_HEIGHT;
settings->copies = DEFAULT_COPIES;
-
+
settings->scale = (float)nsoption_int(export_scale) / 100;
-
+
length = INTTOFIX(nsoption_int(margin_left));
- settings->margins[MARGINLEFT] =
+ settings->margins[MARGINLEFT] =
nscss_len2px(length, unit, NULL);
length = INTTOFIX(nsoption_int(margin_right));
- settings->margins[MARGINRIGHT] =
+ settings->margins[MARGINRIGHT] =
nscss_len2px(length, unit, NULL);
length = INTTOFIX(nsoption_int(margin_top));
- settings->margins[MARGINTOP] =
+ settings->margins[MARGINTOP] =
nscss_len2px(length, unit, NULL);
length = INTTOFIX(nsoption_int(margin_bottom));
- settings->margins[MARGINBOTTOM] =
+ settings->margins[MARGINBOTTOM] =
nscss_len2px(length, unit, NULL);
break;
default:
@@ -319,9 +321,9 @@ struct print_settings *print_make_settings(print_configuration configuration,
free(settings);
return NULL;
}
- } else
+ } else {
settings->output = NULL;
+ }
- return settings;
+ return settings;
}
-
diff --git a/desktop/save_complete.c b/desktop/save_complete.c
index 201e80b0d..a1c71a4e0 100644
--- a/desktop/save_complete.c
+++ b/desktop/save_complete.c
@@ -17,8 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * Save HTML document with dependencies (implementation).
+/**
+ * \file
+ * Save HTML document with dependencies implementation.
*/
#include <assert.h>
@@ -39,7 +40,7 @@
#include "utils/utils.h"
#include "utils/file.h"
#include "utils/messages.h"
-#include "content/content.h"
+#include "netsurf/content.h"
#include "content/hlcache.h"
#include "content/handlers/css/css.h"
#include "render/box.h"
@@ -53,7 +54,7 @@ regex_t save_complete_import_re;
/** An entry in save_complete_list. */
typedef struct save_complete_entry {
- hlcache_handle *content;
+ struct hlcache_handle *content;
struct save_complete_entry *next; /**< Next entry in list */
} save_complete_entry;
@@ -73,7 +74,7 @@ typedef enum {
} save_complete_event_type;
-static bool save_complete_save_html(save_complete_ctx *ctx, hlcache_handle *c,
+static bool save_complete_save_html(save_complete_ctx *ctx, struct hlcache_handle *c,
bool index);
static bool save_complete_save_imported_sheets(save_complete_ctx *ctx,
struct nscss_import *imports, uint32_t import_count);
@@ -99,7 +100,7 @@ static void save_complete_ctx_finalise(save_complete_ctx *ctx)
}
static bool save_complete_ctx_add_content(save_complete_ctx *ctx,
- hlcache_handle *content)
+ struct hlcache_handle *content)
{
save_complete_entry *entry;
@@ -114,24 +115,32 @@ static bool save_complete_ctx_add_content(save_complete_ctx *ctx,
return true;
}
-
-static hlcache_handle *save_complete_ctx_find_content(save_complete_ctx *ctx,
- const nsurl *url)
+/**
+ * find handle to content for url
+ *
+ * \param ctx The save context
+ * \param url The url to find content handle for
+ * \return The content handle or NULL if not found.
+ */
+static struct hlcache_handle *
+save_complete_ctx_find_content(save_complete_ctx *ctx, const nsurl *url)
{
save_complete_entry *entry;
- for (entry = ctx->list; entry != NULL; entry = entry->next)
+ for (entry = ctx->list; entry != NULL; entry = entry->next) {
if (nsurl_compare(url,
- hlcache_handle_get_url(entry->content),
- NSURL_COMPLETE))
+ hlcache_handle_get_url(entry->content),
+ NSURL_COMPLETE)) {
return entry->content;
+ }
+ }
return NULL;
}
static bool save_complete_ctx_has_content(save_complete_ctx *ctx,
- hlcache_handle *content)
+ struct hlcache_handle *content)
{
save_complete_entry *entry;
diff --git a/desktop/save_text.c b/desktop/save_text.c
index dee1c91e8..e63c96eb9 100644
--- a/desktop/save_text.c
+++ b/desktop/save_text.c
@@ -31,8 +31,7 @@
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/utils.h"
-#include "content/content.h"
-#include "content/hlcache.h"
+#include "netsurf/content.h"
#include "render/box.h"
#include "render/html.h"
@@ -55,7 +54,7 @@ static bool save_text_add_to_buffer(const char *text, size_t length,
* \param path Path to save text file too.
*/
-void save_as_text(hlcache_handle *c, char *path)
+void save_as_text(struct hlcache_handle *c, char *path)
{
FILE *out;
struct save_text_state save = { NULL, 0, 0 };
diff --git a/desktop/searchweb.c b/desktop/searchweb.c
index 83a19c31e..41ba062fa 100644
--- a/desktop/searchweb.c
+++ b/desktop/searchweb.c
@@ -27,6 +27,7 @@
#include "utils/log.h"
#include "utils/url.h"
#include "utils/nsoption.h"
+#include "netsurf/content.h"
#include "content/hlcache.h"
#include "desktop/searchweb.h"
diff --git a/desktop/treeview.c b/desktop/treeview.c
index 4fa0544c5..05124193b 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -23,7 +23,9 @@
*/
#include "utils/log.h"
+#include "utils/nsurl.h"
#include "netsurf/bitmap.h"
+#include "netsurf/content.h"
#include "content/hlcache.h"
#include "content/handlers/css/utils.h"
@@ -3634,8 +3636,10 @@ static void treeview_init_plot_styles(int font_pt_size)
/**
* Callback for hlcache.
*/
-static nserror treeview_res_cb(hlcache_handle *handle,
- const hlcache_event *event, void *pw)
+static nserror
+treeview_res_cb(struct hlcache_handle *handle,
+ const hlcache_event *event,
+ void *pw)
{
struct treeview_resource *r = pw;
diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c
index 6f2ca0c1b..14c0ad770 100644
--- a/frontends/amiga/arexx.c
+++ b/frontends/amiga/arexx.c
@@ -32,7 +32,7 @@
#include "utils/log.h"
#include "utils/nsoption.h"
#include "utils/nsurl.h"
-#include "content/hlcache.h"
+#include "netsurf/content.h"
#include "netsurf/browser_window.h"
#include "desktop/version.h"
@@ -331,7 +331,7 @@ STATIC VOID rx_save(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unu
if((fh = FOpen((char *)cmd->ac_ArgList[0], MODE_NEWFILE, 0)))
{
- hlcache_handle *h = browser_window_get_content(gw->bw);
+ struct hlcache_handle *h = browser_window_get_content(gw->bw);
if((source_data = content_get_source_data(h, &source_size)))
FWrite(fh, source_data, 1, source_size);
diff --git a/frontends/amiga/bitmap.c b/frontends/amiga/bitmap.c
index 8d1815298..badd37438 100644
--- a/frontends/amiga/bitmap.c
+++ b/frontends/amiga/bitmap.c
@@ -19,6 +19,7 @@
#include "amiga/os3support.h"
#include <stdlib.h>
+#include <string.h>
#include <proto/exec.h>
#ifdef __amigaos4__
#include <graphics/blitattr.h>
@@ -46,8 +47,8 @@
#include "utils/nsoption.h"
#include "utils/nsurl.h"
#include "utils/messages.h"
-#include "content/hlcache.h"
#include "netsurf/bitmap.h"
+#include "netsurf/content.h"
#include "amiga/gui.h"
#include "amiga/bitmap.h"
@@ -596,7 +597,7 @@ void ami_bitmap_fini(void)
pool_bitmap = NULL;
}
-static nserror bitmap_render(struct bitmap *bitmap, hlcache_handle *content)
+static nserror bitmap_render(struct bitmap *bitmap, struct hlcache_handle *content)
{
#ifdef __amigaos4__
struct redraw_context ctx = {
diff --git a/frontends/amiga/clipboard.c b/frontends/amiga/clipboard.c
index 3a96456c6..1b87f5b57 100644
--- a/frontends/amiga/clipboard.c
+++ b/frontends/amiga/clipboard.c
@@ -30,7 +30,7 @@
#include "utils/nsoption.h"
#include "utils/utf8.h"
#include "utils/nsurl.h"
-#include "content/hlcache.h"
+#include "netsurf/content.h"
#include "netsurf/browser_window.h"
#include "netsurf/plotters.h"
#include "desktop/textinput.h"
diff --git a/frontends/amiga/ctxmenu.c b/frontends/amiga/ctxmenu.c
index f9c873cff..a68819298 100644
--- a/frontends/amiga/ctxmenu.c
+++ b/frontends/amiga/ctxmenu.c
@@ -40,10 +40,10 @@
#include "utils/messages.h"
#include "utils/nsoption.h"
#include "utils/nsurl.h"
-#include "content/hlcache.h"
+#include "netsurf/content.h"
#include "netsurf/browser_window.h"
-#include "desktop/browser_history.h"
#include "netsurf/mouse.h"
+#include "desktop/browser_history.h"
#include "desktop/searchweb.h"
#include "desktop/textinput.h"
diff --git a/frontends/amiga/download.c b/frontends/amiga/download.c
index b9fecf362..93536f494 100644
--- a/frontends/amiga/download.c
+++ b/frontends/amiga/download.c
@@ -48,13 +48,13 @@
#include "utils/utils.h"
#include "utils/nsoption.h"
#include "utils/string.h"
-#include "desktop/download.h"
-#include "desktop/save_complete.h"
#include "netsurf/browser_window.h"
#include "netsurf/mouse.h"
#include "netsurf/window.h"
#include "netsurf/download.h"
#include "content/handlers/image/ico.h"
+#include "desktop/download.h"
+#include "desktop/save_complete.h"
#include "amiga/gui.h"
#include "amiga/download.h"
diff --git a/frontends/amiga/drag.c b/frontends/amiga/drag.c
index b653be815..92617dd13 100644
--- a/frontends/amiga/drag.c
+++ b/frontends/amiga/drag.c
@@ -34,8 +34,8 @@
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/nsoption.h"
-#include "content/hlcache.h"
#include "netsurf/mouse.h"
+#include "netsurf/content.h"
#include "amiga/bitmap.h"
#include "amiga/clipboard.h"
@@ -178,7 +178,7 @@ void ami_drag_save(struct Window *win)
case GUI_SAVE_OBJECT_NATIVE:
{
- hlcache_handle *c = drag_save_data;
+ struct hlcache_handle *c = drag_save_data;
AddPart(path, content_get_title(c), 1024);
ami_file_save(AMINS_SAVE_IFF, path, win, c, NULL, NULL);
diff --git a/frontends/amiga/dt_anim.c b/frontends/amiga/dt_anim.c
index 04f1ce27d..19467882a 100644
--- a/frontends/amiga/dt_anim.c
+++ b/frontends/amiga/dt_anim.c
@@ -37,9 +37,11 @@
#include "utils/log.h"
#include "utils/messages.h"
-#include "content/content_protected.h"
#include "netsurf/plotters.h"
#include "netsurf/bitmap.h"
+#include "netsurf/content.h"
+#include "content/content_protected.h"
+#include "content/llcache.h"
#include "amiga/bitmap.h"
#include "amiga/filetype.h"
diff --git a/frontends/amiga/dt_picture.c b/frontends/amiga/dt_picture.c
index 49dde5e67..e7f1c9724 100644
--- a/frontends/amiga/dt_picture.c
+++ b/frontends/amiga/dt_picture.c
@@ -33,9 +33,10 @@
#include "utils/log.h"
#include "utils/messages.h"
-#include "content/content_protected.h"
#include "netsurf/plotters.h"
#include "netsurf/bitmap.h"
+#include "content/llcache.h"
+#include "content/content_protected.h"
#include "content/handlers/image/image_cache.h"
#include "amiga/bitmap.h"
diff --git a/frontends/amiga/dt_sound.c b/frontends/amiga/dt_sound.c
index 04486c1fb..55fc60d61 100644
--- a/frontends/amiga/dt_sound.c
+++ b/frontends/amiga/dt_sound.c
@@ -23,20 +23,24 @@
#ifdef WITH_AMIGA_DATATYPES
#include "amiga/os3support.h"
-#include "amiga/filetype.h"
-#include "amiga/datatypes.h"
-#include "content/content_protected.h"
-#include "netsurf/plotters.h"
-#include "render/box.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-
#include <proto/datatypes.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <datatypes/soundclass.h>
#include <intuition/classusr.h>
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "netsurf/plotters.h"
+#include "netsurf/content.h"
+#include "render/box.h"
+#include "content/llcache.h"
+#include "content/content_protected.h"
+
+#include "amiga/filetype.h"
+#include "amiga/datatypes.h"
+
+
typedef struct amiga_dt_sound_content {
struct content base;
diff --git a/frontends/amiga/file.c b/frontends/amiga/file.c
index 595a981f9..1bba30eb3 100644
--- a/frontends/amiga/file.c
+++ b/frontends/amiga/file.c
@@ -26,14 +26,12 @@
#include "utils/nsoption.h"
#include "utils/file.h"
#include "utils/messages.h"
-#include "content/hlcache.h"
-#include "content/content.h"
-#include "content/fetch.h"
+#include "utils/nsurl.h"
#include "netsurf/browser_window.h"
+#include "netsurf/content.h"
#include "desktop/save_complete.h"
#include "desktop/save_pdf.h"
#include "desktop/save_text.h"
-#include "netsurf/window.h"
#include "amiga/gui.h"
#include "amiga/bitmap.h"
diff --git a/frontends/amiga/filetype.c b/frontends/amiga/filetype.c
index d598f530c..05f130e66 100644
--- a/frontends/amiga/filetype.c
+++ b/frontends/amiga/filetype.c
@@ -20,19 +20,20 @@
#include <stdlib.h>
#include <string.h>
-#include "amiga/filetype.h"
-#include "amiga/misc.h"
-#include "amiga/object.h"
-#include "content/fetch.h"
-#include "content/content.h"
-#include "utils/log.h"
-#include "utils/utils.h"
#include <proto/icon.h>
#include <proto/dos.h>
#include <proto/datatypes.h>
#include <proto/exec.h>
#include <workbench/icon.h>
+#include "netsurf/content.h"
+#include "utils/log.h"
+#include "utils/utils.h"
+
+#include "amiga/filetype.h"
+#include "amiga/misc.h"
+#include "amiga/object.h"
+
/**
* filetype -- determine the MIME type of a local file
*/
diff --git a/frontends/amiga/filetype.h b/frontends/amiga/filetype.h
index fc27b1df2..52fdf9cb5 100644
--- a/frontends/amiga/filetype.h
+++ b/frontends/amiga/filetype.h
@@ -18,12 +18,14 @@
#ifndef AMIGA_FILETYPE_H
#define AMIGA_FILETYPE_H
+
#include <stdbool.h>
#include <libwapcaplet/libwapcaplet.h>
-#include "content/content_type.h"
-#include "utils/errors.h"
#include <datatypes/datatypes.h>
+#include "netsurf/content_type.h"
+#include "utils/errors.h"
+
struct hlcache_handle;
struct ami_mime_entry;
diff --git a/frontends/amiga/gui.c b/frontends/amiga/gui.c
index f285d9669..9bd1cd4d0 100644
--- a/frontends/amiga/gui.c
+++ b/frontends/amiga/gui.c
@@ -86,6 +86,7 @@
/* newlib includes */
#include <math.h>
#include <string.h>
+#include <stdlib.h>
/* NetSurf core includes */
#include "utils/log.h"
@@ -95,26 +96,24 @@
#include "utils/utils.h"
#include "utils/nsurl.h"
#include "utils/file.h"
-#include "content/hlcache.h"
+#include "netsurf/window.h"
+#include "netsurf/fetch.h"
+#include "netsurf/misc.h"
+#include "netsurf/mouse.h"
+#include "netsurf/netsurf.h"
+#include "netsurf/content.h"
+#include "netsurf/browser_window.h"
#include "content/backing_store.h"
#include "content/fetchers.h"
-#include "content/fetchers/resource.h"
#include "content/urldb.h"
-#include "content/handlers/image/ico.h"
#include "desktop/browser_history.h"
-#include "netsurf/browser_window.h"
#include "desktop/hotlist.h"
-#include "netsurf/mouse.h"
-#include "netsurf/netsurf.h"
#include "desktop/version.h"
#include "desktop/save_complete.h"
#include "desktop/scrollbar.h"
#include "desktop/searchweb.h"
#include "desktop/textinput.h"
#include "desktop/tree.h"
-#include "netsurf/window.h"
-#include "netsurf/fetch.h"
-#include "netsurf/misc.h"
/* NetSurf Amiga platform includes */
#include "amiga/gui.h"
@@ -848,12 +847,14 @@ static struct RDArgs *ami_gui_commandline(int *argc, char **argv, int *nargc, ch
if((args = ReadArgs(template, rarray, NULL))) {
if(rarray[A_URL]) {
- LOG("URL %s specified on command line", rarray[A_URL]);
+ LOG("URL %s specified on command line",
+ (char *)rarray[A_URL]);
temp_homepage_url = ami_to_utf8_easy((char *)rarray[A_URL]);
}
if(rarray[A_USERSDIR]) {
- LOG("USERSDIR %s specified on command line", rarray[A_USERSDIR]);
+ LOG("USERSDIR %s specified on command line",
+ (char *)rarray[A_USERSDIR]);
users_dir = ASPrintf("%s", rarray[A_USERSDIR]);
}
@@ -1751,7 +1752,7 @@ static void ami_gui_scroller_update(struct gui_window_2 *gwin)
/**
* function to add retrieved favicon to gui
*/
-static void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
+static void gui_window_set_icon(struct gui_window *g, struct hlcache_handle *icon)
{
struct BitMap *bm = NULL;
struct IBox *bbox;
@@ -5216,7 +5217,7 @@ static void gui_window_remove_caret(struct gui_window *g)
static void gui_window_new_content(struct gui_window *g)
{
- hlcache_handle *c;
+ struct hlcache_handle *c;
if(g && g->shared && g->bw && browser_window_has_content(g->bw))
c = browser_window_get_content(g->bw);
@@ -5399,7 +5400,7 @@ void ami_gui_splash_close(Object *win_obj)
DisposeObject(win_obj);
}
-static void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
+static void gui_file_gadget_open(struct gui_window *g, struct hlcache_handle *hl,
struct form_control *gadget)
{
LOG("File open dialog request for %p/%p", g, gadget);
diff --git a/frontends/amiga/gui_options.c b/frontends/amiga/gui_options.c
index 340af4b27..4e6914c6a 100755
--- a/frontends/amiga/gui_options.c
+++ b/frontends/amiga/gui_options.c
@@ -78,6 +78,7 @@
#include "amiga/selectmenu.h"
#include "amiga/theme.h"
#include "amiga/utf8.h"
+#include "amiga/plotters.h"
enum
{
diff --git a/frontends/amiga/icon.c b/frontends/amiga/icon.c
index f19797676..9e441d8d7 100644
--- a/frontends/amiga/icon.c
+++ b/frontends/amiga/icon.c
@@ -43,6 +43,7 @@
#include "utils/file.h"
#include "netsurf/plotters.h"
#include "netsurf/bitmap.h"
+#include "netsurf/content.h"
#include "content/content_protected.h"
#include "amiga/os3support.h"
@@ -66,7 +67,7 @@ typedef struct amiga_icon_content {
static nserror amiga_icon_create(const content_handler *handler,
lwc_string *imime_type, const struct http_parameter *params,
- llcache_handle *llcache, const char *fallback_charset,
+ struct llcache_handle *llcache, const char *fallback_charset,
bool quirks, struct content **c);
static bool amiga_icon_convert(struct content *c);
static void amiga_icon_destroy(struct content *c);
@@ -104,7 +105,7 @@ CONTENT_FACTORY_REGISTER_TYPES(amiga_icon, amiga_icon_types,
nserror amiga_icon_create(const content_handler *handler,
lwc_string *imime_type, const struct http_parameter *params,
- llcache_handle *llcache, const char *fallback_charset,
+ struct llcache_handle *llcache, const char *fallback_charset,
bool quirks, struct content **c)
{
amiga_icon_content *ai_content;
diff --git a/frontends/amiga/iff_dr2d.c b/frontends/amiga/iff_dr2d.c
index d4e3b220c..966d2a6e3 100644
--- a/frontends/amiga/iff_dr2d.c
+++ b/frontends/amiga/iff_dr2d.c
@@ -26,10 +26,11 @@
#include <proto/dos.h>
#ifndef AMIGA_DR2D_STANDALONE
+#include "utils/nsurl.h"
+#include "netsurf/content.h"
#include "amiga/os3support.h"
#include "amiga/iff_dr2d.h"
#include "amiga/misc.h"
-#include "content/hlcache.h"
#else
#include "os3support.h"
#include "iff_dr2d.h"
diff --git a/frontends/amiga/menu.c b/frontends/amiga/menu.c
index e1017cd1f..636951ea3 100644
--- a/frontends/amiga/menu.c
+++ b/frontends/amiga/menu.c
@@ -47,11 +47,11 @@
#include "utils/log.h"
#include "utils/utils.h"
#include "utils/nsurl.h"
-#include "content/hlcache.h"
-#include "desktop/hotlist.h"
#include "netsurf/browser_window.h"
#include "netsurf/mouse.h"
#include "netsurf/window.h"
+#include "netsurf/content.h"
+#include "desktop/hotlist.h"
#include "desktop/textinput.h"
#include "desktop/version.h"
@@ -1076,7 +1076,7 @@ void ami_menu_update_checked(struct gui_window_2 *gwin)
ResetMenuStrip(gwin->win, menustrip);
}
-void ami_menu_update_disabled(struct gui_window *g, hlcache_handle *c)
+void ami_menu_update_disabled(struct gui_window *g, struct hlcache_handle *c)
{
struct Window *win = g->shared->win;
diff --git a/frontends/amiga/plugin_hack.c b/frontends/amiga/plugin_hack.c
index 19fa66cd5..7fe78b9b0 100644
--- a/frontends/amiga/plugin_hack.c
+++ b/frontends/amiga/plugin_hack.c
@@ -23,19 +23,20 @@
#include "amiga/os3support.h"
#include <stdlib.h>
+#include <proto/dos.h>
+#include <proto/exec.h>
+#include <proto/intuition.h>
+#include <proto/utility.h>
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "netsurf/plotters.h"
+#include "netsurf/content.h"
#include "amiga/filetype.h"
#include "amiga/plugin_hack.h"
#include "content/content_protected.h"
-#include "content/hlcache.h"
-#include "netsurf/plotters.h"
-#include "utils/log.h"
-#include "utils/messages.h"
+#include "content/llcache.h"
-#include <proto/dos.h>
-#include <proto/exec.h>
-#include <proto/intuition.h>
-#include <proto/utility.h>
typedef struct amiga_plugin_hack_content {
struct content base;
diff --git a/frontends/amiga/print.c b/frontends/amiga/print.c
index 007245c73..56d25703e 100644
--- a/frontends/amiga/print.c
+++ b/frontends/amiga/print.c
@@ -49,13 +49,14 @@
#include "utils/nsoption.h"
#include "utils/messages.h"
#include "utils/utils.h"
+#include "utils/nsurl.h"
#include "netsurf/plotters.h"
-#include "desktop/printer.h"
-#include "desktop/print.h"
#include "netsurf/layout.h"
#include "netsurf/mouse.h"
#include "netsurf/window.h"
-#include "content/hlcache.h"
+#include "netsurf/content.h"
+#include "desktop/printer.h"
+#include "desktop/print.h"
#include "amiga/plotters.h"
#include "amiga/font.h"
diff --git a/frontends/amiga/tree.c b/frontends/amiga/tree.c
index 7f7140c3a..7a6f8b3b5 100644
--- a/frontends/amiga/tree.c
+++ b/frontends/amiga/tree.c
@@ -53,13 +53,13 @@
#include "utils/nsoption.h"
#include "utils/utils.h"
#include "utils/messages.h"
+#include "netsurf/browser_window.h"
+#include "netsurf/window.h"
#include "content/urldb.h"
#include "content/llcache.h"
-#include "netsurf/browser_window.h"
#include "desktop/cookie_manager.h"
#include "desktop/global_history.h"
#include "desktop/hotlist.h"
-#include "netsurf/window.h"
#include "desktop/sslcert_viewer.h"
#include "amiga/gui.h"
diff --git a/frontends/atari/ctxmenu.c b/frontends/atari/ctxmenu.c
index e7420351e..f3f5f6dbb 100644
--- a/frontends/atari/ctxmenu.c
+++ b/frontends/atari/ctxmenu.c
@@ -19,9 +19,10 @@
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/nsoption.h"
+#include "utils/nsurl.h"
#include "netsurf/browser_window.h"
+#include "netsurf/content.h"
#include "desktop/textinput.h"
-#include "content/hlcache.h"
#include "atari/gui.h"
#include "atari/misc.h"
@@ -50,7 +51,7 @@ struct s_context_info ctxinfo;
static struct s_context_info * get_context_info( struct gui_window * gw, short mx, short my )
{
- hlcache_handle *h;
+ struct hlcache_handle *h;
GRECT area;
struct browser_window * bw = gw->browser->bw;
int sx, sy;
diff --git a/frontends/atari/gui.c b/frontends/atari/gui.c
index 24caa7c51..16cc3193f 100644
--- a/frontends/atari/gui.c
+++ b/frontends/atari/gui.c
@@ -29,11 +29,6 @@
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/corestrings.h"
-#include "content/urldb.h"
-#include "content/content.h"
-#include "content/backing_store.h"
-#include "content/hlcache.h"
-#include "desktop/treeview.h"
#include "netsurf/browser_window.h"
#include "netsurf/layout.h"
#include "netsurf/window.h"
@@ -41,6 +36,11 @@
#include "netsurf/fetch.h"
#include "netsurf/misc.h"
#include "netsurf/netsurf.h"
+#include "netsurf/content.h"
+#include "content/urldb.h"
+#include "content/backing_store.h"
+#include "content/hlcache.h"
+#include "desktop/treeview.h"
#include "atari/gemtk/gemtk.h"
#include "atari/gui.h"
diff --git a/frontends/beos/bitmap.cpp b/frontends/beos/bitmap.cpp
index 4ce40750c..1b73967c5 100644
--- a/frontends/beos/bitmap.cpp
+++ b/frontends/beos/bitmap.cpp
@@ -38,11 +38,11 @@
extern "C" {
#include "utils/log.h"
-#include "content/content.h"
-#include "content/urldb.h"
#include "netsurf/plotters.h"
#include "netsurf/browser_window.h"
#include "netsurf/bitmap.h"
+#include "netsurf/content.h"
+#include "content/urldb.h"
}
#include "beos/bitmap.h"
diff --git a/frontends/cocoa/bitmap.m b/frontends/cocoa/bitmap.m
index dd9e33fbe..3e37cdff3 100644
--- a/frontends/cocoa/bitmap.m
+++ b/frontends/cocoa/bitmap.m
@@ -27,7 +27,7 @@
#import "netsurf/plotters.h"
#import "netsurf/bitmap.h"
#import "content/urldb.h"
-#import "content/content.h"
+#import "netsurf/content.h"
#import "cocoa/plotter.h"
#import "cocoa/bitmap.h"
diff --git a/frontends/framebuffer/bitmap.c b/frontends/framebuffer/bitmap.c
index dbe5647e3..027e0122b 100644
--- a/frontends/framebuffer/bitmap.c
+++ b/frontends/framebuffer/bitmap.c
@@ -32,7 +32,7 @@
#include "utils/utils.h"
#include "netsurf/bitmap.h"
#include "netsurf/plotters.h"
-#include "content/content.h"
+#include "netsurf/content.h"
#include "framebuffer/gui.h"
#include "framebuffer/fbtk.h"
diff --git a/frontends/gtk/bitmap.c b/frontends/gtk/bitmap.c
index 1def140b8..b42814295 100644
--- a/frontends/gtk/bitmap.c
+++ b/frontends/gtk/bitmap.c
@@ -31,8 +31,8 @@
#include <gtk/gtk.h>
#include "utils/utils.h"
-#include "utils/log.h"
-#include "content/content.h"
+#include "utils/errors.h"
+#include "netsurf/content.h"
#include "netsurf/bitmap.h"
#include "netsurf/plotters.h"
diff --git a/frontends/gtk/scaffolding.c b/frontends/gtk/scaffolding.c
index 38dfd2125..dc0595a37 100644
--- a/frontends/gtk/scaffolding.c
+++ b/frontends/gtk/scaffolding.c
@@ -23,6 +23,7 @@
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
+#include <string.h>
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
@@ -33,6 +34,8 @@
#include "utils/log.h"
#include "utils/nsoption.h"
#include "utils/file.h"
+#include "utils/nsurl.h"
+#include "netsurf/content.h"
#include "desktop/browser_history.h"
#include "netsurf/browser_window.h"
#include "desktop/hotlist.h"
@@ -46,7 +49,7 @@
#include "desktop/save_text.h"
#include "desktop/searchweb.h"
#include "desktop/textinput.h"
-#include "content/hlcache.h"
+#include "desktop/search.h"
#include "gtk/compat.h"
#include "gtk/warn.h"
diff --git a/frontends/gtk/viewsource.c b/frontends/gtk/viewsource.c
index b0907a3a5..acf81018d 100644
--- a/frontends/gtk/viewsource.c
+++ b/frontends/gtk/viewsource.c
@@ -17,6 +17,7 @@
*/
#include <stdlib.h>
+#include <string.h>
#include <gtk/gtk.h>
#include "utils/utils.h"
@@ -24,7 +25,7 @@
#include "utils/nsurl.h"
#include "utils/messages.h"
#include "netsurf/browser_window.h"
-#include "content/content.h"
+#include "netsurf/content.h"
#include "gtk/viewdata.h"
#include "gtk/viewsource.h"
diff --git a/frontends/gtk/window.c b/frontends/gtk/window.c
index dd713cb28..a98d529c2 100644
--- a/frontends/gtk/window.c
+++ b/frontends/gtk/window.c
@@ -36,17 +36,17 @@
#include "utils/utf8.h"
#include "utils/utils.h"
#include "utils/nsoption.h"
-#include "content/hlcache.h"
-#include "gtk/window.h"
-#include "gtk/selection.h"
+#include "netsurf/content.h"
#include "netsurf/browser_window.h"
#include "netsurf/mouse.h"
-#include "desktop/searchweb.h"
-#include "desktop/textinput.h"
#include "netsurf/window.h"
#include "netsurf/plotters.h"
+#include "desktop/searchweb.h"
+#include "desktop/textinput.h"
#include "render/form.h"
+#include "gtk/window.h"
+#include "gtk/selection.h"
#include "gtk/warn.h"
#include "gtk/compat.h"
#include "gtk/gui.h"
@@ -947,7 +947,7 @@ static void gui_window_destroy(struct gui_window *g)
* \param gw gtk gui window to set favicon on.
* \param icon A handle to the new favicon content.
*/
-static void gui_window_set_icon(struct gui_window *gw, hlcache_handle *icon)
+static void gui_window_set_icon(struct gui_window *gw, struct hlcache_handle *icon)
{
struct bitmap *icon_bitmap = NULL;
@@ -1277,7 +1277,7 @@ static void gui_window_create_form_select_menu(struct gui_window *g,
static void
gui_window_file_gadget_open(struct gui_window *g,
- hlcache_handle *hl,
+ struct hlcache_handle *hl,
struct form_control *gadget)
{
GtkWidget *dialog;
diff --git a/frontends/riscos/bitmap.c b/frontends/riscos/bitmap.c
index e0fd38ba8..1a3524633 100644
--- a/frontends/riscos/bitmap.c
+++ b/frontends/riscos/bitmap.c
@@ -44,8 +44,8 @@
#include "utils/log.h"
#include "utils/messages.h"
#include "netsurf/plotters.h"
-#include "content/content.h"
#include "netsurf/bitmap.h"
+#include "netsurf/content.h"
#include "riscos/gui.h"
#include "riscos/image.h"
diff --git a/frontends/riscos/content-handlers/artworks.c b/frontends/riscos/content-handlers/artworks.c
index 517a6ff16..f70b10ac7 100644
--- a/frontends/riscos/content-handlers/artworks.c
+++ b/frontends/riscos/content-handlers/artworks.c
@@ -36,8 +36,10 @@
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utils.h"
-#include "content/content_protected.h"
#include "netsurf/plotters.h"
+#include "netsurf/content.h"
+#include "content/content_protected.h"
+#include "content/llcache.h"
#include "riscos/content-handlers/artworks.h"
#include "riscos/gui.h"
diff --git a/frontends/riscos/content-handlers/draw.c b/frontends/riscos/content-handlers/draw.c
index 0b1b07215..9dff75736 100644
--- a/frontends/riscos/content-handlers/draw.c
+++ b/frontends/riscos/content-handlers/draw.c
@@ -33,8 +33,10 @@
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utils.h"
-#include "content/content_protected.h"
#include "netsurf/plotters.h"
+#include "netsurf/content.h"
+#include "content/content_protected.h"
+#include "content/llcache.h"
#include "riscos/content-handlers/draw.h"
#include "riscos/gui.h"
diff --git a/frontends/riscos/content-handlers/sprite.c b/frontends/riscos/content-handlers/sprite.c
index 3ef48c889..ed06110ec 100644
--- a/frontends/riscos/content-handlers/sprite.c
+++ b/frontends/riscos/content-handlers/sprite.c
@@ -32,8 +32,10 @@
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utils.h"
-#include "content/content_protected.h"
#include "netsurf/plotters.h"
+#include "netsurf/content.h"
+#include "content/llcache.h"
+#include "content/content_protected.h"
#include "riscos/gui.h"
#include "riscos/image.h"
diff --git a/frontends/riscos/filetype.c b/frontends/riscos/filetype.c
index 99a44ae30..75ff41414 100644
--- a/frontends/riscos/filetype.c
+++ b/frontends/riscos/filetype.c
@@ -24,9 +24,7 @@
#include "utils/config.h"
#include "utils/log.h"
-#include "content/content.h"
-#include "content/fetch.h"
-#include "content/hlcache.h"
+#include "netsurf/content.h"
#include "riscos/filetype.h"
#include "riscos/gui.h"
@@ -232,7 +230,7 @@ int cmp_type(const void *x, const void *y)
}
/* exported interface documented in riscos/filetype.h */
-int ro_content_filetype(hlcache_handle *c)
+int ro_content_filetype(struct hlcache_handle *c)
{
lwc_string *mime_type;
int file_type;
@@ -252,7 +250,7 @@ int ro_content_filetype(hlcache_handle *c)
/* exported interface documented in riscos/filetype.h */
-int ro_content_native_type(hlcache_handle *c)
+int ro_content_native_type(struct hlcache_handle *c)
{
switch (ro_content_filetype(c)) {
case FILETYPE_JPEG: /* jpeg */
diff --git a/frontends/riscos/filetype.h b/frontends/riscos/filetype.h
index 3ba613033..4c45e7bd0 100644
--- a/frontends/riscos/filetype.h
+++ b/frontends/riscos/filetype.h
@@ -23,7 +23,7 @@
#ifndef _NETSURF_RISCOS_FILETYPE_H_
#define _NETSURF_RISCOS_FILETYPE_H_
-#include "content/content_type.h"
+#include "netsurf/content_type.h"
#ifndef FILETYPE_ACORN_URI
#define FILETYPE_ACORN_URI 0xf91
diff --git a/frontends/riscos/gui.c b/frontends/riscos/gui.c
index e0e8e4e3b..2e8f4333f 100644
--- a/frontends/riscos/gui.c
+++ b/frontends/riscos/gui.c
@@ -49,12 +49,12 @@
#include "utils/corestrings.h"
#include "netsurf/fetch.h"
#include "netsurf/misc.h"
-#include "desktop/save_complete.h"
-#include "desktop/treeview.h"
+#include "netsurf/content.h"
#include "netsurf/netsurf.h"
#include "netsurf/browser_window.h"
+#include "desktop/save_complete.h"
+#include "desktop/treeview.h"
#include "content/urldb.h"
-#include "content/hlcache.h"
#include "content/backing_store.h"
#include "riscos/gui.h"
@@ -1935,7 +1935,7 @@ static void ro_gui_view_source_bounce(wimp_message *message)
/**
* Send the source of a content to a text editor.
*/
-void ro_gui_view_source(hlcache_handle *c)
+void ro_gui_view_source(struct hlcache_handle *c)
{
os_error *error;
char *temp_name;
diff --git a/frontends/riscos/gui/url_bar.c b/frontends/riscos/gui/url_bar.c
index 80a7b4a40..547c4608d 100644
--- a/frontends/riscos/gui/url_bar.c
+++ b/frontends/riscos/gui/url_bar.c
@@ -17,8 +17,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * URL bars (implementation).
+/**
+ * \file
+ * RISC OS URL bar implementation.
*/
#include <alloca.h>
@@ -35,15 +36,14 @@
#include "utils/messages.h"
#include "utils/utf8.h"
#include "utils/utils.h"
-#include "content/hlcache.h"
-#include "content/content.h"
#include "netsurf/browser_window.h"
#include "netsurf/plotters.h"
+#include "netsurf/content.h"
+#include "content/hlcache.h"
#include "riscos/gui.h"
#include "riscos/hotlist.h"
#include "riscos/gui/url_bar.h"
-#include "riscos/theme.h"
#include "riscos/url_suggest.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
diff --git a/frontends/riscos/print.c b/frontends/riscos/print.c
index da16664ac..dfdd24ce9 100644
--- a/frontends/riscos/print.c
+++ b/frontends/riscos/print.c
@@ -36,10 +36,10 @@
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/nsoption.h"
-#include "content/content.h"
-#include "content/hlcache.h"
#include "netsurf/browser_window.h"
#include "netsurf/plotters.h"
+#include "netsurf/content.h"
+#include "content/content.h"
#include "riscos/gui.h"
#include "riscos/dialog.h"
@@ -101,10 +101,10 @@ void gui_window_redraw_window(struct gui_window *g);
static bool ro_gui_print_click(wimp_pointer *pointer);
static bool ro_gui_print_apply(wimp_w w);
static void print_update_sheets_shaded_state(bool on);
-static void print_send_printsave(hlcache_handle *h);
+static void print_send_printsave(struct hlcache_handle *h);
static bool print_send_printtypeknown(wimp_message *m);
static bool print_document(struct gui_window *g, const char *filename);
-static const char *print_declare_fonts(hlcache_handle *h);
+static const char *print_declare_fonts(struct hlcache_handle *h);
static bool print_fonts_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
static bool print_fonts_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *style);
static bool print_fonts_plot_polygon(const int *p, unsigned int n, const plot_style_t *style);
@@ -312,7 +312,7 @@ void print_update_sheets_shaded_state(bool on)
* \param h handle to content to print.
*/
-void print_send_printsave(hlcache_handle *h)
+void print_send_printsave(struct hlcache_handle *h)
{
wimp_full_message_data_xfer m;
os_error *e;
@@ -546,7 +546,7 @@ bool print_document(struct gui_window *g, const char *filename)
int left, right, top, bottom, width, height;
int saved_width, saved_height;
int yscroll = 0, sheets = print_max_sheets;
- hlcache_handle *h = browser_window_get_content(g->bw);
+ struct hlcache_handle *h = browser_window_get_content(g->bw);
const char *error_message;
pdriver_features features;
os_fw fhandle, old_job = 0;
@@ -788,7 +788,7 @@ error:
* \return 0 on success, error message on error
*/
-const char *print_declare_fonts(hlcache_handle *h)
+const char *print_declare_fonts(struct hlcache_handle *h)
{
unsigned int i;
struct rect clip;
diff --git a/frontends/riscos/save.c b/frontends/riscos/save.c
index 325dbbb79..a028fcd09 100644
--- a/frontends/riscos/save.c
+++ b/frontends/riscos/save.c
@@ -40,8 +40,8 @@
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utf8.h"
-#include "content/content.h"
-#include "content/hlcache.h"
+#include "utils/nsurl.h"
+#include "netsurf/content.h"
#include "netsurf/browser_window.h"
#include "desktop/hotlist.h"
#include "desktop/global_history.h"
@@ -81,7 +81,7 @@
now since we could have multiple saves outstanding */
static gui_save_type gui_save_current_type;
-static hlcache_handle *gui_save_content = NULL;
+static struct hlcache_handle *gui_save_content = NULL;
static char *gui_save_selection = NULL;
static const char *gui_save_url = NULL;
static const char *gui_save_title = NULL;
@@ -105,17 +105,17 @@ static size_t save_dir_len;
typedef enum { LINK_ACORN, LINK_ANT, LINK_TEXT } link_format;
-static bool ro_gui_save_complete(hlcache_handle *h, char *path);
-static bool ro_gui_save_content(hlcache_handle *h, char *path, bool force_overwrite);
+static bool ro_gui_save_complete(struct hlcache_handle *h, char *path);
+static bool ro_gui_save_content(struct hlcache_handle *h, char *path, bool force_overwrite);
static void ro_gui_save_done(void);
static void ro_gui_save_bounced(wimp_message *message);
-static bool ro_gui_save_object_native(hlcache_handle *h, char *path);
+static bool ro_gui_save_object_native(struct hlcache_handle *h, char *path);
static bool ro_gui_save_link(const char *url, const char *title, link_format format, char *path);
-static void ro_gui_save_set_state(hlcache_handle *h, gui_save_type save_type,
+static void ro_gui_save_set_state(struct hlcache_handle *h, gui_save_type save_type,
const nsurl *url, char *leaf_buf, size_t leaf_len,
char *icon_buf, size_t icon_len);
static void ro_gui_save_drag_end(wimp_dragged *drag, void *data);
-static bool ro_gui_save_create_thumbnail(hlcache_handle *h, const char *name);
+static bool ro_gui_save_create_thumbnail(struct hlcache_handle *h, const char *name);
static void ro_gui_save_overwrite_confirmed(query_id, enum query_response res, void *p);
static void ro_gui_save_overwrite_cancelled(query_id, enum query_response res, void *p);
@@ -247,7 +247,7 @@ void ro_gui_saveas_quit(void)
* \param title title (if any), when saving links
*/
-void ro_gui_save_prepare(gui_save_type save_type, hlcache_handle *h,
+void ro_gui_save_prepare(gui_save_type save_type, struct hlcache_handle *h,
char *s, const nsurl *url, const char *title)
{
char name_buf[FILENAME_MAX];
@@ -364,7 +364,7 @@ bool ro_gui_save_ok(wimp_w w)
* \param g gui window
*/
-void gui_drag_save_object(struct gui_window *g, hlcache_handle *c,
+void gui_drag_save_object(struct gui_window *g, struct hlcache_handle *c,
gui_save_type save_type)
{
wimp_pointer pointer;
@@ -741,7 +741,7 @@ void ro_gui_save_bounced(wimp_message *message)
void ro_gui_save_datasave_ack(wimp_message *message)
{
char *path = message->data.data_xfer.file_name;
- hlcache_handle *h = gui_save_content;
+ struct hlcache_handle *h = gui_save_content;
bool force_overwrite;
switch (gui_save_current_type) {
@@ -793,7 +793,7 @@ void ro_gui_save_datasave_ack(wimp_message *message)
* or (ii) deferred awaiting user confirmation
*/
-bool ro_gui_save_content(hlcache_handle *h, char *path, bool force_overwrite)
+bool ro_gui_save_content(struct hlcache_handle *h, char *path, bool force_overwrite)
{
os_error *error;
const char *source_data;
@@ -1008,7 +1008,7 @@ static void ro_gui_save_set_file_type(const char *path, lwc_string *mime_type)
* \return true on success, false on error and error reported
*/
-bool ro_gui_save_complete(hlcache_handle *h, char *path)
+bool ro_gui_save_complete(struct hlcache_handle *h, char *path)
{
void *spr = ((byte *) saveas_area) + saveas_area->first;
osspriteop_header *sprite = (osspriteop_header *) spr;
@@ -1093,7 +1093,7 @@ bool ro_gui_save_complete(hlcache_handle *h, char *path)
return save_complete(h, path, ro_gui_save_set_file_type);
}
-bool ro_gui_save_object_native(hlcache_handle *h, char *path)
+bool ro_gui_save_object_native(struct hlcache_handle *h, char *path)
{
int file_type = ro_content_filetype(h);
@@ -1200,7 +1200,7 @@ bool ro_gui_save_link(const char *url, const char *title, link_format format,
* \param icon_len size of buffer to receive icon name.
*/
-void ro_gui_save_set_state(hlcache_handle *h, gui_save_type save_type,
+void ro_gui_save_set_state(struct hlcache_handle *h, gui_save_type save_type,
const nsurl *url, char *leaf_buf, size_t leaf_len,
char *icon_buf, size_t icon_len)
{
@@ -1338,7 +1338,7 @@ void ro_gui_save_set_state(hlcache_handle *h, gui_save_type save_type,
* \return true iff successful
*/
-bool ro_gui_save_create_thumbnail(hlcache_handle *h, const char *name)
+bool ro_gui_save_create_thumbnail(struct hlcache_handle *h, const char *name)
{
osspriteop_header *sprite_header;
struct bitmap *bitmap;
diff --git a/frontends/riscos/save_draw.c b/frontends/riscos/save_draw.c
index 7ba2c942b..705551f7b 100644
--- a/frontends/riscos/save_draw.c
+++ b/frontends/riscos/save_draw.c
@@ -32,9 +32,8 @@
#include "utils/log.h"
#include "utils/utils.h"
-#include "content/content.h"
-#include "content/hlcache.h"
#include "netsurf/plotters.h"
+#include "netsurf/content.h"
#include "riscos/bitmap.h"
#include "riscos/gui.h"
@@ -87,7 +86,7 @@ static int ro_save_draw_height;
* \return true on success, false on error and error reported
*/
-bool save_as_draw(hlcache_handle *h, const char *path)
+bool save_as_draw(struct hlcache_handle *h, const char *path)
{
pencil_code code;
char *drawfile_buffer;
diff --git a/frontends/riscos/search.c b/frontends/riscos/search.c
index 544630e2e..9ed898e50 100644
--- a/frontends/riscos/search.c
+++ b/frontends/riscos/search.c
@@ -31,10 +31,9 @@
#include "utils/log.h"
#include "utils/messages.h"
-#include "content/content.h"
-#include "content/hlcache.h"
#include "netsurf/browser_window.h"
#include "netsurf/search.h"
+#include "netsurf/content.h"
#include "desktop/search.h"
#include "riscos/gui.h"
@@ -269,7 +268,7 @@ bool ro_gui_search_prepare_menu(void)
*/
static bool ro_gui_search_bw_searchable(struct browser_window *bw)
{
- hlcache_handle *h;
+ struct hlcache_handle *h;
assert(bw != NULL);
diff --git a/frontends/riscos/theme_install.c b/frontends/riscos/theme_install.c
index 3448e742f..fee126a86 100644
--- a/frontends/riscos/theme_install.c
+++ b/frontends/riscos/theme_install.c
@@ -28,7 +28,7 @@
#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/messages.h"
-#include "content/content.h"
+#include "netsurf/content.h"
#include "content/hlcache.h"
#include "desktop/theme.h"
diff --git a/frontends/riscos/url_suggest.c b/frontends/riscos/url_suggest.c
index 3f6b6b54d..ef1fcc71e 100644
--- a/frontends/riscos/url_suggest.c
+++ b/frontends/riscos/url_suggest.c
@@ -23,14 +23,13 @@
#include <assert.h>
#include <string.h>
#include <stdlib.h>
+#include <oslib/wimp.h>
-#include "oslib/wimp.h"
-#include "content/content_type.h"
+#include "utils/messages.h"
#include "content/urldb.h"
#include "riscos/menus.h"
#include "riscos/url_suggest.h"
-#include "utils/messages.h"
struct url_suggest_item {
const char *url; /*< The URL being stored. */
diff --git a/frontends/riscos/window.c b/frontends/riscos/window.c
index e99ed31e3..cbd743f65 100644
--- a/frontends/riscos/window.c
+++ b/frontends/riscos/window.c
@@ -43,7 +43,6 @@
#include <oslib/wimpspriteop.h>
#include <nsutils/time.h>
-#include "utils/config.h"
#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/talloc.h"
@@ -52,20 +51,17 @@
#include "utils/utils.h"
#include "utils/messages.h"
#include "utils/string.h"
-#include "content/content.h"
+#include "netsurf/content.h"
+#include "netsurf/browser_window.h"
+#include "netsurf/plotters.h"
+#include "netsurf/window.h"
+#include "netsurf/bitmap.h"
#include "content/hlcache.h"
#include "content/urldb.h"
#include "desktop/browser_history.h"
-#include "netsurf/browser_window.h"
#include "desktop/cookie_manager.h"
#include "desktop/scrollbar.h"
-#include "desktop/frames.h"
-#include "netsurf/mouse.h"
-#include "netsurf/plotters.h"
#include "desktop/textinput.h"
-#include "desktop/tree.h"
-#include "netsurf/window.h"
-#include "netsurf/bitmap.h"
#include "render/form.h"
#include "riscos/bitmap.h"
diff --git a/frontends/windows/bitmap.c b/frontends/windows/bitmap.c
index 936b28ec5..f60dab613 100644
--- a/frontends/windows/bitmap.c
+++ b/frontends/windows/bitmap.c
@@ -32,7 +32,7 @@
#include "utils/log.h"
#include "netsurf/bitmap.h"
#include "netsurf/plotters.h"
-#include "content/content.h"
+#include "netsurf/content.h"
#include "windows/plot.h"
#include "windows/bitmap.h"
diff --git a/include/netsurf/content.h b/include/netsurf/content.h
new file mode 100644
index 000000000..3f3a30c0e
--- /dev/null
+++ b/include/netsurf/content.h
@@ -0,0 +1,188 @@
+/*
+ * Copyright 2016 Vincent Sanders <vince@netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file
+ * Public content interface.
+ *
+ * The content functions manipulate content objects.
+ */
+
+#ifndef _NETSURF_CONTENT_H_
+#define _NETSURF_CONTENT_H_
+
+#include <libwapcaplet/libwapcaplet.h>
+
+#include "desktop/plot_style.h" /* color typedef */
+#include "netsurf/content_type.h"
+
+struct bitmap;
+struct hlcache_handle;
+struct rect;
+struct redraw_context;
+
+/** parameters to content redraw */
+struct content_redraw_data {
+ int x; /**< coordinate for top-left of redraw */
+ int y; /**< coordinate for top-left of redraw */
+
+ /** dimensions to render content at (for scaling contents with
+ * intrinsic dimensions)
+ */
+ int width; /**< horizontal dimension */
+ int height; /**< vertical dimension */
+
+ /** The background colour */
+ colour background_colour;
+
+ /** Scale for redraw
+ * (for scaling contents without intrinsic dimensions)
+ */
+ float scale; /**< Scale factor for redraw */
+
+ bool repeat_x; /**< whether content is tiled in x direction */
+ bool repeat_y; /**< whether content is tiled in y direction */
+};
+
+/**
+ * Retrieve the bitmap contained in an image content
+ *
+ * \param h handle to the content.
+ * \return Pointer to bitmap, or NULL if none.
+ */
+struct bitmap *content_get_bitmap(struct hlcache_handle *h);
+
+
+/**
+ * Retrieve the encoding of a content
+ *
+ * \param h handle to the content.
+ * \param op encoding operation.
+ * \return Pointer to content info or NULL if none.
+ */
+const char *content_get_encoding(struct hlcache_handle *h, enum content_encoding_type op);
+
+
+/**
+ * Retrieve mime-type of content
+ *
+ * \param h handle to the content to retrieve mime type from
+ * \return Pointer to referenced mime type, or NULL if not found.
+ */
+lwc_string *content_get_mime_type(struct hlcache_handle *h);
+
+
+/**
+ * Retrieve source of content
+ *
+ * \param h Content handle to retrieve source of
+ * \param size Pointer to location to receive byte size of source
+ * \return Pointer to source data
+ */
+const char *content_get_source_data(struct hlcache_handle *h, unsigned long *size);
+
+
+/**
+ * Retrieve title associated with content
+ *
+ * \param h handle to the content to retrieve title from
+ * \return Pointer to title, or NULL if not found.
+ */
+const char *content_get_title(struct hlcache_handle *h);
+
+
+/**
+ * Retrieve computed type of content
+ *
+ * \param h handle to the content to retrieve type of.
+ * \return Computed content type
+ */
+content_type content_get_type(struct hlcache_handle *h);
+
+
+/**
+ * Retrieve width of content
+ *
+ * \param h handle to the content to get width of.
+ * \return Content width
+ */
+int content_get_width(struct hlcache_handle *h);
+
+
+/**
+ * Retrieve height of content
+ *
+ * \param h handle to the content to get height of.
+ * \return Content height
+ */
+int content_get_height(struct hlcache_handle *h);
+
+
+/**
+ * Invalidate content reuse data.
+ *
+ * causes subsequent requests for content URL to query server to
+ * determine if content can be reused. This is required behaviour for
+ * forced reloads etc.
+ *
+ * \param h Content handle to invalidate.
+ */
+void content_invalidate_reuse_data(struct hlcache_handle *h);
+
+
+/**
+ * Display content on screen with optional tiling.
+ *
+ * \param h The content to redraw
+ * \param ctx current redraw context
+ * \return true if successful, false otherwise
+ *
+ * Calls the redraw function for the content.
+ */
+bool content_redraw(struct hlcache_handle *h, struct content_redraw_data *data, const struct rect *clip, const struct redraw_context *ctx);
+
+
+/**
+ * Redraw a content with scale set for horizontal fit.
+ *
+ * Redraws the content at a specified width and height with the
+ * content drawing scaled to fit within the area.
+ *
+ * \param h The content to redraw
+ * \param width The target width
+ * \param height The target height
+ * \param ctx current redraw context
+ * \return true if successful, false otherwise
+ *
+ * The thumbnail is guaranteed to be filled to its width/height extents, so
+ * there is no need to render a solid background first.
+ *
+ * Units for width and height are pixels.
+ */
+bool content_scaled_redraw(struct hlcache_handle *h, int width, int height, const struct redraw_context *ctx);
+
+
+/**
+ * Retrieve the URL associated with a high level cache handle
+ *
+ * \param handle The handle to inspect
+ * \return Pointer to URL.
+ */
+struct nsurl *hlcache_handle_get_url(const struct hlcache_handle *handle);
+
+#endif
diff --git a/content/content_type.h b/include/netsurf/content_type.h
index 9f8c2f307..b3d574309 100644
--- a/content/content_type.h
+++ b/include/netsurf/content_type.h
@@ -16,21 +16,41 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
- * Declaration of content_type enum.
+/**
+ * \file
+ * Declaration of content type enumerations.
*
- * The content_type enum is defined here to prevent cyclic dependencies.
+ * The content enumerations are defined here.
*/
-#ifndef _NETSURF_DESKTOP_CONTENT_TYPE_H_
-#define _NETSURF_DESKTOP_CONTENT_TYPE_H_
+#ifndef _NETSURF_CONTENT_TYPE_H_
+#define _NETSURF_CONTENT_TYPE_H_
+
+/** Debugging dump operations */
+enum content_debug {
+ CONTENT_DEBUG_RENDER, /** Debug the contents rendering. */
+ CONTENT_DEBUG_DOM, /** Debug the contents Document Object. */
+ CONTENT_DEBUG_REDRAW /** Debug redraw operations. */
+};
+
+/** Content encoding information types */
+enum content_encoding_type {
+ CONTENT_ENCODING_NORMAL, /** The content encoding */
+ CONTENT_ENCODING_SOURCE /** The content encoding source */
+};
/** The type of a content. */
typedef enum {
+ /** no type for content */
CONTENT_NONE = 0x00,
+ /** content is HTML */
CONTENT_HTML = 0x01,
+
+ /** content is plain text */
CONTENT_TEXTPLAIN = 0x02,
+
+ /** content is CSS */
CONTENT_CSS = 0x04,
/** All images */
@@ -39,11 +59,12 @@ typedef enum {
/** Navigator API Plugins */
CONTENT_PLUGIN = 0x10,
- /** Themes (only GTK and RISC OS) */
+ /** RISC OS themes content */
CONTENT_THEME = 0x20,
/** Javascript */
CONTENT_JS = 0x40,
+
/** All script types. */
CONTENT_SCRIPT = 0x40,
diff --git a/javascript/duktape/Document.bnd b/javascript/duktape/Document.bnd
index e15f75f48..8658aec45 100644
--- a/javascript/duktape/Document.bnd
+++ b/javascript/duktape/Document.bnd
@@ -13,7 +13,7 @@ prologue Document()
#include "utils/corestrings.h"
#include "utils/libdom.h"
#include "utils/utils.h"
-
+#include "content/hlcache.h"
#include "render/html_internal.h"
#include "content/urldb.h"
diff --git a/javascript/duktape/Window.bnd b/javascript/duktape/Window.bnd
index c9fc3ca4d..489587899 100644
--- a/javascript/duktape/Window.bnd
+++ b/javascript/duktape/Window.bnd
@@ -14,6 +14,7 @@ class Window {
prologue %{
#include "utils/nsurl.h"
#include "netsurf/browser_window.h"
+#include "content/hlcache.h"
#include "render/html.h"
#include "render/html_internal.h"
%};
diff --git a/render/box.c b/render/box.c
index 81c22ed19..fa3e52d3a 100644
--- a/render/box.c
+++ b/render/box.c
@@ -33,12 +33,12 @@
#include "utils/log.h"
#include "utils/talloc.h"
#include "utils/utils.h"
-#include "content/content_protected.h"
-#include "content/hlcache.h"
+#include "netsurf/misc.h"
+#include "netsurf/content.h"
+#include "netsurf/mouse.h"
#include "content/handlers/css/utils.h"
#include "content/handlers/css/dump.h"
#include "desktop/scrollbar.h"
-#include "netsurf/misc.h"
#include "desktop/gui_internal.h"
#include "render/box.h"
diff --git a/render/box_textarea.c b/render/box_textarea.c
index 7f0765430..79ace8dea 100644
--- a/render/box_textarea.c
+++ b/render/box_textarea.c
@@ -22,9 +22,10 @@
#include <dom/dom.h>
+#include "utils/config.h"
+#include "utils/log.h"
#include "desktop/textarea.h"
#include "desktop/textinput.h"
-#include "utils/log.h"
#include "render/box_textarea.h"
#include "render/font.h"
diff --git a/render/html.c b/render/html.c
index 7e2f27143..96251eabb 100644
--- a/render/html.c
+++ b/render/html.c
@@ -40,18 +40,17 @@
#include "utils/utf8.h"
#include "utils/nsoption.h"
#include "utils/string.h"
-#include "content/content_protected.h"
-#include "content/fetch.h"
+#include "netsurf/content.h"
+#include "netsurf/browser_window.h"
+#include "netsurf/utf8.h"
+#include "netsurf/layout.h"
+#include "netsurf/misc.h"
#include "content/hlcache.h"
#include "desktop/selection.h"
#include "desktop/scrollbar.h"
#include "desktop/textarea.h"
#include "netsurf/bitmap.h"
#include "javascript/js.h"
-#include "netsurf/browser_window.h"
-#include "netsurf/utf8.h"
-#include "netsurf/layout.h"
-#include "netsurf/misc.h"
#include "desktop/gui_internal.h"
#include "render/box.h"
diff --git a/render/html.h b/render/html.h
index 5d2e45906..1052cb26e 100644
--- a/render/html.h
+++ b/render/html.h
@@ -30,7 +30,7 @@
#include <dom/dom.h>
#include <dom/bindings/hubbub/parser.h>
-#include "content/content_type.h"
+#include "netsurf/content_type.h"
#include "netsurf/browser_window.h"
#include "netsurf/mouse.h"
#include "desktop/plot_style.h"
diff --git a/render/html_css.c b/render/html_css.c
index a3973bf87..ae0e8f696 100644
--- a/render/html_css.c
+++ b/render/html_css.c
@@ -27,13 +27,14 @@
#include <strings.h>
#include <stdlib.h>
-#include "content/hlcache.h"
-#include "content/handlers/css/css.h"
#include "utils/nsoption.h"
#include "utils/corestrings.h"
#include "utils/config.h"
#include "utils/log.h"
#include "netsurf/misc.h"
+#include "netsurf/content.h"
+#include "content/hlcache.h"
+#include "content/handlers/css/css.h"
#include "desktop/gui_internal.h"
#include "render/html_internal.h"
diff --git a/render/html_forms.c b/render/html_forms.c
index 0d56e1c75..39bc690d9 100644
--- a/render/html_forms.c
+++ b/render/html_forms.c
@@ -16,6 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "utils/config.h"
#include "utils/corestrings.h"
#include "utils/log.h"
diff --git a/render/html_interaction.c b/render/html_interaction.c
index 3a548250a..f0b50f8d3 100644
--- a/render/html_interaction.c
+++ b/render/html_interaction.c
@@ -33,19 +33,19 @@
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/log.h"
-#include "content/content.h"
-#include "content/hlcache.h"
+#include "utils/nsoption.h"
+#include "netsurf/content.h"
#include "netsurf/browser_window.h"
-#include "desktop/frames.h"
#include "netsurf/mouse.h"
-#include "utils/nsoption.h"
+#include "netsurf/misc.h"
+#include "netsurf/layout.h"
+#include "content/hlcache.h"
+#include "desktop/frames.h"
#include "desktop/scrollbar.h"
#include "desktop/selection.h"
#include "desktop/textarea.h"
#include "desktop/textinput.h"
#include "javascript/js.h"
-#include "netsurf/misc.h"
-#include "netsurf/layout.h"
#include "desktop/gui_internal.h"
#include "render/box.h"
diff --git a/render/html_object.c b/render/html_object.c
index baa01e598..51c18e263 100644
--- a/render/html_object.c
+++ b/render/html_object.c
@@ -32,10 +32,11 @@
#include "utils/config.h"
#include "utils/log.h"
#include "utils/nsoption.h"
+#include "netsurf/content.h"
+#include "netsurf/misc.h"
#include "content/hlcache.h"
#include "content/handlers/css/utils.h"
#include "desktop/scrollbar.h"
-#include "netsurf/misc.h"
#include "desktop/gui_internal.h"
#include "render/box.h"
diff --git a/render/html_redraw.c b/render/html_redraw.c
index 01e7246c6..bc0f462b4 100644
--- a/render/html_redraw.c
+++ b/render/html_redraw.c
@@ -40,16 +40,17 @@
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/nsoption.h"
-#include "content/content_protected.h"
-#include "content/handlers/css/utils.h"
+#include "netsurf/content.h"
#include "netsurf/browser_window.h"
#include "netsurf/plotters.h"
+#include "netsurf/bitmap.h"
+#include "netsurf/layout.h"
+#include "content/content_protected.h"
+#include "content/handlers/css/utils.h"
#include "desktop/selection.h"
#include "desktop/print.h"
#include "desktop/scrollbar.h"
#include "desktop/textarea.h"
-#include "netsurf/bitmap.h"
-#include "netsurf/layout.h"
#include "desktop/gui_internal.h"
#include "render/box.h"
diff --git a/render/html_script.c b/render/html_script.c
index fe3455d9f..37b0564d7 100644
--- a/render/html_script.c
+++ b/render/html_script.c
@@ -32,10 +32,12 @@
#include "utils/corestrings.h"
#include "utils/log.h"
#include "utils/messages.h"
+#include "netsurf/content.h"
#include "javascript/js.h"
#include "content/content_protected.h"
#include "content/fetch.h"
#include "content/hlcache.h"
+
#include "render/html_internal.h"
typedef bool (script_handler_t)(struct jscontext *jscontext, const char *data, size_t size) ;
diff --git a/render/layout.c b/render/layout.c
index 48c8677d7..0cf829ad6 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -47,12 +47,13 @@
#include "utils/talloc.h"
#include "utils/utils.h"
#include "utils/nsoption.h"
+#include "netsurf/content.h"
+#include "netsurf/browser_window.h"
+#include "netsurf/layout.h"
#include "content/content_protected.h"
#include "content/handlers/css/utils.h"
-#include "netsurf/browser_window.h"
#include "desktop/scrollbar.h"
#include "desktop/textarea.h"
-#include "netsurf/layout.h"
#include "render/box.h"
#include "render/font.h"
diff --git a/render/textplain.c b/render/textplain.c
index 80828e738..5f37d400d 100644
--- a/render/textplain.c
+++ b/render/textplain.c
@@ -37,6 +37,7 @@
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/utf8.h"
+#include "netsurf/content.h"
#include "content/content_protected.h"
#include "content/hlcache.h"
#include "content/handlers/css/utils.h"