NetSurf
browser_private.h
Go to the documentation of this file.
1/*
2 * Copyright 2003 Phil Mellor <monkeyson@users.sourceforge.net>
3 * Copyright 2006 James Bursa <bursa@users.sourceforge.net>
4 *
5 * This file is part of NetSurf, http://www.netsurf-browser.org/
6 *
7 * NetSurf is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * NetSurf is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20/**
21 * \file
22 * Browser window private structure.
23 */
24
25#ifndef NETSURF_DESKTOP_BROWSER_PRIVATE_H_
26#define NETSURF_DESKTOP_BROWSER_PRIVATE_H_
27
28#include "content/fetch.h"
29#include "desktop/frame_types.h"
30
31struct box;
32struct hlcache_handle;
33struct gui_window;
34struct selection;
35struct nsurl;
36
37/**
38 * history entry page information
39 */
41 struct nsurl *url; /**< Page URL, never NULL. */
42 lwc_string *frag_id; /** Fragment identifier, or NULL. */
43 char *title; /**< Page title, never NULL. */
44 struct bitmap *bitmap; /**< Thumbnail bitmap, or NULL. */
45 float scroll_x; /**< Scroll X offset when visited */
46 float scroll_y; /**< Scroll Y offset when visited */
47};
48
49/**
50 * A node in the history tree.
51 */
54 struct history_entry *back; /**< Parent. */
55 struct history_entry *next; /**< Next sibling. */
56 struct history_entry *forward; /**< First child. */
57 struct history_entry *forward_pref; /**< Child in direction of
58 current entry. */
59 struct history_entry *forward_last; /**< Last child. */
60 unsigned int children; /**< Number of children. */
61 int x; /**< Position of node. */
62 int y; /**< Position of node. */
63};
64
65/**
66 * History tree for a window.
67 */
68struct history {
69 /** First page in tree (page that window opened with). */
71 /** Current position in tree. */
73 /** Width of layout. */
74 int width;
75 /** Height of layout. */
76 int height;
77};
78
79/**
80 * The parameters for a fetch.
81 */
83 struct nsurl *url; /**< The URL to fetch */
84 struct nsurl *referrer; /**< Optional refererer */
85 enum browser_window_nav_flags flags; /**< Navigation flags */
86 char *post_urlenc; /**< URL encoded post data */
87 struct fetch_multipart_data *post_multipart; /**< Multipart post data */
88 char *parent_charset; /**< Optional parent character set */
89 bool parent_quirks; /**< Optional parent quirks */
90};
91
92
93/**
94 * Browser window data.
95 */
97 /**
98 * Content handle of page currently displayed which must have
99 * READY or DONE status or NULL for no content.
100 */
102
103 /**
104 * The fetch parameters for the current content
105 */
107
108 /**
109 * The certificate chain for the current content
110 */
112
113 /**
114 * Content handle of page in process of being loaded or NULL
115 * if no page is being loaded.
116 */
118
119 /**
120 * The fetch parameters for the loading content
121 */
123
124 /**
125 * The certificate chain for the loading content
126 */
128
129 /**
130 * Favicon
131 */
132 struct {
133 /**
134 * content handle of current page favicon
135 */
137
138 /**
139 * content handle for favicon which we started loading
140 * early
141 */
143
144 /**
145 * flag to indicate favicon fetch already failed which
146 * prevents infinite error looping.
147 */
148 bool failed;
150
151 /** local history handle. */
153
154 /**
155 * Platform specific window data only valid at top level.
156 */
158
159 /** Busy indicator is active. */
161 /** Add loading_content to the window history when it loads. */
163 /** Internal navigation, do not update URL etc */
165
166 /** Fragment identifier for current_content. */
167 lwc_string *frag_id;
168
169 /**
170 * Current drag status.
171 *
172 * These values are only vald whle type is not DRAGGING_NONE
173 */
174 struct {
175 /** the type of drag in progress */
177
178 /** Current drag's browser window, when not in root bw. */
180
181 /** Mouse position at start of current scroll drag. */
184
185 /** Scroll offsets at start of current scroll draw. */
188
189 /** Frame resize directions for current frame resize drag. */
190 unsigned int resize_left : 1;
191 unsigned int resize_right : 1;
192 unsigned int resize_up : 1;
193 unsigned int resize_down : 1;
195
196 /** Current fetch is download */
198
199 /** Refresh interval (-1 if undefined) */
201
202 /** Window dimensions */
203 int x;
204 int y;
205 int width;
207
208 struct scrollbar *scroll_x; /**< Horizontal scroll. */
209 struct scrollbar *scroll_y; /**< Vertical scroll. */
210
211 /** scale of window contents */
212 float scale;
213
214 /** Window characteristics */
215 enum {
221
222 /** frameset characteristics */
223 int rows;
224 int cols;
225
226 /** frame dimensions */
231
232 /** frame name for targetting */
233 char *name;
234
235 /** frame characteristics */
238 bool border;
240
241 /** iframe parent box */
242 struct box *box;
243
244 /** [cols * rows] children */
247
248 /** [iframe_count] iframes */
251
252 /** browser window child of root browser window which has input focus */
254
255 /** Last time a link was followed in this window */
256 uint64_t last_action;
257
258 /** Current selection */
259 struct {
264
265 /** current javascript context */
266 struct jsheap *jsheap;
267
268 /** cache of the currently displayed status text. */
269 struct {
270 char *text; /**< Current status bar text. */
271 int text_len; /**< Length of the status::text buffer. */
272 int match; /**< Number of times an idempotent status-set operation was performed. */
273 int miss; /**< Number of times status was really updated. */
275};
276
277
278/**
279 * Initialise common parts of a browser window
280 *
281 * \param flags Flags to control operation
282 * \param bw The window to initialise
283 * \param existing The existing window if cloning, else NULL
284 */
286 struct browser_window *bw,
287 const struct browser_window *existing);
288
289
290/**
291 * Release all memory associated with a browser window.
292 *
293 * \param bw browser window
294 */
296
297/**
298 * Get the dimensions of the area a browser window occupies
299 *
300 * \param bw The browser window to get dimensions of
301 * \param width Updated to the browser window viewport width
302 * \param height Updated to the browser window viewport height
303 * \return NSERROR_OK and width and height updated otherwise error code
304 */
306 int *width, int *height);
307
308
309/**
310 * Update the extent of the inside of a browser window to that of the current
311 * content
312 *
313 * \param bw browser_window to update the extent of
314 */
316
317
318/**
319 * Cause an area of a browser window to be marked invalid and hence redrawn.
320 *
321 * \param bw The browser window to update.
322 * \param rect The area to redraw
323 */
325
326
327/**
328 * Change the status bar of a browser window.
329 *
330 * \param bw browser window
331 * \param text new status text (copied)
332 */
333void browser_window_set_status(struct browser_window *bw, const char *text);
334
335
336/**
337 * Get the root level browser window
338 *
339 * \param bw browser window to set the type of the current drag for
340 * \return root browser window
341 */
343 struct browser_window *bw);
344
345
346/**
347 * Create a new history tree for a browser window window.
348 *
349 * \param bw browser window to create history for.
350 *
351 * \return NSERROR_OK or appropriate error otherwise
352 */
354
355/**
356 * Clone a bw's history tree for new bw
357 *
358 * \param existing browser window with history to clone.
359 * \param clone browser window to make cloned history for.
360 *
361 * \return NSERROR_OK or appropriate error otherwise
362 */
364 struct browser_window *clone);
365
366
367/**
368 * Insert a url into the history tree.
369 *
370 * \param bw browser window with history object
371 * \param content content to add to history
372 * \param frag_id fragment identifier, or NULL.
373 * \return NSERROR_OK or error code on faliure.
374 *
375 * The page is added after the current entry and becomes current.
376 */
378 struct hlcache_handle *content, lwc_string *frag_id);
379
380/**
381 * Update the thumbnail and scroll offsets for the current entry.
382 *
383 * \param bw The browser window to update the history within.
384 * \param content content for current entry
385 * \return NSERROR_OK or error code on faliure.
386 */
388 struct hlcache_handle *content);
389
390/**
391 * Retrieve the stored scroll offsets for the current history entry
392 *
393 * \param bw The browser window to retrieve scroll offsets for.
394 * \param sx Pointer to a float for the X scroll offset
395 * \param sy Pointer to a float for the Y scroll offset
396 * \return NSERROR_OK or error code on failure.
397 */
399 float *sx, float *sy);
400
401/**
402 * Free a history structure.
403 *
404 * \param bw The browser window to destroy the history within.
405 */
407
408/**
409 * Type for handling query responses short-term
410 */
411typedef nserror (*browser_window_query_callback)(bool proceed, void *pw);
412
413/**
414 * Navigate a browser window to the current parameters
415 *
416 * \param bw The browser window to cause to navigate
417 */
419
420#endif
nserror browser_window_history_add(struct browser_window *bw, struct hlcache_handle *content, lwc_string *frag_id)
Insert a url into the history tree.
nserror browser_window_initialise_common(enum browser_window_create_flags flags, struct browser_window *bw, const struct browser_window *existing)
Initialise common parts of a browser window.
nserror(* browser_window_query_callback)(bool proceed, void *pw)
Type for handling query responses short-term.
void browser_window_update_extent(struct browser_window *bw)
Update the extent of the inside of a browser window to that of the current content.
nserror browser_window_history_update(struct browser_window *bw, struct hlcache_handle *content)
Update the thumbnail and scroll offsets for the current entry.
nserror browser_window_history_create(struct browser_window *bw)
Create a new history tree for a browser window window.
nserror browser_window_history_get_scroll(struct browser_window *bw, float *sx, float *sy)
Retrieve the stored scroll offsets for the current history entry.
nserror browser_window_get_dimensions(struct browser_window *bw, int *width, int *height)
Get the dimensions of the area a browser window occupies.
nserror browser_window_destroy_internal(struct browser_window *bw)
Release all memory associated with a browser window.
nserror browser_window_invalidate_rect(struct browser_window *bw, struct rect *rect)
Cause an area of a browser window to be marked invalid and hence redrawn.
nserror browser_window_history_clone(const struct browser_window *existing, struct browser_window *clone)
Clone a bw's history tree for new bw.
nserror browser_window__reload_current_parameters(struct browser_window *bw)
Navigate a browser window to the current parameters.
void browser_window_history_destroy(struct browser_window *bw)
Free a history structure.
void browser_window_set_status(struct browser_window *bw, const char *text)
Change the status bar of a browser window.
struct browser_window * browser_window_get_root(struct browser_window *bw)
Get the root level browser window.
browser_drag_type
type of browser window drag in progess
browser_scrolling
browser_window_create_flags
flags to browser_window_create
browser_window_nav_flags
flags to browser_window_navigate
Fetching of data from a URL (interface).
nserror
Enumeration of error codes.
Definition: errors.h:29
Interface to browser frames.
struct nsurl nsurl
NetSurf URL object.
Definition: nsurl.h:31
int width
Definition: gui.c:159
int height
Definition: gui.c:160
RISC OS wimp toolkit bitmap.
Definition: bitmap.c:68
Node in box tree.
Definition: box.h:177
The parameters for a fetch.
struct nsurl * url
The URL to fetch.
enum browser_window_nav_flags flags
Navigation flags.
char * parent_charset
Optional parent character set.
bool parent_quirks
Optional parent quirks.
struct fetch_multipart_data * post_multipart
Multipart post data.
char * post_urlenc
URL encoded post data.
struct nsurl * referrer
Optional refererer.
Browser window data.
struct browser_fetch_parameters loading_parameters
The fetch parameters for the loading content.
browser_scrolling scrolling
struct browser_window * iframes
struct scrollbar * scroll_x
Horizontal scroll.
unsigned int resize_up
struct browser_window * window
Current drag's browser window, when not in root bw.
struct browser_window::@59 drag
Current drag status.
int x
Window dimensions.
struct browser_window * bw
float scale
scale of window contents
struct frame_dimension frame_height
int rows
frameset characteristics
struct browser_window::@58 favicon
Favicon.
char * text
Current status bar text.
bool download
Current fetch is download.
int start_scroll_x
Scroll offsets at start of current scroll draw.
int match
Number of times an idempotent status-set operation was performed.
struct scrollbar * scroll_y
Vertical scroll.
int miss
Number of times status was really updated.
bool history_add
Add loading_content to the window history when it loads.
bool failed
flag to indicate favicon fetch already failed which prevents infinite error looping.
int iframe_count
[iframe_count] iframes
unsigned int resize_left
Frame resize directions for current frame resize drag.
struct cert_chain * loading_cert_chain
The certificate chain for the loading content.
int refresh_interval
Refresh interval (-1 if undefined)
struct browser_window * parent
struct browser_window::@62 status
cache of the currently displayed status text.
struct cert_chain * current_cert_chain
The certificate chain for the current content.
unsigned int resize_right
lwc_string * frag_id
Fragment identifier for current_content.
uint64_t last_action
Last time a link was followed in this window.
struct hlcache_handle * current
content handle of current page favicon
struct gui_window * window
Platform specific window data only valid at top level.
int text_len
Length of the status::text buffer.
int start_x
Mouse position at start of current scroll drag.
bool no_resize
frame characteristics
bool throbbing
Busy indicator is active.
struct hlcache_handle * loading
content handle for favicon which we started loading early
struct box * box
iframe parent box
struct history * history
local history handle.
struct jsheap * jsheap
current javascript context
struct browser_window * children
[cols * rows] children
browser_drag_type type
the type of drag in progress
struct hlcache_handle * current_content
Content handle of page currently displayed which must have READY or DONE status or NULL for no conten...
struct browser_window::@61 selection
Current selection.
bool internal_nav
Internal navigation, do not update URL etc.
unsigned int resize_down
char * name
frame name for targetting
struct hlcache_handle * loading_content
Content handle of page in process of being loaded or NULL if no page is being loaded.
enum browser_window::@60 browser_window_type
Window characteristics.
struct browser_fetch_parameters current_parameters
The fetch parameters for the current content.
struct frame_dimension frame_width
frame dimensions
struct browser_window * focus
browser window child of root browser window which has input focus
X509 certificate chain.
Definition: ssl_certs.h:59
Content which corresponds to a single URL.
Fetch POST multipart data.
Definition: fetch.h:109
first entry in window list
Definition: gui.c:296
A node in the history tree.
int x
Position of node.
struct history_entry * forward_last
Last child.
struct history_entry * back
Parent.
unsigned int children
Number of children.
struct history_entry * forward
First child.
struct history_entry * next
Next sibling.
struct history_page page
struct history_entry * forward_pref
Child in direction of current entry.
int y
Position of node.
history entry page information
float scroll_y
Scroll Y offset when visited.
lwc_string * frag_id
float scroll_x
Scroll X offset when visited.
struct bitmap * bitmap
Thumbnail bitmap, or NULL.
char * title
Fragment identifier, or NULL.
struct nsurl * url
Page URL, never NULL.
History tree for a window.
int width
Width of layout.
int height
Height of layout.
struct history_entry * current
Current position in tree.
struct history_entry * start
First page in tree (page that window opened with).
High-level cache handle.
Definition: hlcache.c:66
dukky javascript heap
Definition: dukky.c:59
Rectangle coordinates.
Definition: types.h:40
Scrollbar context.
Definition: scrollbar.c:44
uint32_t colour
Colour type: XBGR.
Definition: types.h:35
static nserror text(const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length)
Text plotting.
Definition: plot.c:978