2003-06-30 16:44:03 +04:00
|
|
|
/*
|
|
|
|
* This file is part of NetSurf, http://netsurf.sourceforge.net/
|
|
|
|
* Licensed under the GNU General Public License,
|
|
|
|
* http://www.opensource.org/licenses/gpl-license
|
2004-02-15 23:39:53 +03:00
|
|
|
* Copyright 2004 James Bursa <bursa@users.sourceforge.net>
|
2003-02-09 15:58:15 +03:00
|
|
|
*/
|
|
|
|
|
2004-02-20 03:43:17 +03:00
|
|
|
/** \file
|
|
|
|
* Content for text/html (interface).
|
|
|
|
*
|
|
|
|
* These functions should in general be called via the content interface.
|
|
|
|
*/
|
|
|
|
|
2003-02-09 15:58:15 +03:00
|
|
|
#ifndef _NETSURF_RENDER_HTML_H_
|
|
|
|
#define _NETSURF_RENDER_HTML_H_
|
|
|
|
|
2004-06-09 23:55:06 +04:00
|
|
|
#include <stdbool.h>
|
2004-02-20 03:43:17 +03:00
|
|
|
#include "libxml/HTMLparser.h"
|
2004-01-24 20:08:16 +03:00
|
|
|
#include "netsurf/content/content_type.h"
|
2003-09-08 01:08:13 +04:00
|
|
|
#include "netsurf/css/css.h"
|
2004-01-02 15:04:04 +03:00
|
|
|
#include "netsurf/utils/pool.h"
|
2003-09-08 01:08:13 +04:00
|
|
|
|
|
|
|
struct box;
|
|
|
|
struct browser_window;
|
|
|
|
struct content;
|
2004-03-27 01:16:31 +03:00
|
|
|
struct imagemap;
|
2004-10-18 01:10:19 +04:00
|
|
|
struct object_params;
|
|
|
|
struct plotters;
|
2003-09-08 01:08:13 +04:00
|
|
|
|
2004-07-31 03:40:01 +04:00
|
|
|
/* entries in stylesheet_content */
|
|
|
|
#define STYLESHEET_BASE 0 /* base style sheet */
|
|
|
|
#define STYLESHEET_ADBLOCK 1 /* adblocking stylesheet */
|
|
|
|
#define STYLESHEET_STYLE 2 /* <style> elements (not cached) */
|
|
|
|
#define STYLESHEET_START 3 /* start of document stylesheets */
|
|
|
|
|
2004-10-18 02:13:35 +04:00
|
|
|
extern char *default_stylesheet_url;
|
|
|
|
extern char *adblock_stylesheet_url;
|
|
|
|
|
2004-02-20 03:43:17 +03:00
|
|
|
/** Data specific to CONTENT_HTML. */
|
2003-09-08 01:08:13 +04:00
|
|
|
struct content_html_data {
|
2004-02-20 03:43:17 +03:00
|
|
|
htmlParserCtxt *parser; /**< HTML parser context. */
|
|
|
|
|
2004-08-14 16:57:02 +04:00
|
|
|
const char *encoding; /**< Encoding of source. */
|
2004-07-18 21:38:01 +04:00
|
|
|
bool getenc; /**< Need to get the encoding from the document, as it
|
|
|
|
* wasn't specified in the Content-Type header. */
|
2004-02-20 03:43:17 +03:00
|
|
|
|
2003-12-26 03:17:55 +03:00
|
|
|
char *base_url; /**< Base URL (may be a copy of content->url). */
|
2004-02-20 03:43:17 +03:00
|
|
|
|
|
|
|
struct box *layout; /**< Box tree, or 0. */
|
|
|
|
colour background_colour; /**< Document background colour. */
|
|
|
|
|
|
|
|
/** Number of entries in stylesheet_content. */
|
2003-09-08 01:08:13 +04:00
|
|
|
unsigned int stylesheet_count;
|
2004-07-31 03:40:01 +04:00
|
|
|
/** Stylesheets. Each may be 0. */
|
2003-09-08 01:08:13 +04:00
|
|
|
struct content **stylesheet_content;
|
2004-02-20 03:43:17 +03:00
|
|
|
struct css_style *style; /**< Base style. */
|
|
|
|
|
|
|
|
struct font_set *fonts; /**< Set of fonts. */
|
|
|
|
|
|
|
|
/** Number of entries in object. */
|
|
|
|
unsigned int object_count;
|
|
|
|
/** Objects. Each may be 0. */
|
2003-09-08 01:08:13 +04:00
|
|
|
struct {
|
2004-02-20 03:43:17 +03:00
|
|
|
char *url; /**< URL of this object. */
|
|
|
|
struct content *content; /**< Content, or 0. */
|
|
|
|
struct box *box; /**< Node in box tree containing it. */
|
2004-01-24 20:08:16 +03:00
|
|
|
/** Pointer to array of permitted content_type, terminated by
|
|
|
|
* CONTENT_UNKNOWN, or 0 if any type is acceptable. */
|
|
|
|
const content_type *permitted_types;
|
2004-06-09 23:55:06 +04:00
|
|
|
bool background; /** Is this object a background image? */
|
2003-09-08 01:08:13 +04:00
|
|
|
} *object;
|
2004-02-20 03:43:17 +03:00
|
|
|
|
2004-03-27 01:16:31 +03:00
|
|
|
struct imagemap **imagemaps; /**< Hashtable of imagemaps */
|
|
|
|
|
2004-01-02 15:04:04 +03:00
|
|
|
pool box_pool; /**< Memory pool for box tree. */
|
|
|
|
pool string_pool; /**< Memory pool for strings. */
|
2004-08-12 02:08:26 +04:00
|
|
|
|
|
|
|
/**< Browser window containing this document, or 0 if not open. */
|
|
|
|
struct browser_window *bw;
|
2003-09-08 01:08:13 +04:00
|
|
|
};
|
2003-02-09 15:58:15 +03:00
|
|
|
|
2004-10-18 01:10:19 +04:00
|
|
|
/** Render padding and margin box outlines in html_redraw(). */
|
|
|
|
extern bool html_redraw_debug;
|
|
|
|
|
2004-02-20 03:43:17 +03:00
|
|
|
|
2004-06-11 00:41:26 +04:00
|
|
|
bool html_create(struct content *c, const char *params[]);
|
|
|
|
bool html_process_data(struct content *c, char *data, unsigned int size);
|
|
|
|
bool html_convert(struct content *c, int width, int height);
|
|
|
|
void html_reformat(struct content *c, int width, int height);
|
2003-02-09 15:58:15 +03:00
|
|
|
void html_destroy(struct content *c);
|
2004-01-24 20:08:16 +03:00
|
|
|
void html_fetch_object(struct content *c, char *url, struct box *box,
|
2004-05-21 18:26:59 +04:00
|
|
|
const content_type *permitted_types,
|
2004-06-10 03:13:55 +04:00
|
|
|
int available_width, int available_height,
|
|
|
|
bool background);
|
2004-06-21 03:09:52 +04:00
|
|
|
void html_stop(struct content *c);
|
2004-08-12 02:08:26 +04:00
|
|
|
void html_open(struct content *c, struct browser_window *bw,
|
2003-07-15 02:57:45 +04:00
|
|
|
struct content *page, struct box *box,
|
2004-08-12 02:08:26 +04:00
|
|
|
struct object_params *params);
|
|
|
|
void html_close(struct content *c);
|
2003-11-13 01:22:45 +03:00
|
|
|
|
2004-10-18 01:10:19 +04:00
|
|
|
/* in render/html_redraw.c */
|
2004-08-11 20:26:13 +04:00
|
|
|
bool html_redraw(struct content *c, int x, int y,
|
2004-06-11 00:41:26 +04:00
|
|
|
int width, int height,
|
|
|
|
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
2004-08-15 23:06:24 +04:00
|
|
|
float scale, unsigned long background_colour);
|
2003-02-09 15:58:15 +03:00
|
|
|
|
|
|
|
#endif
|