NetSurf
html.h
Go to the documentation of this file.
1/*
2 * Copyright 2004 James Bursa <bursa@users.sourceforge.net>
3 *
4 * This file is part of NetSurf, http://www.netsurf-browser.org/
5 *
6 * NetSurf is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * NetSurf is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19/**
20 * \file
21 * Interface to text/html content handler.
22 *
23 * These functions should in general be called via the content interface.
24 */
25
26#ifndef NETSURF_HTML_HTML_H
27#define NETSURF_HTML_HTML_H
28
29#include <stdbool.h>
30
31#include "netsurf/types.h"
34#include "netsurf/mouse.h"
35#include "desktop/frame_types.h"
36
38struct box;
39struct rect;
40struct browser_window;
41struct content;
42struct hlcache_handle;
43struct http_parameter;
44struct imagemap;
45struct object_params;
46struct plotters;
47struct textarea;
48struct scrollbar;
50struct search_context;
51struct selection;
52struct nsurl;
53struct plot_font_style;
54
55/**
56 * Container for stylesheets used by an HTML document
57 */
59 struct dom_node *node; /**< dom node associated with sheet */
62 bool unused;
63};
64
65
66/**
67 * Container for scripts used by an HTML document
68 */
70 /** Type of script */
75 union {
77 struct dom_string *string;
78 } data; /**< Script data */
79 struct dom_string *mimetype;
80 struct dom_string *encoding;
85 bool async;
86 bool defer;
87};
88
89
90/**
91 * An object (img, object, etc. tag) in a CONTENT_HTML document.
92 */
94 struct content *parent; /**< Parent document */
95 struct content_html_object *next; /**< Next in chain */
96
97 struct hlcache_handle *content; /**< Content, or 0. */
98 struct box *box; /**< Node in box tree containing it. */
99 /** Bitmap of acceptable content types */
101 bool background; /**< This object is a background image. */
102};
103
104
105/**
106 * Frame tree (frameset or frame tag)
107 */
109 int cols; /** number of columns in frameset */
110 int rows; /** number of rows in frameset */
111
112 struct frame_dimension width; /** frame width */
113 struct frame_dimension height; /** frame width */
114 int margin_width; /** frame margin width */
115 int margin_height; /** frame margin height */
116
117 char *name; /** frame name (for targetting) */
118 struct nsurl *url; /** frame url */
119
120 bool no_resize; /** frame is not resizable */
121 browser_scrolling scrolling; /** scrolling characteristics */
122 bool border; /** frame has a border */
123 colour border_colour; /** frame border colour */
124
125 struct content_html_frames *children; /** [cols * rows] children */
126};
127
128/**
129 * Inline frame list (iframe tag)
130 */
132 struct box *box;
133
134 int margin_width; /** frame margin width */
135 int margin_height; /** frame margin height */
136
137 char *name; /** frame name (for targetting) */
138 struct nsurl *url; /** frame url */
139
140 browser_scrolling scrolling; /** scrolling characteristics */
141 bool border; /** frame has a border */
142 colour border_colour; /** frame border colour */
143
145};
146
147/* entries in stylesheet_content */
148#define STYLESHEET_BASE 0 /* base style sheet */
149#define STYLESHEET_QUIRKS 1 /* quirks mode stylesheet */
150#define STYLESHEET_ADBLOCK 2 /* adblocking stylesheet */
151#define STYLESHEET_USER 3 /* user stylesheet */
152#define STYLESHEET_START 4 /* start of document stylesheets */
153
154/**
155 * initialise content handler
156 *
157 * \return NSERROR_OK on success otherwise appropriate error code
158 */
159nserror html_init(void);
160
161/**
162 * redraw a specific box
163 *
164 * used by core browser
165 */
166void html_redraw_a_box(struct hlcache_handle *h, struct box *box);
167
168/**
169 * obtain html frame content from handle
170 *
171 * used by core browser
172 */
174
175/**
176 * obtain html iframe content from handle
177 *
178 * used by core browser
179 */
181
182/**
183 * obtain html base target from handle
184 *
185 * used by core browser
186 */
187const char *html_get_base_target(struct hlcache_handle *h);
188
189/**
190 * set filename on a file gadget
191 *
192 * used by core browser
193 */
195 struct form_control *gadget, const char *fn);
196
197/**
198 * Retrieve stylesheets used by HTML document
199 *
200 * \param h Content to retrieve stylesheets from
201 * \param n Pointer to location to receive number of sheets
202 * \return Pointer to array of stylesheets
203 */
205 unsigned int *n);
206
207/**
208 * Retrieve objects used by HTML document
209 *
210 * \param h Content to retrieve objects from
211 * \param n Pointer to location to receive number of objects
212 * \return Pointer to array of objects
213 */
215 unsigned int *n);
216
217/**
218 * get the offset within the docuemnt of a fragment id
219 */
220bool html_get_id_offset(struct hlcache_handle *h, lwc_string *frag_id,
221 int *x, int *y);
222
223#endif
Browser window creation and manipulation interface.
browser_scrolling
Declaration of content enumerations.
content_type
The type of a content.
Definition: content_type.h:53
nserror
Enumeration of error codes.
Definition: errors.h:29
Interface to browser frames.
struct atari_hotlist hl
Definition: hotlist.c:47
bool html_get_id_offset(struct hlcache_handle *h, lwc_string *frag_id, int *x, int *y)
get the offset within the docuemnt of a fragment id
Definition: html.c:2073
nserror html_init(void)
initialise content handler
Definition: html.c:2382
struct html_stylesheet * html_get_stylesheets(struct hlcache_handle *h, unsigned int *n)
Retrieve stylesheets used by HTML document.
Definition: css.c:498
const char * html_get_base_target(struct hlcache_handle *h)
obtain html base target from handle
Definition: html.c:2054
void html_redraw_a_box(struct hlcache_handle *h, struct box *box)
redraw a specific box
Definition: html.c:1111
struct content_html_object * html_get_objects(struct hlcache_handle *h, unsigned int *n)
Retrieve objects used by HTML document.
Definition: object.c:60
struct content_html_iframe * html_get_iframe(struct hlcache_handle *h)
obtain html iframe content from handle
Definition: html.c:2024
struct content_html_frames * html_get_frameset(struct hlcache_handle *h)
obtain html frame content from handle
Definition: html.c:2009
void html_set_file_gadget_filename(struct hlcache_handle *hl, struct form_control *gadget, const char *fn)
set filename on a file gadget
Definition: html.c:1666
Core mouse and pointer states.
static const struct plotter_table plotters
monkey plotter operations table
Definition: plot.c:254
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31
Node in box tree.
Definition: box.h:177
Browser window data.
Frame tree (frameset or frame tag)
Definition: html.h:108
char * name
frame margin height
Definition: html.h:117
int rows
number of columns in frameset
Definition: html.h:110
struct content_html_frames * children
frame border colour
Definition: html.h:125
bool no_resize
frame url
Definition: html.h:120
int margin_width
frame width
Definition: html.h:114
struct nsurl * url
frame name (for targetting)
Definition: html.h:118
browser_scrolling scrolling
frame is not resizable
Definition: html.h:121
bool border
scrolling characteristics
Definition: html.h:122
colour border_colour
frame has a border
Definition: html.h:123
int margin_height
frame margin width
Definition: html.h:115
struct frame_dimension width
number of rows in frameset
Definition: html.h:112
struct frame_dimension height
frame width
Definition: html.h:113
Inline frame list (iframe tag)
Definition: html.h:131
struct content_html_iframe * next
frame border colour
Definition: html.h:144
struct box * box
Definition: html.h:132
int margin_height
frame margin width
Definition: html.h:135
browser_scrolling scrolling
frame url
Definition: html.h:140
struct nsurl * url
frame name (for targetting)
Definition: html.h:138
colour border_colour
frame has a border
Definition: html.h:142
bool border
scrolling characteristics
Definition: html.h:141
char * name
frame margin height
Definition: html.h:137
An object (img, object, etc.
Definition: html.h:93
bool background
This object is a background image.
Definition: html.h:101
struct content_html_object * next
Next in chain.
Definition: html.h:95
content_type permitted_types
Bitmap of acceptable content types.
Definition: html.h:100
struct box * box
Node in box tree containing it.
Definition: html.h:98
struct content * parent
Parent document.
Definition: html.h:94
struct hlcache_handle * content
Content, or 0.
Definition: html.h:97
Content which corresponds to a single URL.
Fetch POST multipart data.
Definition: fetch.h:109
Form control.
Definition: form_internal.h:73
High-level cache handle.
Definition: hlcache.c:66
Container for scripts used by an HTML document.
Definition: html.h:69
struct dom_string * encoding
Definition: html.h:80
struct dom_string * mimetype
Definition: html.h:79
union html_script::@136 data
Script data.
enum html_script::html_script_type type
bool defer
Definition: html.h:86
bool async
Definition: html.h:85
bool ready_exec
Definition: html.h:84
html_script_type
Type of script.
Definition: html.h:71
@ HTML_SCRIPT_DEFER
Definition: html.h:73
@ HTML_SCRIPT_INLINE
Definition: html.h:71
@ HTML_SCRIPT_SYNC
Definition: html.h:72
@ HTML_SCRIPT_ASYNC
Definition: html.h:74
bool force_async
Definition: html.h:83
bool parser_inserted
Definition: html.h:82
struct dom_string * string
Definition: html.h:77
bool already_started
Definition: html.h:81
struct hlcache_handle * handle
Definition: html.h:76
Container for stylesheets used by an HTML document.
Definition: html.h:58
bool unused
Definition: html.h:62
struct dom_node * node
dom node associated with sheet
Definition: html.h:59
struct hlcache_handle * sheet
Definition: html.h:60
bool modified
Definition: html.h:61
Representation of an HTTP parameter.
Definition: parameter.c:31
Parameters for object element and similar elements.
Definition: box.h:164
Font style for plotting.
Definition: plot_style.h:111
Rectangle coordinates.
Definition: types.h:40
scrollbar message context data
Definition: scrollbar.h:59
Scrollbar context.
Definition: scrollbar.c:44
NetSurf types.
uint32_t colour
Colour type: XBGR.
Definition: types.h:35