NetSurf
|
Content handling interface. More...
#include <libwapcaplet/libwapcaplet.h>
#include "netsurf/content_type.h"
#include "netsurf/mouse.h"
#include "netsurf/console.h"
Go to the source code of this file.
Data Structures | |
struct | content_rfc5988_link |
RFC5988 metadata link. More... | |
union | content_msg_data |
Extra data for some content_msg messages. More... | |
Functions | |
bool | content_can_reformat (struct hlcache_handle *h) |
Get whether a content can reformat. More... | |
void | content_reformat (struct hlcache_handle *h, bool background, int width, int height) |
Reformat to new size. 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_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. More... | |
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. More... | |
bool | content_keypress (struct hlcache_handle *h, uint32_t key) |
Handle keypresses. More... | |
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. More... | |
nserror | content_close (struct hlcache_handle *h) |
The window containing the content has been closed. More... | |
void | content_clear_selection (struct 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 (struct 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 (struct hlcache_handle *h, enum content_debug op) |
Control debug con a content. More... | |
struct content_rfc5988_link * | content_find_rfc5988_link (struct hlcache_handle *h, lwc_string *rel) |
find link in content that matches the rel string. More... | |
content_status | content_get_status (struct 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 (struct hlcache_handle *h) |
Retrieve status message associated with content. More... | |
int | content_get_available_width (struct hlcache_handle *h) |
Retrieve available width of content. More... | |
struct nsurl * | content_get_refresh_url (struct hlcache_handle *h) |
Retrieve the refresh URL for a content. More... | |
bool | content_get_opaque (struct hlcache_handle *h) |
Determine if a content is opaque from handle. More... | |
bool | content_get_quirks (struct hlcache_handle *h) |
Retrieve quirkiness of a content. More... | |
bool | content_is_locked (struct hlcache_handle *h) |
Return whether a content is currently locked. 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... | |
Content handling interface.
The content functions manipulate struct contents, which correspond to URLs.
Definition in file content.h.
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().
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 | ( | struct 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().
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().
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.
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().
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().
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().
struct 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().
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().
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_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().
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().
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_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_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().