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-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;
|
|
|
|
struct object_params;
|
|
|
|
|
|
|
|
struct box_position {
|
|
|
|
struct box *box;
|
|
|
|
int actual_box_x;
|
|
|
|
int actual_box_y;
|
|
|
|
int plot_index;
|
|
|
|
int pixel_offset;
|
|
|
|
int char_offset;
|
|
|
|
};
|
|
|
|
|
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. */
|
|
|
|
|
|
|
|
char *source; /**< Source data. */
|
|
|
|
int length; /**< Length of source. */
|
|
|
|
xmlCharEncoding encoding; /**< Encoding of source. */
|
|
|
|
|
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-02-20 03:43:17 +03:00
|
|
|
/** Stylesheets. Each may be 0. Stylesheet 0 is the base style sheet,
|
|
|
|
* stylesheet 1 is any <style> elements (not cached). */
|
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. */
|
|
|
|
|
2003-09-08 01:08:13 +04:00
|
|
|
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;
|
2004-02-20 03:43:17 +03:00
|
|
|
|
|
|
|
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;
|
2003-09-08 01:08:13 +04:00
|
|
|
} *object;
|
2004-02-20 03:43:17 +03:00
|
|
|
|
2004-01-02 15:04:04 +03:00
|
|
|
pool box_pool; /**< Memory pool for box tree. */
|
|
|
|
pool string_pool; /**< Memory pool for strings. */
|
2003-09-08 01:08:13 +04:00
|
|
|
};
|
2003-02-09 15:58:15 +03:00
|
|
|
|
2004-02-20 03:43:17 +03:00
|
|
|
|
2003-12-27 23:15:23 +03:00
|
|
|
void html_create(struct content *c, const char *params[]);
|
2003-02-09 15:58:15 +03:00
|
|
|
void html_process_data(struct content *c, char *data, unsigned long size);
|
|
|
|
int html_convert(struct content *c, unsigned int width, unsigned int height);
|
|
|
|
void html_revive(struct content *c, unsigned int width, unsigned int height);
|
|
|
|
void html_reformat(struct content *c, unsigned int width, unsigned int height);
|
|
|
|
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,
|
|
|
|
const content_type *permitted_types);
|
2003-11-13 01:22:45 +03:00
|
|
|
|
|
|
|
/* in riscos/htmlinstance.c */
|
2003-07-15 02:57:45 +04:00
|
|
|
void html_add_instance(struct content *c, struct browser_window *bw,
|
|
|
|
struct content *page, struct box *box,
|
|
|
|
struct object_params *params, void **state);
|
2003-09-04 01:58:54 +04:00
|
|
|
void html_reshape_instance(struct content *c, struct browser_window *bw,
|
|
|
|
struct content *page, struct box *box,
|
|
|
|
struct object_params *params, void **state);
|
2003-07-15 02:57:45 +04:00
|
|
|
void html_remove_instance(struct content *c, struct browser_window *bw,
|
|
|
|
struct content *page, struct box *box,
|
|
|
|
struct object_params *params, void **state);
|
2003-11-13 01:22:45 +03:00
|
|
|
|
|
|
|
/* in riscos/htmlredraw.c */
|
2003-07-15 18:37:34 +04:00
|
|
|
void html_redraw(struct content *c, long x, long y,
|
2003-09-10 21:10:25 +04:00
|
|
|
unsigned long width, unsigned long height,
|
2004-02-25 18:12:58 +03:00
|
|
|
long clip_x0, long clip_y0, long clip_x1, long clip_y1,
|
|
|
|
float scale);
|
2003-02-09 15:58:15 +03:00
|
|
|
|
|
|
|
#endif
|