27#include <nsutils/time.h>
44#define URL_FMT_SPC "%.140s"
111 switch (event->
type) {
157 msg_data.
redirect.
to =
event->data.redirect.to;
183 (
float) c->
time / 1000);
192 lwc_string *imime_type,
195 const char *fallback_charset,
205 if (user_sentinel == NULL) {
209 if (fallback_charset != NULL) {
218 c->
mime_type = lwc_string_ref(imime_type);
227 nsu_getmonotonic_ms(&c->
time);
232 user_sentinel->
pw = NULL;
233 user_sentinel->
next = NULL;
303 nsu_getmonotonic_ms(&now_ms);
337 assert(c->
locked ==
false);
359 NSLOG(netsurf, INFO,
"content %p %s", c,
361 assert(c->
locked ==
false);
373 while (link != NULL) {
383 if (c->
title != NULL) {
485 NSLOG(netsurf, DEEPDEBUG,
"Unable to exec, content locked");
491 NSLOG(netsurf, DEEPDEBUG,
"Unable to exec, no exec function");
508 if ((lwc_string_isequal(scheme, corestring_lwc_about,
509 &match) == lwc_error_ok &&
511 (lwc_string_isequal(scheme, corestring_lwc_data,
512 &match) == lwc_error_ok &&
514 (lwc_string_isequal(scheme, corestring_lwc_resource,
515 &match) == lwc_error_ok &&
518 (lwc_string_isequal(scheme, corestring_lwc_x_ns_css,
519 &match) == lwc_error_ok &&
522 (lwc_string_isequal(scheme, corestring_lwc_file,
523 &match) == lwc_error_ok &&
526 lwc_string_unref(scheme);
531 if ((lwc_string_isequal(scheme, corestring_lwc_https,
532 &match) == lwc_error_ok)
533 && (match ==
false)) {
535 lwc_string_unref(scheme);
539 lwc_string_unref(scheme);
702 if (user->
next == 0) {
703 NSLOG(netsurf, INFO,
"user not found in list");
721 uint32_t counter = 0;
758 NSLOG(netsurf, DEEPDEBUG,
"%p -> msg:%d", c, msg);
801 NSLOG(netsurf, INFO,
"content %p %s", c,
829 NSLOG(netsurf, INFO,
"content %p %s", c,
958 bool rel_match =
false;
960 while (link != NULL) {
961 if (lwc_string_caseless_isequal(link->
rel,
rel,
962 &rel_match) == lwc_error_ok && rel_match) {
979 lwc_string_unref(link->
rel);
984 if (link->
type != NULL) {
985 lwc_string_unref(link->
type);
987 if (link->
media != NULL) {
988 lwc_string_unref(link->
media);
990 if (link->
sizes != NULL) {
991 lwc_string_unref(link->
sizes);
1008 if (link->
rel == NULL) {
1013 if (link->
href == NULL) {
1018 if (newlink == NULL) {
1023 newlink->
rel = lwc_string_ref(link->
rel);
1028 if (link->
type != NULL) {
1029 newlink->
type = lwc_string_ref(link->
type);
1031 if (link->
media != NULL) {
1032 newlink->
media = lwc_string_ref(link->
media);
1034 if (link->
sizes != NULL) {
1035 newlink->
sizes = lwc_string_ref(link->
sizes);
1092 char *new_title = strdup(
title);
1093 if (new_title == NULL)
1096 if (c->
title != NULL)
1099 c->
title = new_title;
1218 assert(
size != NULL);
1238 if (c == NULL || c->
llcache == NULL)
1331 const char *encoding = NULL;
1422 if (c->
title != NULL) {
1424 if (nc->
title == NULL) {
1450 NSLOG(netsurf, INFO,
"Aborting %p", c);
Browser window creation and manipulation interface.
const uint8_t * content_get_source_data(hlcache_handle *h, size_t *size)
Retrieve source of content.
int content__get_available_width(struct content *c)
Retrieve available width of content.
char * content_get_selection(hlcache_handle *h)
Get a text selection from a content.
const char * content_get_encoding(hlcache_handle *h, enum content_encoding_type op)
Retrieve the encoding of a content.
nsurl * content__get_refresh_url(struct content *c)
Retrieve the refresh URL for a content.
bool content_get_quirks(hlcache_handle *h)
Retrieve quirkiness of a content.
void content_destroy(struct content *c)
Destroy and free a content.
nserror content_debug_dump(struct hlcache_handle *h, FILE *f, enum content_debug op)
Dump debug information to file.
bool content_exec(struct hlcache_handle *h, const char *src, size_t srclen)
Execute some JavaScript code inside a content object.
bool content_is_locked(hlcache_handle *h)
Return whether a content is currently locked.
bool content__add_rfc5988_link(struct content *c, const struct content_rfc5988_link *link)
associate a metadata link with a content.
struct content_rfc5988_link * content_find_rfc5988_link(hlcache_handle *h, lwc_string *rel)
find link in content that matches the rel string.
struct bitmap * content_get_bitmap(hlcache_handle *h)
Retrieve the bitmap contained in an image content.
void content_mouse_action(hlcache_handle *h, struct browser_window *bw, browser_mouse_state mouse, int x, int y)
Handle mouse clicks and movements in a content window.
bool content__get_opaque(struct content *c)
Determine if a content is opaque.
lwc_string * content__get_mime_type(struct content *c)
Retrieve mime-type of content.
void content__reformat(struct content *c, bool background, int width, int height)
cause a content to be reformatted.
void content_broadcast(struct content *c, content_msg msg, const union content_msg_data *data)
Send a message to all users.
int content__get_height(struct content *c)
Retrieve height of content.
void content_request_redraw(struct hlcache_handle *h, int x, int y, int width, int height)
Request a redraw of an area of a content.
void content_clear_selection(hlcache_handle *h)
Tell a content that any selection it has, or one of its objects has, must be cleared.
nserror content_close(hlcache_handle *h)
The window containing the content has been closed.
content_type content_get_type(hlcache_handle *h)
Retrieve computed type of content.
void content_remove_user(struct content *c, void(*callback)(struct content *c, content_msg msg, const union content_msg_data *data, void *pw), void *pw)
Remove a callback user.
static void content_update_status(struct content *c)
update content status message
struct content_rfc5988_link * content__free_rfc5988_link(struct content_rfc5988_link *link)
free a rfc5988 link
struct bitmap * content__get_bitmap(struct content *c)
Retrieve the bitmap contained in an image content.
void content_set_done(struct content *c)
Put a content in status CONTENT_STATUS_DONE.
int content__get_width(struct content *c)
Retrieve width of content.
uint32_t content_count_users(struct content *c)
Count users for the content.
bool content_saw_insecure_objects(struct hlcache_handle *h)
Determine if the content referred to any insecure objects.
const char *const content_status_name[]
int content_get_width(hlcache_handle *h)
Retrieve width of content.
const char * content_get_title(hlcache_handle *h)
Retrieve title associated with content.
static void content_convert(struct content *c)
All data has arrived, convert for display.
bool content__set_title(struct content *c, const char *title)
Set title associated with content.
bool content__is_locked(struct content *c)
Return whether a content is currently locked.
nserror content__init(struct content *c, const content_handler *handler, lwc_string *imime_type, const struct http_parameter *params, llcache_handle *llcache, const char *fallback_charset, bool quirks)
const char * content__get_encoding(struct content *c, enum content_encoding_type op)
Retrieve the encoding of a content.
bool content_scroll_at_point(struct hlcache_handle *h, int x, int y, int scrx, int scry)
scroll content at coordnate
bool content_is_shareable(struct content *c)
Determine if a content is shareable.
nserror content_get_contextual_content(struct hlcache_handle *h, int x, int y, struct browser_window_features *data)
Get positional contextural information for a content.
bool content_keypress(struct hlcache_handle *h, uint32_t key)
Handle keypresses.
void content_set_error(struct content *c)
Put a content in status CONTENT_STATUS_ERROR and unlock the content.
void content__request_redraw(struct content *c, int x, int y, int width, int height)
Request a redraw of an area of a content.
content_status content__get_status(struct content *c)
Retrieve status of content.
void content_mouse_track(hlcache_handle *h, struct browser_window *bw, browser_mouse_state mouse, int x, int y)
Handle mouse movements in a content window.
lwc_string * content_get_mime_type(hlcache_handle *h)
Retrieve mime-type of content.
nsurl * content_get_url(struct content *c)
Retrieve URL associated with content.
bool content_can_reformat(hlcache_handle *h)
Get whether a content can reformat.
const uint8_t * content__get_source_data(struct content *c, size_t *size)
Retrieve source of content.
const char * content__get_title(struct content *c)
Retrieve title associated with content.
nserror content__clone(const struct content *c, struct content *nc)
Clone a content's data members.
bool content_add_user(struct content *c, void(*callback)(struct content *c, content_msg msg, const union content_msg_data *data, void *pw), void *pw)
Register a user for callbacks.
void content_set_ready(struct content *c)
Put a content in status CONTENT_STATUS_READY and unlock the content.
bool content_drop_file_at_point(struct hlcache_handle *h, int x, int y, char *file)
Drag and drop a file at coordinate.
int content_get_height(hlcache_handle *h)
Retrieve height of content.
struct content * content_clone(struct content *c)
Clone a content object in its current state.
bool content_matches_quirks(struct content *c, bool quirks)
Determine if quirks mode matches.
void content__invalidate_reuse_data(struct content *c)
Invalidate content reuse data.
nserror content_abort(struct content *c)
Abort a content object.
bool content_get_opaque(hlcache_handle *h)
Determine if a content is opaque from handle.
const llcache_handle * content_get_llcache_handle(struct content *c)
Retrieve the low-level cache handle for a content.
void content_reformat(hlcache_handle *h, bool background, int width, int height)
Reformat to new size.
nsurl * content_get_refresh_url(hlcache_handle *h)
Retrieve the refresh URL for a content.
void content_invalidate_reuse_data(hlcache_handle *h)
Invalidate content reuse data.
const char * content_get_status_message(hlcache_handle *h)
Retrieve status message associated with content.
int content_get_available_width(hlcache_handle *h)
Retrieve available width of content.
bool content_scaled_redraw(struct hlcache_handle *h, int width, int height, const struct redraw_context *ctx)
Redraw a content with scale set for horizontal fit.
const char * content__get_status_message(struct content *c)
Retrieve status message associated with content.
static nserror content_llcache_callback(llcache_handle *llcache, const llcache_event *event, void *pw)
Handler for low-level cache events.
nserror content_debug(struct hlcache_handle *h, enum content_debug op)
Control debug con a content.
void content_set_status(struct content *c, const char *status_message)
Updates content with new status.
nserror content_open(hlcache_handle *h, struct browser_window *bw, struct content *page, struct object_params *params)
A window containing the content has been opened.
content_status content_get_status(hlcache_handle *h)
Retrieve status of content.
void content_broadcast_error(struct content *c, nserror errorcode, const char *msg)
Send an error message to all users.
bool content_redraw(hlcache_handle *h, struct content_redraw_data *data, const struct rect *clip, const struct redraw_context *ctx)
Display content on screen with optional tiling.
Interface to content handling debug.
Protected interface to Content handling.
content_status
Status of a content.
@ CONTENT_STATUS_READY
Some parts of content still being loaded, but can be displayed.
@ CONTENT_STATUS_DONE
Content has completed all processing.
@ CONTENT_STATUS_ERROR
Error occurred, content will be destroyed imminently.
@ CONTENT_STATUS_LOADING
Content is being fetched or converted and is not safe to display.
content_type
The type of a content.
@ CONTENT_IMAGE
All images.
@ CONTENT_NONE
no type for content
content_msg
Used in callbacks to indicate what has occurred.
@ CONTENT_MSG_LINK
RFC5988 link.
@ CONTENT_MSG_STATUS
new status string
@ CONTENT_MSG_DONE
content has finished processing
@ CONTENT_MSG_ERROR
error occurred
@ CONTENT_MSG_REDIRECT
fetch url redirect occured
@ CONTENT_MSG_POINTER
Wants a specific mouse pointer set.
@ CONTENT_MSG_REDRAW
needs redraw (eg.
@ CONTENT_MSG_READY
may be displayed
@ CONTENT_MSG_REFORMAT
content_reformat done
content_debug
Debugging dump operations.
content_encoding_type
Content encoding information types.
Useful interned string pointers (interface).
nserror
Enumeration of error codes.
@ NSERROR_NOT_IMPLEMENTED
Functionality is not implemented.
@ NSERROR_BAD_PARAMETER
Bad Parameter.
@ NSERROR_INVALID
Invalid data.
@ NSERROR_NOMEM
Memory exhaustion.
struct content * hlcache_handle_get_content(const hlcache_handle *handle)
Retrieve a content object from a cache handle.
High-level resource cache interface.
Generic bitmap handling interface.
Public content interface.
struct nsurl * hlcache_handle_get_url(const struct hlcache_handle *handle)
Retrieve the URL associated with a high level cache handle.
browser_mouse_state
Mouse state.
Netsurf additional integer type formatting macros.
bool knockout_plot_end(const struct redraw_context *ctx)
End a knockout plotting session.
bool knockout_plot_start(const struct redraw_context *ctx, struct redraw_context *knk_ctx)
Start a knockout plotting session.
Knockout rendering (interface).
nserror llcache_handle_clone(llcache_handle *handle, llcache_handle **result)
Clone a low-level cache handle, producing a new handle to the same fetch/content.
static struct llcache_s * llcache
low level cache state
nserror llcache_handle_abort(llcache_handle *handle)
Abort a low-level fetch, informing all users of this action.
nsurl * llcache_handle_get_url(const llcache_handle *handle)
Retrieve the post-redirect URL of a low-level cache object.
const uint8_t * llcache_handle_get_source_data(const llcache_handle *handle, size_t *size)
Retrieve source data of a low-level cache object.
nserror llcache_handle_change_callback(llcache_handle *handle, llcache_handle_callback cb, void *pw)
Change the callback associated with a low-level cache handle.
nserror llcache_handle_invalidate_cache_data(llcache_handle *handle)
Invalidate cache data for a low-level cache object.
nserror llcache_handle_release(llcache_handle *handle)
Release a low-level cache handle.
@ LLCACHE_EVENT_DONE
Finished fetching data.
@ LLCACHE_EVENT_ERROR
An error occurred during fetch.
@ LLCACHE_EVENT_GOT_CERTS
SSL certificates arrived.
@ LLCACHE_EVENT_REDIRECT
Fetch URL redirect occured.
@ LLCACHE_EVENT_PROGRESS
Fetch progress update.
@ LLCACHE_EVENT_HAD_HEADERS
Received all headers.
@ LLCACHE_EVENT_HAD_DATA
Received some data.
#define NSLOG(catname, level, logmsg, args...)
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
Localised message support (interface).
void nsurl_unref(nsurl *url)
Drop a reference to a NetSurf URL object.
const char * nsurl_access(const nsurl *url)
Access a NetSurf URL object as a string.
const char * nsurl_access_log(const nsurl *url)
Variant of nsurl_access for logging.
nsurl * nsurl_ref(nsurl *url)
Increment the reference count to a NetSurf URL object.
lwc_string * nsurl_get_component(const nsurl *url, nsurl_component part)
Get part of a URL as a lwc_string, from a NetSurf URL object.
struct nsurl nsurl
NetSurf URL object.
plot_style_t * plot_style_fill_white
Interface to utility string handling.
RISC OS wimp toolkit bitmap.
Page features at a specific spatial location.
struct hlcache_handle * object
Object at position or NULL.
Content operation function table.
nserror(* close)(struct content *c)
void(* reformat)(struct content *c, int width, int height)
bool(* redraw)(struct content *c, struct content_redraw_data *data, const struct rect *clip, const struct redraw_context *ctx)
nserror(* open)(struct content *c, struct browser_window *bw, struct content *page, struct object_params *params)
nserror(* get_contextual_content)(struct content *c, int x, int y, struct browser_window_features *data)
nserror(* mouse_track)(struct content *c, struct browser_window *bw, browser_mouse_state mouse, int x, int y)
void(* clear_selection)(struct content *c)
bool(* data_complete)(struct content *c)
bool(* keypress)(struct content *c, uint32_t key)
bool(* scroll_at_point)(struct content *c, int x, int y, int scrx, int scry)
bool(* process_data)(struct content *c, const char *data, unsigned int size)
void(* add_user)(struct content *c)
bool(* saw_insecure_objects)(struct content *c)
void(* remove_user)(struct content *c)
void(* destroy)(struct content *c)
const char *(* get_encoding)(const struct content *c, enum content_encoding_type op)
nserror(* debug)(struct content *c, enum content_debug op)
nserror(* debug_dump)(struct content *c, FILE *f, enum content_debug op)
nserror(* mouse_action)(struct content *c, struct browser_window *bw, browser_mouse_state mouse, int x, int y)
bool(* exec)(struct content *c, const char *src, size_t srclen)
void(* stop)(struct content *c)
char *(* get_selection)(struct content *c)
content_type(* type)(void)
bool(* is_opaque)(struct content *c)
are the content contents opaque.
bool(* matches_quirks)(const struct content *c, bool quirks)
nserror(* clone)(const struct content *old, struct content **newc)
bool no_share
There must be one content per user for this type.
bool(* drop_file_at_point)(struct content *c, int x, int y, char *file)
void *(* get_internal)(const struct content *c, void *context)
handler dependant content sensitive internal data interface.
parameters to content redraw
int height
vertical dimension
bool repeat_y
whether content is tiled in y direction
bool repeat_x
whether content is tiled in x direction
int y
coordinate for top-left of redraw
int x
coordinate for top-left of redraw
colour background_colour
The background colour.
int width
dimensions to render content at (for scaling contents with intrinsic dimensions)
float scale
Scale for redraw (for scaling contents without intrinsic dimensions)
lwc_string * rel
the link relationship - must be present
struct nsurl * href
the link href - must be present
struct content_rfc5988_link * next
next rfc5988_link in list
Linked list of users of a content.
void(* callback)(struct content *c, content_msg msg, const union content_msg_data *data, void *pw)
struct content_user * next
Content which corresponds to a single URL.
bool quirks
Content is in quirks mode.
int height
Height dimension, if applicable.
struct content_user * user_list
List of users.
lwc_string * mime_type
Original MIME type of data.
char * fallback_charset
Fallback charset, or NULL.
int width
Width dimension, if applicable.
const struct content_handler * handler
Handler for content.
unsigned int active
Number of child fetches or conversions currently in progress.
char status_message[120]
Full text for status bar.
struct llcache_handle * llcache
Low-level cache object.
int available_height
Viewport height.
unsigned long total_size
Total data size, 0 if unknown.
long http_code
HTTP status code, 0 if not HTTP.
struct content::@117 textsearch
Free text search state.
uint64_t time
Creation timestamp when LOADING or READY.
struct textsearch_context * context
content_status status
Current status.
unsigned int size
Estimated size of all data associated with this content.
uint64_t reformat_time
Earliest time to attempt a period reflow while fetching a page's objects.
struct content_rfc5988_link * links
list of metadata links
bool locked
Content is being processed: data structures may be inconsistent and content must not be redrawn or mo...
int available_width
Viewport width.
char sub_status[80]
Status of content.
struct nsurl * refresh
URL for refresh request.
char * title
Title for browser window.
Representation of an HTTP parameter.
struct llcache_event::@124::@125 data
Received data.
size_t len
Byte length of buffer.
const char * progress_msg
Progress message.
llcache_event_type type
Type of event.
const uint8_t * buf
Buffer of data.
Handle to low-level cache object.
Parameters for object element and similar elements.
bool option_knockout
flag to enable knockout rendering.
nserror(* rectangle)(const struct redraw_context *ctx, const plot_style_t *pstyle, const struct rect *rectangle)
Plots a rectangle.
nserror(* clip)(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.
const struct plotter_table * plot
Current plot operation table.
nserror content_textsearch_destroy(struct textsearch_context *textsearch)
Ends the search process, invalidating all state freeing the list of found boxes.
Interface to HTML searching.
Extra data for some content_msg messages.
struct content_msg_data::@99 errordata
CONTENT_MSG_ERROR - Error from content or underlying fetch.
nserror errorcode
The error code to convey meaning.
const char * msg
The message to log.
browser_pointer_shape pointer
CONTENT_MSG_POINTER - Mouse pointer to set.
const char * errormsg
The message.
struct content_rfc5988_link * rfc5988_link
CONTENT_MSG_RFC5988_LINK - rfc5988 link data.
struct nsurl * to
Redirect target.
struct nsurl * from
Redirect origin.
browser_window_console_source src
The source of the logging.
struct content_msg_data::@100 redirect
CONTENT_MSG_REDIRECT - Redirect info.
struct content_msg_data::@101 redraw
CONTENT_MSG_REDRAW - Area of content which needs redrawing.
const char * explicit_status_text
CONTENT_MSG_STATUS - Status message update.
bool background
CONTENT_MSG_REFORMAT - Reformat should not cause a redraw.
bool urldb_get_cert_permissions(nsurl *url)
Retrieve certificate verification permissions from database.
Unified URL information database internal interface.
static nserror bitmap(const struct redraw_context *ctx, struct bitmap *bitmap, int x, int y, int width, int height, colour bg, bitmap_flags_t flags)
Plot a bitmap.
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.