2003-02-09 15:58:15 +03:00
|
|
|
/**
|
2003-04-15 21:53:00 +04:00
|
|
|
* $Id: content.h,v 1.9 2003/04/15 17:53:00 bursa Exp $
|
2003-02-09 15:58:15 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _NETSURF_DESKTOP_CONTENT_H_
|
|
|
|
#define _NETSURF_DESKTOP_CONTENT_H_
|
|
|
|
|
|
|
|
#include "libxml/HTMLparser.h"
|
|
|
|
#include "netsurf/content/cache.h"
|
2003-04-04 19:19:32 +04:00
|
|
|
#include "netsurf/css/css.h"
|
2003-02-09 15:58:15 +03:00
|
|
|
#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.
|
|
|
|
*/
|
|
|
|
|
2003-04-10 01:57:09 +04:00
|
|
|
typedef enum {
|
|
|
|
CONTENT_HTML,
|
|
|
|
CONTENT_TEXTPLAIN,
|
|
|
|
CONTENT_JPEG,
|
|
|
|
CONTENT_CSS,
|
|
|
|
CONTENT_PNG,
|
|
|
|
CONTENT_OTHER
|
|
|
|
} content_type;
|
2003-02-09 15:58:15 +03:00
|
|
|
|
|
|
|
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;
|
2003-04-15 21:53:00 +04:00
|
|
|
enum {
|
|
|
|
CONTENT_LOADING, /* content is being fetched or converted
|
|
|
|
and is not safe to display */
|
|
|
|
CONTENT_PENDING, /* some parts of content still being
|
|
|
|
loaded, but can be displayed */
|
|
|
|
CONTENT_DONE /* all finished */
|
|
|
|
} status;
|
2003-02-26 00:00:27 +03:00
|
|
|
unsigned long width, height;
|
2003-04-15 21:53:00 +04:00
|
|
|
unsigned long available_width;
|
2003-02-09 15:58:15 +03:00
|
|
|
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
htmlParserCtxt* parser;
|
|
|
|
struct box* layout;
|
2003-04-06 01:38:06 +04:00
|
|
|
unsigned int stylesheet_count;
|
|
|
|
struct content **stylesheet_content;
|
2003-02-09 15:58:15 +03:00
|
|
|
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;
|
2003-04-15 21:53:00 +04:00
|
|
|
unsigned int object_count; /* images etc. */
|
|
|
|
struct {
|
|
|
|
char *url;
|
|
|
|
struct content *content;
|
|
|
|
struct box *box;
|
|
|
|
} *object;
|
2003-02-09 15:58:15 +03:00
|
|
|
} html;
|
|
|
|
|
2003-04-06 22:09:34 +04:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
struct css_stylesheet *css;
|
|
|
|
unsigned int import_count;
|
2003-04-10 01:57:09 +04:00
|
|
|
char **import_url;
|
2003-04-06 22:09:34 +04:00
|
|
|
struct content **import_content;
|
|
|
|
} css;
|
2003-02-09 15:58:15 +03:00
|
|
|
|
|
|
|
struct
|
|
|
|
{
|
2003-02-26 00:00:27 +03:00
|
|
|
char * data;
|
|
|
|
unsigned long length;
|
|
|
|
} jpeg;
|
2003-04-04 19:19:32 +04:00
|
|
|
|
2003-02-09 15:58:15 +03:00
|
|
|
} data;
|
|
|
|
|
|
|
|
struct cache_entry *cache;
|
|
|
|
unsigned long size;
|
|
|
|
char *title;
|
2003-04-04 19:19:32 +04:00
|
|
|
unsigned int active;
|
|
|
|
int error;
|
2003-04-06 22:09:34 +04:00
|
|
|
void (*status_callback)(void *p, const char *status);
|
|
|
|
void *status_p;
|
2003-04-15 21:53:00 +04:00
|
|
|
char status_message[80];
|
2003-02-09 15:58:15 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
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
|