NetSurf
|
Content handling implementation. More...
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <nsutils/time.h>
#include "netsurf/inttypes.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/corestrings.h"
#include "netsurf/browser_window.h"
#include "netsurf/bitmap.h"
#include "netsurf/content.h"
#include "desktop/knockout.h"
#include "content/content_protected.h"
#include "content/textsearch.h"
#include "content/content_debug.h"
#include "content/hlcache.h"
#include "content/urldb.h"
Go to the source code of this file.
Macros | |
#define | URL_FMT_SPC "%.140s" |
Functions | |
static void | content_convert (struct content *c) |
All data has arrived, convert for display. More... | |
static nserror | content_llcache_callback (llcache_handle *llcache, const llcache_event *event, void *pw) |
Handler for low-level cache events. More... | |
static void | content_update_status (struct content *c) |
update content status message More... | |
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) |
bool | content_can_reformat (hlcache_handle *h) |
Get whether a content can reformat. More... | |
void | content_set_status (struct content *c, const char *status_message) |
Updates content with new status. More... | |
void | content_set_ready (struct content *c) |
Put a content in status CONTENT_STATUS_READY and unlock the content. More... | |
void | content_set_done (struct content *c) |
Put a content in status CONTENT_STATUS_DONE. More... | |
void | content_set_error (struct content *c) |
Put a content in status CONTENT_STATUS_ERROR and unlock the content. More... | |
void | content_reformat (hlcache_handle *h, bool background, int width, int height) |
Reformat to new size. More... | |
void | content__reformat (struct content *c, bool background, int width, int height) |
cause a content to be reformatted. More... | |
void | content_destroy (struct content *c) |
Destroy and free a content. More... | |
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. More... | |
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. More... | |
bool | content_keypress (struct hlcache_handle *h, uint32_t key) |
Handle keypresses. More... | |
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. More... | |
void | content__request_redraw (struct content *c, int x, int y, int width, int height) |
Request a redraw of an area of a content. More... | |
bool | content_exec (struct hlcache_handle *h, const char *src, size_t srclen) |
Execute some JavaScript code inside a content object. More... | |
bool | content_saw_insecure_objects (struct hlcache_handle *h) |
Determine if the content referred to any insecure objects. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
uint32_t | content_count_users (struct content *c) |
Count users for the content. More... | |
bool | content_matches_quirks (struct content *c, bool quirks) |
Determine if quirks mode matches. More... | |
bool | content_is_shareable (struct content *c) |
Determine if a content is shareable. More... | |
void | content_broadcast (struct content *c, content_msg msg, const union content_msg_data *data) |
Send a message to all users. More... | |
void | content_broadcast_error (struct content *c, nserror errorcode, const char *msg) |
Send an error message to all users. More... | |
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. More... | |
nserror | content_close (hlcache_handle *h) |
The window containing the content has been closed. More... | |
void | content_clear_selection (hlcache_handle *h) |
Tell a content that any selection it has, or one of its objects has, must be cleared. More... | |
char * | content_get_selection (hlcache_handle *h) |
Get a text selection from a content. More... | |
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. More... | |
bool | content_scroll_at_point (struct hlcache_handle *h, int x, int y, int scrx, int scry) |
scroll content at coordnate More... | |
bool | content_drop_file_at_point (struct hlcache_handle *h, int x, int y, char *file) |
Drag and drop a file at coordinate. More... | |
nserror | content_debug_dump (struct hlcache_handle *h, FILE *f, enum content_debug op) |
Dump debug information to file. More... | |
nserror | content_debug (struct hlcache_handle *h, enum content_debug op) |
Control debug con a content. More... | |
struct content_rfc5988_link * | content_find_rfc5988_link (hlcache_handle *h, lwc_string *rel) |
find link in content that matches the rel string. More... | |
struct content_rfc5988_link * | content__free_rfc5988_link (struct content_rfc5988_link *link) |
free a rfc5988 link More... | |
bool | content__add_rfc5988_link (struct content *c, const struct content_rfc5988_link *link) |
associate a metadata link with a content. More... | |
nsurl * | content_get_url (struct content *c) |
Retrieve URL associated with content. More... | |
content_type | content_get_type (hlcache_handle *h) |
Retrieve computed type of content. More... | |
lwc_string * | content_get_mime_type (hlcache_handle *h) |
Retrieve mime-type of content. More... | |
lwc_string * | content__get_mime_type (struct content *c) |
Retrieve mime-type of content. More... | |
bool | content__set_title (struct content *c, const char *title) |
Set title associated with content. More... | |
const char * | content_get_title (hlcache_handle *h) |
Retrieve title associated with content. More... | |
const char * | content__get_title (struct content *c) |
Retrieve title associated with content. More... | |
content_status | content_get_status (hlcache_handle *h) |
Retrieve status of content. More... | |
content_status | content__get_status (struct content *c) |
Retrieve status of content. More... | |
const char * | content_get_status_message (hlcache_handle *h) |
Retrieve status message associated with content. More... | |
const char * | content__get_status_message (struct content *c) |
Retrieve status message associated with content. More... | |
int | content_get_width (hlcache_handle *h) |
Retrieve width of content. More... | |
int | content__get_width (struct content *c) |
Retrieve width of content. More... | |
int | content_get_height (hlcache_handle *h) |
Retrieve height of content. More... | |
int | content__get_height (struct content *c) |
Retrieve height of content. More... | |
int | content_get_available_width (hlcache_handle *h) |
Retrieve available width of content. More... | |
int | content__get_available_width (struct content *c) |
Retrieve available width of content. More... | |
const uint8_t * | content_get_source_data (hlcache_handle *h, size_t *size) |
Retrieve source of content. More... | |
const uint8_t * | content__get_source_data (struct content *c, size_t *size) |
Retrieve source of content. More... | |
void | content_invalidate_reuse_data (hlcache_handle *h) |
Invalidate content reuse data. More... | |
void | content__invalidate_reuse_data (struct content *c) |
Invalidate content reuse data. More... | |
nsurl * | content_get_refresh_url (hlcache_handle *h) |
Retrieve the refresh URL for a content. More... | |
nsurl * | content__get_refresh_url (struct content *c) |
Retrieve the refresh URL for a content. More... | |
struct bitmap * | content_get_bitmap (hlcache_handle *h) |
Retrieve the bitmap contained in an image content. More... | |
struct bitmap * | content__get_bitmap (struct content *c) |
Retrieve the bitmap contained in an image content. More... | |
bool | content_get_opaque (hlcache_handle *h) |
Determine if a content is opaque from handle. More... | |
bool | content__get_opaque (struct content *c) |
Determine if a content is opaque. More... | |
bool | content_get_quirks (hlcache_handle *h) |
Retrieve quirkiness of a content. More... | |
const char * | content_get_encoding (hlcache_handle *h, enum content_encoding_type op) |
Retrieve the encoding of a content. More... | |
const char * | content__get_encoding (struct content *c, enum content_encoding_type op) |
Retrieve the encoding of a content. More... | |
bool | content_is_locked (hlcache_handle *h) |
Return whether a content is currently locked. More... | |
bool | content__is_locked (struct content *c) |
Return whether a content is currently locked. More... | |
const llcache_handle * | content_get_llcache_handle (struct content *c) |
Retrieve the low-level cache handle for a content. More... | |
struct content * | content_clone (struct content *c) |
Clone a content object in its current state. More... | |
nserror | content__clone (const struct content *c, struct content *nc) |
Clone a content's data members. More... | |
nserror | content_abort (struct content *c) |
Abort a content object. More... | |
Variables | |
const char *const | content_status_name [] |
Content handling implementation.
Definition in file content.c.
bool content__add_rfc5988_link | ( | struct content * | c, |
const struct content_rfc5988_link * | link | ||
) |
associate a metadata link with a content.
c | content to add link to |
link | The rfc5988 link to add |
Definition at line 1001 of file content.c.
References content_broadcast(), CONTENT_MSG_LINK, content_rfc5988_link::href, content_rfc5988_link::hreflang, content::links, content_rfc5988_link::media, content_rfc5988_link::next, nsurl_ref(), content_rfc5988_link::rel, content_msg_data::rfc5988_link, content_rfc5988_link::sizes, and content_rfc5988_link::type.
Referenced by html_process_inserted_link().
Clone a content's data members.
c | Content to clone |
nc | Content to populate |
Definition at line 1382 of file content.c.
References content::active, content::available_width, content_llcache_callback(), content::fallback_charset, content::handler, content::height, content::http_code, content::llcache, llcache_handle_change_callback(), llcache_handle_clone(), content::locked, content::mime_type, NSERROR_NOMEM, NSERROR_OK, nsurl_ref(), content::quirks, content::reformat_time, content::refresh, content::size, content::status, content::status_message, content::sub_status, content::time, content::title, content::total_size, content::user_list, and content::width.
Referenced by amiga_plugin_hack_clone(), gif_clone(), javascript_clone(), nsbmp_clone(), nscss_clone(), nsico_clone(), nsjpeg_clone(), nsjpegxl_clone(), nspng_clone(), nssprite_clone(), rsvg_clone(), svg_clone(), textplain_clone(), and webp_clone().
struct content_rfc5988_link * content__free_rfc5988_link | ( | struct content_rfc5988_link * | link | ) |
free a rfc5988 link
link | The link to free |
Definition at line 973 of file content.c.
References content_rfc5988_link::href, content_rfc5988_link::hreflang, content_rfc5988_link::media, content_rfc5988_link::next, nsurl_unref(), content_rfc5988_link::rel, content_rfc5988_link::sizes, and content_rfc5988_link::type.
Referenced by content_destroy().
int content__get_available_width | ( | struct content * | c | ) |
Retrieve available width of content.
c | content to get available width of. |
Definition at line 1199 of file content.c.
References content::available_width.
Referenced by content_get_available_width().
Retrieve the bitmap contained in an image content.
c | Content to retrieve opacity from |
Definition at line 1271 of file content.c.
References bitmap(), CONTENT_IMAGE, content_handler::get_internal, content::handler, and content_handler::type.
Referenced by content_get_bitmap().
const char * content__get_encoding | ( | struct content * | c, |
enum content_encoding_type | op | ||
) |
Retrieve the encoding of a content.
c | the content to examine the encoding of. |
op | encoding operation. |
Definition at line 1329 of file content.c.
References content_handler::get_encoding, and content::handler.
Referenced by content_get_encoding().
int content__get_height | ( | struct content * | c | ) |
Retrieve height of content.
c | Content to retrieve height of |
Definition at line 1182 of file content.c.
References content::height.
Referenced by content_get_height(), and html_object_callback().
lwc_string * content__get_mime_type | ( | struct content * | c | ) |
Retrieve mime-type of content.
c | Content to retrieve mime-type of |
Definition at line 1080 of file content.c.
References content::mime_type.
Referenced by amiga_plugin_hack_redraw(), and content_get_mime_type().
bool content__get_opaque | ( | struct content * | c | ) |
Determine if a content is opaque.
c | Content to retrieve opacity from |
Definition at line 1295 of file content.c.
References content::handler, and content_handler::is_opaque.
Referenced by content_get_opaque().
Retrieve the refresh URL for a content.
c | Content to retrieve refresh URL from |
Definition at line 1254 of file content.c.
References content::refresh.
Referenced by content_get_refresh_url().
const uint8_t * content__get_source_data | ( | struct content * | c, |
size_t * | size | ||
) |
Retrieve source of content.
c | Content to retrieve source of. |
size | Pointer to location to receive byte size of source. |
Definition at line 1216 of file content.c.
References content::llcache, llcache_handle_get_source_data(), and content::size.
Referenced by content_get_source_data(), gif_convert(), html_process_encoding_change(), jpeg_cache_convert(), jpegxl_cache_convert(), nsbmp_convert(), nscss_clone(), nsico_convert(), nsjpeg_convert(), nsjpegxl_convert(), nspng_clone(), nssprite_convert(), png_cache_convert(), rsvg_clone(), rsvg_convert(), svg_reformat(), textplain_clone(), webp_cache_convert(), and webp_convert().
content_status content__get_status | ( | struct content * | c | ) |
Retrieve status of content.
c | Content to retrieve status from. |
Definition at line 1131 of file content.c.
References CONTENT_STATUS_ERROR, and content::status.
Referenced by content_get_status(), hlcache_clean(), and html_proceed_to_done().
const char * content__get_status_message | ( | struct content * | c | ) |
Retrieve status message associated with content.
c | Content to retrieve status message from |
Definition at line 1148 of file content.c.
References content::status_message.
Referenced by content_get_status_message().
const char * content__get_title | ( | struct content * | c | ) |
Retrieve title associated with content.
c | Content to retrieve title from |
Definition at line 1113 of file content.c.
References content::llcache, llcache_handle_get_url(), nsurl_access(), and content::title.
Referenced by content_get_title().
int content__get_width | ( | struct content * | c | ) |
Retrieve width of content.
c | Content to retrieve width of |
Definition at line 1165 of file content.c.
References content::width.
Referenced by content_get_width(), and html_object_callback().
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 | ||
) |
Definition at line 190 of file content.c.
References content::active, content::available_height, content::available_width, content_user::callback, content_llcache_callback(), content_set_status(), CONTENT_STATUS_LOADING, content::context, content::fallback_charset, content::handler, content::height, content::http_code, content::llcache, llcache, llcache_handle_change_callback(), llcache_handle_get_url(), content::locked, messages_get(), content::mime_type, content_user::next, NSERROR_NOMEM, NSERROR_OK, NSLOG, nsurl_access_log(), content_user::pw, content::quirks, content::refresh, content::size, content::status, content::string, content::sub_status, content::textsearch, content::time, content::title, content::total_size, URL_FMT_SPC, content::user_list, and content::width.
Referenced by amiga_plugin_hack_create(), gif_create(), html_create(), javascript_create(), nsbmp_create(), nscss_create(), nsico_create(), nsjpeg_create(), nsjpegxl_create(), nspng_create(), nssprite_create(), nsvideo_create(), rsvg_create(), svg_create(), textplain_create(), and webp_create().
void content__invalidate_reuse_data | ( | struct content * | c | ) |
Invalidate content reuse data.
causes subsequent requests for content URL to query server to determine if content can be reused. This is required behaviour for forced reloads etc.
c | Content to invalidate. |
Definition at line 1236 of file content.c.
References content::llcache, and llcache_handle_invalidate_cache_data().
Referenced by content_invalidate_reuse_data().
bool content__is_locked | ( | struct content * | c | ) |
Return whether a content is currently locked.
c | Content to test |
Definition at line 1351 of file content.c.
References content::locked.
Referenced by content_is_locked().
void content__reformat | ( | struct content * | c, |
bool | background, | ||
int | width, | ||
int | height | ||
) |
cause a content to be reformatted.
c | content to be reformatted |
background | perform reformat in background |
width | The available width to reformat content in |
height | The available height to reformat content in |
Definition at line 331 of file content.c.
References content::available_height, content::available_width, content_msg_data::background, content_broadcast(), CONTENT_MSG_REFORMAT, CONTENT_STATUS_DONE, CONTENT_STATUS_READY, content::handler, height, content::locked, content_handler::reformat, content::status, and width.
Referenced by content_reformat(), and html_object_callback().
void content__request_redraw | ( | struct content * | c, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height | ||
) |
Request a redraw of an area of a content.
c | Content |
x | x co-ord of left edge |
y | y co-ord of top edge |
width | Width of rectangle |
height | Height of rectangle |
Definition at line 459 of file content.c.
References content_broadcast(), CONTENT_MSG_REDRAW, content_msg_data::height, height, content_msg_data::redraw, content_msg_data::width, width, content_msg_data::x, and content_msg_data::y.
Referenced by box_textarea_callback(), content_request_redraw(), form_select_menu_callback(), html__redraw_a_box(), html_textselection_redraw(), and textplain_textselection_redraw().
bool content__set_title | ( | struct content * | c, |
const char * | title | ||
) |
Set title associated with content.
c | Content to set title on. |
title | The new title to set. |
Definition at line 1090 of file content.c.
References content::title.
Referenced by gif_convert(), html_process_title(), nsbmp_convert(), nsico_convert(), nsjpeg_convert(), nsjpegxl_convert(), nspng_convert(), and nssprite_convert().
Abort a content object.
c | The content object to abort |
Definition at line 1448 of file content.c.
References content::handler, content::llcache, llcache_handle_abort(), NSLOG, and content_handler::stop.
Referenced by hlcache_clean(), and hlcache_handle_abort().
bool content_add_user | ( | struct content * | h, |
void(*)(struct content *c, content_msg msg, const union content_msg_data *data, void *pw) | callback, | ||
void * | pw | ||
) |
Register a user for callbacks.
c | the content to register |
callback | the user callback function |
pw | callback private data |
The callback will be called when content_broadcast() is called with the content.
Definition at line 654 of file content.c.
References content_handler::add_user, content_user::callback, content::handler, content::llcache, llcache_handle_get_url(), content_user::next, NSLOG, nsurl_access_log(), content_user::pw, URL_FMT_SPC, and content::user_list.
Referenced by hlcache_find_content(), and hlcache_handle_abort().
void content_broadcast | ( | struct content * | c, |
content_msg | msg, | ||
const union content_msg_data * | data | ||
) |
Send a message to all users.
Definition at line 752 of file content.c.
References content_user::callback, content_user::next, NSLOG, content_user::pw, and content::user_list.
Referenced by content__add_rfc5988_link(), content__reformat(), content__request_redraw(), content_llcache_callback(), content_mouse_track(), content_set_done(), content_set_ready(), content_textsearch_step(), default_mouse_action(), dom_default_action_DOMNodeInserted_cb(), gadget_mouse_action(), gif__animate(), html_finish_conversion(), html_get_dimensions(), html_object_callback(), html_overflow_scroll_callback(), html_process_inserted_meta(), html_process_script(), html_set_drag_type(), html_set_focus(), html_set_selection(), jxl_report_fail(), link_mouse_action(), mouse_action_drag_none(), mouse_action_drag_scrollbar(), mouse_action_select_menu(), nsjpeg_convert(), nsjpegxl_convert(), search_text(), textplain_mouse_action(), and textsearch_broadcast().
Send an error message to all users.
c | The content whose users should be informed of an error |
errorcode | The nserror code to send |
msg | The error message to send alongside |
Definition at line 769 of file content.c.
References content_user::callback, CONTENT_MSG_ERROR, content_msg_data::errorcode, content_msg_data::errordata, content_msg_data::errormsg, content_msg_data::msg, content_user::next, content_user::pw, and content::user_list.
Referenced by exec_inline_script(), exec_src_script(), gif_convert(), gif_create_gif_data(), html_begin_conversion(), html_box_convert_done(), html_create(), html_create_style_element(), html_css_process_link(), html_css_process_modified_style(), html_finish_conversion(), html_process_data(), nsbmp_convert(), nsbmp_create_bmp_data(), nscss_content_done(), nscss_convert(), nscss_create(), nscss_process_data(), nsico_convert(), nsico_create_ico_data(), nspng_create_png_data(), nspng_process_data(), nssprite_convert(), rsvg_convert(), rsvg_create_svg_data(), rsvg_process_data(), svg_create_svg_data(), textplain_create_internal(), and textplain_process_data().
bool content_can_reformat | ( | struct hlcache_handle * | h | ) |
Get whether a content can reformat.
h | content to check |
Definition at line 258 of file content.c.
References content::handler, hlcache_handle_get_content(), and content_handler::reformat.
Referenced by browser_window_set_scale_internal(), html_object_callback(), layout_block_object(), and layout_line().
void content_clear_selection | ( | hlcache_handle * | h | ) |
Tell a content that any selection it has, or one of its objects has, must be cleared.
Definition at line 847 of file content.c.
References content_handler::clear_selection, content_handler::get_selection, content::handler, and hlcache_handle_get_content().
Referenced by browser_window_set_selection(), html_clear_selection(), and html_set_selection().
Clone a content object in its current state.
c | Content to clone |
Definition at line 1368 of file content.c.
References content_handler::clone, content::handler, and NSERROR_OK.
Referenced by hlcache_handle_abort().
nserror content_close | ( | struct hlcache_handle * | h | ) |
The window containing the content has been closed.
Calls the close function for the content.
Definition at line 813 of file content.c.
References content_handler::close, CONTENT_STATUS_DONE, CONTENT_STATUS_READY, content_textsearch_destroy(), content::context, content::handler, hlcache_handle_get_content(), content::llcache, llcache_handle_get_url(), NSERROR_BAD_PARAMETER, NSERROR_INVALID, NSERROR_OK, NSLOG, nsurl_access_log(), content::status, and content::textsearch.
Referenced by browser_window_content_ready(), browser_window_destroy_internal(), browser_window_favicon_callback(), and html_object_close_objects().
|
static |
All data has arrived, convert for display.
Calls the convert function for the content.
Definition at line 67 of file content.c.
References content_set_done(), content_set_error(), content_set_ready(), CONTENT_STATUS_ERROR, CONTENT_STATUS_LOADING, content_handler::data_complete, content::handler, content::llcache, llcache_handle_get_url(), content::locked, NSLOG, nsurl_access_log(), content::status, and URL_FMT_SPC.
Referenced by content_llcache_callback().
uint32_t content_count_users | ( | struct content * | c | ) |
Count users for the content.
c | Content to consider |
Definition at line 718 of file content.c.
References content_user::next, and content::user_list.
Referenced by gif_add_user(), gif_remove_user(), hlcache_clean(), hlcache_finalise(), and hlcache_handle_abort().
nserror content_debug | ( | struct hlcache_handle * | h, |
enum content_debug | op | ||
) |
Control debug con a content.
h | content handle to debug. |
op | Debug operation type. |
Definition at line 936 of file content.c.
References content_handler::debug, content::handler, hlcache_handle_get_content(), NSERROR_BAD_PARAMETER, and NSERROR_NOT_IMPLEMENTED.
nserror content_debug_dump | ( | struct hlcache_handle * | h, |
FILE * | f, | ||
enum content_debug | op | ||
) |
Dump debug information to file.
h | content handle to debug. |
f | File to write output to. |
op | Debug operation type. |
Definition at line 922 of file content.c.
References content_handler::debug_dump, content::handler, hlcache_handle_get_content(), and NSERROR_NOT_IMPLEMENTED.
Referenced by browser_window_debug_dump().
void content_destroy | ( | struct content * | c | ) |
Destroy and free a content.
Calls the destroy function for the content, and frees the structure.
Definition at line 354 of file content.c.
References content__free_rfc5988_link(), content_handler::destroy, content::fallback_charset, content::handler, content::links, content::llcache, llcache_handle_get_url(), llcache_handle_release(), content::locked, content::mime_type, NSLOG, nsurl_access_log(), content::title, and content::user_list.
Referenced by amiga_plugin_hack_clone(), gif_clone(), hlcache_clean(), hlcache_handle_abort(), javascript_clone(), nsbmp_clone(), nscss_clone(), nsico_clone(), nsjpeg_clone(), nsjpegxl_clone(), nspng_clone(), nssprite_clone(), rsvg_clone(), svg_clone(), textplain_clone(), and webp_clone().
bool content_drop_file_at_point | ( | struct hlcache_handle * | h, |
int | x, | ||
int | y, | ||
char * | file | ||
) |
Drag and drop a file at coordinate.
[in] | h | Handle to content to examine. |
[in] | x | The x coordinate to examine. |
[in] | y | The y coordinate to examine. |
Definition at line 906 of file content.c.
References content_handler::drop_file_at_point, content::handler, and hlcache_handle_get_content().
Referenced by browser_window_drop_file_at_point_internal(), and html_drop_file_at_point().
bool content_exec | ( | struct hlcache_handle * | h, |
const char * | src, | ||
size_t | srclen | ||
) |
Execute some JavaScript code inside a content object.
Runs the passed in JavaScript code in the content object's context.
h | The handle to the content |
src | The JavaScript source code |
srclen | The length of the source code |
Definition at line 477 of file content.c.
References content_handler::exec, content::handler, hlcache_handle_get_content(), content::locked, and NSLOG.
Referenced by browser_window_exec().
struct content_rfc5988_link * content_find_rfc5988_link | ( | struct hlcache_handle * | h, |
lwc_string * | rel | ||
) |
find link in content that matches the rel string.
h | handle to the content to retrieve tyoe of. |
rel | The string to match. |
Definition at line 954 of file content.c.
References hlcache_handle_get_content(), content::links, content_rfc5988_link::next, and content_rfc5988_link::rel.
Referenced by browser_window_update_favicon().
int content_get_available_width | ( | struct hlcache_handle * | h | ) |
Retrieve available width of content.
h | handle to the content to get available width of. |
Definition at line 1192 of file content.c.
References content__get_available_width(), and hlcache_handle_get_content().
Referenced by layout_line().
struct bitmap * content_get_bitmap | ( | struct hlcache_handle * | h | ) |
Retrieve the bitmap contained in an image content.
h | handle to the content. |
Definition at line 1264 of file content.c.
References content__get_bitmap(), and hlcache_handle_get_content().
Referenced by ami_file_save(), ami_gui_menu_update_disabled(), ami_gui_update_hotlist_button(), amiga_icon_superimpose_favicon_internal(), browser_window_history_get_thumbnail(), default_ico_callback(), gui_window_set_icon(), HOOKF(), ro_gui_save_object_native(), search_web_get_provider_bitmap(), search_web_ico_callback(), and search_web_select_provider().
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.
[in] | h | Handle to content to examine. |
[in] | x | The x coordinate to examine. |
[in] | y | The y coordinate to examine. |
[out] | data | The context structure to fill in. |
Definition at line 872 of file content.c.
References content_handler::get_contextual_content, content::handler, hlcache_handle_get_content(), NSERROR_OK, and browser_window_features::object.
Referenced by browser_window__get_contextual_content(), and html_get_contextual_content().
const char * content_get_encoding | ( | struct hlcache_handle * | h, |
enum content_encoding_type | op | ||
) |
Retrieve the encoding of a content.
h | handle to the content. |
op | encoding operation. |
Definition at line 1321 of file content.c.
References content__get_encoding(), and hlcache_handle_get_content().
Referenced by browser_window_navigate(), nsgtk_viewsource(), and ro_gui_window_prepare_pageinfo().
int content_get_height | ( | struct hlcache_handle * | h | ) |
Retrieve height of content.
h | handle to the content to get height of. |
Definition at line 1175 of file content.c.
References content__get_height(), and hlcache_handle_get_content().
Referenced by browser_window_content_done(), browser_window_get_extents(), browser_window_handle_scrollbars(), browser_window_history_update(), browser_window_redraw(), html_object_callback(), html_redraw_background(), html_redraw_inline_background(), layout_calculate_descendant_bboxes(), layout_get_object_dimensions(), layout_line(), layout_lists(), print_apply_settings(), print_basic_run(), print_declare_fonts(), print_document(), print_set_up(), ro_gui_url_bar_res_cb(), ro_gui_url_bar_set_site_favicon(), and treeview_res_cb().
const llcache_handle * content_get_llcache_handle | ( | struct content * | c | ) |
Retrieve the low-level cache handle for a content.
c | Content to retrieve from |
Definition at line 1358 of file content.c.
References content::llcache.
Referenced by hlcache_find_content().
lwc_string * content_get_mime_type | ( | struct hlcache_handle * | h | ) |
Retrieve mime-type of content.
h | handle to the content to retrieve mime type from |
Definition at line 1073 of file content.c.
References content__get_mime_type(), and hlcache_handle_get_content().
Referenced by ami_mime_compare(), ami_mime_content_to_cmd(), ami_mime_content_to_filetype(), nsbeos_gui_view_source(), ro_content_filetype(), ro_gui_window_prepare_objectinfo(), ro_gui_window_prepare_pageinfo(), save_complete_save_html_document(), save_complete_save_html_object(), and save_complete_save_stylesheet().
bool content_get_opaque | ( | struct hlcache_handle * | h | ) |
Determine if a content is opaque from handle.
h | high level cache handle to retrieve opacity from. |
Definition at line 1288 of file content.c.
References content__get_opaque(), and hlcache_handle_get_content().
Referenced by html_redraw_background(), and html_redraw_inline_background().
bool content_get_quirks | ( | struct hlcache_handle * | h | ) |
Retrieve quirkiness of a content.
h | Content to examine |
Definition at line 1308 of file content.c.
References hlcache_handle_get_content(), and content::quirks.
Referenced by browser_window_navigate().
nsurl * content_get_refresh_url | ( | struct hlcache_handle * | h | ) |
Retrieve the refresh URL for a content.
h | Content to retrieve refresh URL from |
Definition at line 1247 of file content.c.
References content__get_refresh_url(), and hlcache_handle_get_content().
Referenced by browser_window_refresh(), and html_object_refresh().
char * content_get_selection | ( | struct hlcache_handle * | h | ) |
Get a text selection from a content.
Ownership is passed to the caller, who must free() it.
Definition at line 858 of file content.c.
References content_handler::get_selection, content::handler, and hlcache_handle_get_content().
Referenced by browser_window_get_selection(), and html_get_selection().
const uint8_t * content_get_source_data | ( | struct hlcache_handle * | h, |
size_t * | size | ||
) |
Retrieve source of content.
h | Content handle to retrieve source of |
size | Pointer to location to receive byte size of source |
Definition at line 1209 of file content.c.
References content__get_source_data(), hlcache_handle_get_content(), and content::size.
Referenced by ami_file_save(), context_popup(), convert_script_sync_cb(), html_script_exec(), nsbeos_gui_view_source(), nsgtk_viewsource(), ro_gui_save_content(), ro_gui_save_object_native(), ro_gui_theme_install_apply(), ro_gui_view_source(), RXHOOKF(), save_complete_save_html_object(), save_complete_save_stylesheet(), and theme_install_callback().
content_status content_get_status | ( | struct hlcache_handle * | h | ) |
Retrieve status of content.
h | handle to the content to retrieve status from |
Definition at line 1124 of file content.c.
References content__get_status(), and hlcache_handle_get_content().
Referenced by browser_window_exec(), browser_window_refresh(), browser_window_set_pointer(), browser_window_stop(), browser_window_stop_available(), hlcache_find_content(), html_css_process_modified_style(), html_object_abort_objects(), html_replace_object(), html_script_exec(), and nscss_register_imports().
const char * content_get_status_message | ( | struct hlcache_handle * | h | ) |
Retrieve status message associated with content.
h | handle to the content to retrieve status message from |
Definition at line 1141 of file content.c.
References content__get_status_message(), and hlcache_handle_get_content().
Referenced by browser_window_callback(), browser_window_content_done(), and browser_window_content_ready().
const char * content_get_title | ( | struct hlcache_handle * | h | ) |
Retrieve title associated with content.
h | handle to the content to retrieve title from |
Definition at line 1106 of file content.c.
References content__get_title(), and hlcache_handle_get_content().
Referenced by ami_file_save(), browser_window_content_ready(), browser_window_get_title(), browser_window_history_add(), browser_window_history_update(), browser_window_update(), print_send_printsave(), ro_gui_save_complete(), ro_gui_window_menu_warning(), and ro_gui_window_prepare_pageinfo().
content_type content_get_type | ( | struct hlcache_handle * | h | ) |
Retrieve computed type of content.
h | handle to the content to retrieve type of. |
Definition at line 1061 of file content.c.
References CONTENT_NONE, content::handler, hlcache_handle_get_content(), and content_handler::type.
Referenced by ami_gui_menu_update_disabled(), ami_mime_content_to_filetype(), browser_window_callback(), browser_window_can_search(), browser_window_can_select(), browser_window_content_ready(), browser_window_create_frameset(), browser_window_create_frameset_internal(), browser_window_create_iframes(), browser_window_find_target(), browser_window_mouse_click_internal(), browser_window_navigate(), browser_window_recalculate_frameset(), browser_window_redraw(), browser_window_reload(), convert_script_sync_cb(), get_context_info(), get_mouse_action_node(), html_get_id_offset(), html_object_callback(), html_object_close_objects(), html_object_free_objects(), html_object_open_objects(), html_object_refresh(), html_redraw_box(), html_script_exec(), layout_block_add_scrollbar(), layout_block_find_dimensions(), layout_calculate_descendant_bboxes(), layout_float_find_dimensions(), layout_minmax_block(), layout_update_descendant_bbox(), nsgtk_viewsource(), print_button_clicked_cb(), print_document(), ro_content_filetype(), ro_gui_save_content(), ro_gui_search_bw_searchable(), ro_gui_url_bar_set_site_favicon(), ro_gui_window_content_export_types(), ro_gui_window_menu_warning(), ro_gui_window_prepare_pageinfo(), save_as_text(), save_complete_save_html(), save_complete_save_html_object(), and theme_install_start().
Retrieve URL associated with content.
c | Content to retrieve URL from |
Definition at line 1051 of file content.c.
References content::llcache, and llcache_handle_get_url().
Referenced by amiga_plugin_hack_open(), box_textarea_keypress(), exec_src_script(), hlcache_handle_get_url(), html_begin_conversion(), html_create_html_data(), html_css_new_stylesheets(), html_css_process_link(), html_css_quirks_stylesheets(), html_fetch_object(), html_process_inserted_meta(), html_replace_object(), html_stylesheet_from_domnode(), layout_document(), link_mouse_action(), mouse_action_drag_none(), nscss_clone(), nscss_create(), and svg_reformat().
int content_get_width | ( | struct hlcache_handle * | h | ) |
Retrieve width of content.
h | handle to the content to get width of. |
Definition at line 1158 of file content.c.
References content__get_width(), and hlcache_handle_get_content().
Referenced by bitmap_render(), browser_window_content_done(), browser_window_get_extents(), browser_window_handle_scrollbars(), browser_window_history_update(), browser_window_redraw(), html_object_callback(), html_redraw_background(), html_redraw_inline_background(), layout_calculate_descendant_bboxes(), layout_get_object_dimensions(), layout_lists(), layout_minmax_block(), print_apply_settings(), print_declare_fonts(), print_document(), and ro_gui_url_bar_set_site_favicon().
void content_invalidate_reuse_data | ( | struct hlcache_handle * | h | ) |
Invalidate content reuse data.
causes subsequent requests for content URL to query server to determine if content can be reused. This is required behaviour for forced reloads etc.
h | Content handle to invalidate. |
Definition at line 1229 of file content.c.
References content__invalidate_reuse_data(), and hlcache_handle_get_content().
Referenced by browser_window_refresh(), browser_window_reload(), html_object_refresh(), nsbeos_scaffolding_dispatch_event(), ro_gui_window_menu_select(), and theme_install_start().
bool content_is_locked | ( | struct hlcache_handle * | h | ) |
Return whether a content is currently locked.
h | handle to the content. |
Definition at line 1344 of file content.c.
References content__is_locked(), and hlcache_handle_get_content().
Referenced by browser_window_redraw_ready().
bool content_is_shareable | ( | struct content * | c | ) |
Determine if a content is shareable.
c | Content to consider |
Definition at line 745 of file content.c.
References content::handler, and content_handler::no_share.
Referenced by hlcache_find_content().
bool content_keypress | ( | struct hlcache_handle * | h, |
uint32_t | key | ||
) |
Handle keypresses.
h | Content handle |
key | The UCS4 character codepoint |
Definition at line 437 of file content.c.
References content::handler, hlcache_handle_get_content(), and content_handler::keypress.
Referenced by browser_window_key_press(), and html_keypress().
|
static |
Handler for low-level cache events.
llcache | Low-level cache handle |
event | Event details |
pw | Pointer to our context |
Definition at line 104 of file content.c.
References llcache_event::buf, content_broadcast(), content_convert(), CONTENT_MSG_ERROR, CONTENT_MSG_REDIRECT, CONTENT_MSG_STATUS, content_set_status(), CONTENT_STATUS_ERROR, llcache_event::data, content_msg_data::errorcode, content_msg_data::errordata, content_msg_data::errormsg, content_msg_data::explicit_status_text, content_msg_data::from, content::handler, llcache_event::len, content::llcache, llcache, LLCACHE_EVENT_DONE, LLCACHE_EVENT_ERROR, LLCACHE_EVENT_GOT_CERTS, LLCACHE_EVENT_HAD_DATA, LLCACHE_EVENT_HAD_HEADERS, LLCACHE_EVENT_PROGRESS, LLCACHE_EVENT_REDIRECT, llcache_handle_abort(), llcache_handle_get_source_data(), messages_get(), NSERROR_NOMEM, NSERROR_OK, content_handler::process_data, llcache_event::progress_msg, content_msg_data::redirect, content::status, content_msg_data::to, and llcache_event::type.
Referenced by content__clone(), and content__init().
bool content_matches_quirks | ( | struct content * | c, |
bool | quirks | ||
) |
Determine if quirks mode matches.
c | Content to consider |
quirks | Quirks mode to match |
Definition at line 735 of file content.c.
References content::handler, and content_handler::matches_quirks.
Referenced by hlcache_find_content().
void content_mouse_action | ( | struct hlcache_handle * | h, |
struct browser_window * | bw, | ||
browser_mouse_state | mouse, | ||
int | x, | ||
int | y | ||
) |
Handle mouse clicks and movements in a content window.
h | Content handle |
bw | browser window |
mouse | state of mouse buttons and modifier keys |
x | coordinate of mouse |
y | coordinate of mouse |
This function handles both hovering and clicking. It is important that the code path is identical (except that hovering doesn't carry out the action), so that the status bar reflects exactly what will happen. Having separate code paths opens the possibility that an attacker will make the status bar show some harmless action where clicking will be harmful.
Definition at line 421 of file content.c.
References content::handler, hlcache_handle_get_content(), and content_handler::mouse_action.
Referenced by browser_window_mouse_click_internal(), and html_object_mouse_action().
void content_mouse_track | ( | struct hlcache_handle * | h, |
struct browser_window * | bw, | ||
browser_mouse_state | mouse, | ||
int | x, | ||
int | y | ||
) |
Handle mouse movements in a content window.
h | Content handle |
bw | browser window |
mouse | state of mouse buttons and modifier keys |
x | coordinate of mouse |
y | coordinate of mouse |
Definition at line 398 of file content.c.
References BROWSER_POINTER_AUTO, content_broadcast(), CONTENT_MSG_POINTER, content::handler, hlcache_handle_get_content(), content_handler::mouse_track, and content_msg_data::pointer.
Referenced by browser_window_mouse_track_internal(), html_object_mouse_action(), and mouse_action_drag_content().
nserror content_open | ( | struct hlcache_handle * | h, |
struct browser_window * | bw, | ||
struct content * | page, | ||
struct object_params * | params | ||
) |
A window containing the content has been opened.
h | handle to content that has been opened |
bw | browser window containing the content |
page | content of type CONTENT_HTML containing h, or NULL if not an object within a page |
params | object parameters, or NULL if not an object |
Calls the open function for the content.
Definition at line 791 of file content.c.
References content::handler, hlcache_handle_get_content(), content::llcache, llcache_handle_get_url(), NSERROR_OK, NSLOG, nsurl_access_log(), and content_handler::open.
Referenced by browser_window_content_ready(), html_object_callback(), and html_object_open_objects().
bool content_redraw | ( | struct hlcache_handle * | h, |
struct content_redraw_data * | data, | ||
const struct rect * | clip, | ||
const struct redraw_context * | ctx | ||
) |
Display content on screen with optional tiling.
h | The content to redraw. |
data | The contents redraw data. |
clip | The clipping rectangle to use when redrawing the content. |
ctx | current redraw context. |
Calls the redraw function for the content.
Definition at line 558 of file content.c.
References clip(), content::handler, hlcache_handle_get_content(), content::locked, and content_handler::redraw.
Referenced by browser_window_redraw(), html_redraw_background(), html_redraw_box(), html_redraw_inline_background(), print_declare_fonts(), print_document(), print_draw_next_page(), ro_gui_url_bar_redraw(), treeview_redraw(), treeview_redraw_search(), and treeview_redraw_tree().
void content_reformat | ( | struct hlcache_handle * | h, |
bool | background, | ||
int | width, | ||
int | height | ||
) |
Reformat to new size.
Calls the reformat function for the content.
Definition at line 321 of file content.c.
References content__reformat(), height, hlcache_handle_get_content(), and width.
Referenced by browser_window_content_ready(), browser_window_reformat(), html_object_callback(), layout_block_object(), layout_line(), print_apply_settings(), and print_document().
void content_remove_user | ( | struct content * | c, |
void(*)(struct content *c, content_msg msg, const union content_msg_data *data, void *pw) | callback, | ||
void * | ctx | ||
) |
Remove a callback user.
The callback function and pw must be identical to those passed to content_add_user().
c | Content to remove user from |
callback | passed when added |
ctx | Context passed when added |
Definition at line 684 of file content.c.
References content_user::callback, content::handler, content::llcache, llcache_handle_get_url(), content_user::next, NSLOG, nsurl_access_log(), content_user::pw, content_handler::remove_user, URL_FMT_SPC, and content::user_list.
Referenced by hlcache_handle_abort(), and hlcache_handle_release().
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.
h | high-level cache handle |
x | x co-ord of left edge |
y | y co-ord of top edge |
width | Width of rectangle |
height | Height of rectangle |
Definition at line 450 of file content.c.
References content__request_redraw(), height, hlcache_handle_get_content(), and width.
Referenced by html_redraw_a_box(), and mouse_action_select_menu().
bool content_saw_insecure_objects | ( | struct hlcache_handle * | h | ) |
Determine if the content referred to any insecure objects.
Query the content to determine if any of its referred objects were loaded in a manner not considered secure. For a content to be recursively secure it must only load over https and must not have certificate overrides in place.
h | The handle to the content |
Definition at line 500 of file content.c.
References content::handler, hlcache_handle_get_content(), hlcache_handle_get_url(), nsurl_get_component(), NSURL_SCHEME, content_handler::saw_insecure_objects, and urldb_get_cert_permissions().
Referenced by browser_window_get_page_info_state(), html_css_saw_insecure_stylesheets(), html_saw_insecure_objects(), and html_saw_insecure_scripts().
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.
Redraws the content at a specified width and height with the content drawing scaled to fit within the area.
h | The content to redraw |
width | The target width |
height | The target height |
ctx | current redraw context |
The thumbnail is guaranteed to be filled to its width/height extents, so there is no need to render a solid background first.
Units for width and height are pixels.
Definition at line 583 of file content.c.
References content_redraw_data::background_colour, clip(), plotter_table::clip, content::handler, height, content_redraw_data::height, hlcache_handle_get_content(), knockout_plot_end(), knockout_plot_start(), content::locked, NSERROR_OK, NSLOG, plotter_table::option_knockout, redraw_context::plot, plot_style_fill_white, plotter_table::rectangle, content_handler::redraw, content_redraw_data::repeat_x, content_redraw_data::repeat_y, content_redraw_data::scale, content::width, width, content_redraw_data::width, content_redraw_data::x, and content_redraw_data::y.
Referenced by bitmap_render(), and riscos_bitmap_render().
bool content_scroll_at_point | ( | struct hlcache_handle * | h, |
int | x, | ||
int | y, | ||
int | scrx, | ||
int | scry | ||
) |
scroll content at coordnate
[in] | h | Handle to content to examine. |
[in] | x | The x coordinate to examine. |
[in] | y | The y coordinate to examine. |
Definition at line 890 of file content.c.
References content::handler, hlcache_handle_get_content(), and content_handler::scroll_at_point.
Referenced by browser_window_scroll_at_point_internal(), and html_scroll_at_point().
void content_set_done | ( | struct content * | c | ) |
Put a content in status CONTENT_STATUS_DONE.
Definition at line 299 of file content.c.
References content_broadcast(), CONTENT_MSG_DONE, CONTENT_STATUS_DONE, content_update_status(), content::status, and content::time.
Referenced by amiga_plugin_hack_convert(), content_convert(), gif_convert(), html_object_callback(), html_proceed_to_done(), html_stop(), javascript_convert(), nsbmp_convert(), nscss_content_done(), nsico_convert(), nsjpeg_convert(), nsjpegxl_convert(), nspng_convert(), nssprite_convert(), rsvg_convert(), svg_convert(), textplain_convert(), and webp_convert().
void content_set_error | ( | struct content * | c | ) |
Put a content in status CONTENT_STATUS_ERROR and unlock the content.
Definition at line 313 of file content.c.
References CONTENT_STATUS_ERROR, content::locked, and content::status.
Referenced by content_convert(), hlcache_clean(), html_begin_conversion(), html_box_convert_done(), html_finish_conversion(), and nscss_content_done().
void content_set_ready | ( | struct content * | c | ) |
Put a content in status CONTENT_STATUS_READY and unlock the content.
Definition at line 285 of file content.c.
References content_broadcast(), CONTENT_MSG_READY, CONTENT_STATUS_READY, content_update_status(), content::locked, and content::status.
Referenced by amiga_plugin_hack_convert(), content_convert(), gif_convert(), html_box_convert_done(), javascript_convert(), nsbmp_convert(), nscss_content_done(), nsico_convert(), nsjpeg_convert(), nsjpegxl_convert(), nspng_convert(), nssprite_convert(), rsvg_convert(), svg_convert(), textplain_convert(), and webp_convert().
void content_set_status | ( | struct content * | c, |
const char * | status_message | ||
) |
Updates content with new status.
The textual status contained in the content is updated with given string.
c | The content to set status in. |
status_message | new textual status |
Definition at line 270 of file content.c.
References content_update_status(), content::status_message, and content::sub_status.
Referenced by amiga_plugin_hack_convert(), content__init(), content_llcache_callback(), gif_convert(), html_finish_conversion(), nsbmp_convert(), nsico_convert(), nsjpeg_convert(), nsjpegxl_convert(), nspng_convert(), nssprite_convert(), rsvg_convert(), svg_convert(), and textplain_convert().
|
static |
update content status message
c | the content to update. |
Definition at line 171 of file content.c.
References CONTENT_STATUS_LOADING, CONTENT_STATUS_READY, messages_get(), content::status, content::status_message, content::sub_status, and content::time.
Referenced by content_set_done(), content_set_ready(), and content_set_status().