summaryrefslogtreecommitdiff
path: root/content/content.h
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2003-02-09 12:58:15 +0000
committerJames Bursa <james@netsurf-browser.org>2003-02-09 12:58:15 +0000
commita4c5929a2fac1cb0c039b2d009d8093ac81a90d7 (patch)
tree710bf4247d92ec63df7c92815c5360ec907a4b66 /content/content.h
parent948dfeb1c2404e6bdad8c20c83a26f3eecb3764a (diff)
downloadnetsurf-a4c5929a2fac1cb0c039b2d009d8093ac81a90d7.tar.gz
netsurf-a4c5929a2fac1cb0c039b2d009d8093ac81a90d7.tar.bz2
[project @ 2003-02-09 12:58:14 by bursa]
Reorganization and rewrite of fetch, cache, and content handling. svn path=/import/netsurf/; revision=96
Diffstat (limited to 'content/content.h')
-rw-r--r--content/content.h95
1 files changed, 95 insertions, 0 deletions
diff --git a/content/content.h b/content/content.h
new file mode 100644
index 000000000..ed93e7c24
--- /dev/null
+++ b/content/content.h
@@ -0,0 +1,95 @@
+/**
+ * $Id: content.h,v 1.1 2003/02/09 12:58:14 bursa Exp $
+ */
+
+#ifndef _NETSURF_DESKTOP_CONTENT_H_
+#define _NETSURF_DESKTOP_CONTENT_H_
+
+#include "libxml/HTMLparser.h"
+#include "netsurf/content/cache.h"
+#include "netsurf/render/css.h"
+#include "netsurf/render/box.h"
+#include "netsurf/riscos/font.h"
+
+
+/**
+ * A struct content corresponds to a single url.
+ *
+ * It is in one of the following states:
+ * CONTENT_FETCHING - the data is being fetched and/or converted
+ * for use by the browser
+ * CONTENT_READY - the content has been processed and is ready
+ * to display
+ *
+ * The converted data is stored in the cache, not the source data.
+ * Users of the structure are counted in use_count; when use_count = 0
+ * the content may be removed from the memory cache.
+ */
+
+typedef enum {CONTENT_HTML, CONTENT_TEXTPLAIN, CONTENT_CSS,
+ CONTENT_PNG, CONTENT_OTHER} content_type;
+
+struct box_position
+{
+ struct box* box;
+ int actual_box_x;
+ int actual_box_y;
+ int plot_index;
+ int pixel_offset;
+ int char_offset;
+};
+
+struct content
+{
+ char *url;
+ content_type type;
+ enum {CONTENT_LOADING, CONTENT_READY} status;
+
+ union
+ {
+ struct
+ {
+ htmlParserCtxt* parser;
+ xmlDoc* document;
+ xmlNode* markup;
+ struct box* layout;
+ struct css_stylesheet* stylesheet;
+ struct css_style* style;
+ struct {
+ struct box_position start;
+ struct box_position end;
+ enum {alter_UNKNOWN, alter_START, alter_END} altering;
+ int selected; /* 0 = unselected, 1 = selected */
+ } text_selection;
+ struct font_set* fonts;
+ struct page_elements elements;
+ } html;
+
+ struct
+ {
+ struct css_stylesheet * stylesheet;
+ } css;
+
+ struct
+ {
+ unsigned long width, height;
+ char * sprite;
+ } image;
+
+ } data;
+
+ struct cache_entry *cache;
+ unsigned long size;
+ char *title;
+};
+
+
+content_type content_lookup(const char *mime_type);
+struct content * content_create(content_type type, char *url);
+void content_process_data(struct content *c, char *data, unsigned long size);
+int content_convert(struct content *c, unsigned long width, unsigned long height);
+void content_revive(struct content *c, unsigned long width, unsigned long height);
+void content_reformat(struct content *c, unsigned long width, unsigned long height);
+void content_destroy(struct content *c);
+
+#endif