NetSurf
Data Structures | Functions
content.h File Reference

Content handling interface. More...

#include <libwapcaplet/libwapcaplet.h>
#include "netsurf/content_type.h"
#include "netsurf/mouse.h"
#include "netsurf/console.h"
Include dependency graph for content.h:
This graph shows which files directly or indirectly include this file:

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_linkcontent_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 nsurlcontent_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...
 

Detailed Description

Content handling interface.

The content functions manipulate struct contents, which correspond to URLs.

Definition in file content.h.

Function Documentation

◆ content__get_status()

content_status content__get_status ( struct content c)

Retrieve status of content.

Parameters
cContent to retrieve status from.
Returns
Content status

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().

Here is the caller graph for this function:

◆ content_can_reformat()

bool content_can_reformat ( struct hlcache_handle h)

Get whether a content can reformat.

Parameters
hcontent to check
Returns
whether the content can reformat

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_clear_selection()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_close()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_debug()

nserror content_debug ( struct hlcache_handle h,
enum content_debug  op 
)

Control debug con a content.

Parameters
hcontent handle to debug.
opDebug 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.

Here is the call graph for this function:

◆ content_drop_file_at_point()

bool content_drop_file_at_point ( struct hlcache_handle h,
int  x,
int  y,
char *  file 
)

Drag and drop a file at coordinate.

Parameters
[in]hHandle to content to examine.
[in]xThe x coordinate to examine.
[in]yThe 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_exec()

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.

Parameters
hThe handle to the content
srcThe JavaScript source code
srclenThe length of the source code
Returns
Whether the JS function was successfully injected into the content

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_find_rfc5988_link()

struct content_rfc5988_link * content_find_rfc5988_link ( struct hlcache_handle h,
lwc_string *  rel 
)

find link in content that matches the rel string.

Parameters
hhandle to the content to retrieve tyoe of.
relThe string to match.
Returns
A matching rfc5988 link or NULL if none is found.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_get_available_width()

int content_get_available_width ( struct hlcache_handle h)

Retrieve available width of content.

Parameters
hhandle to the content to get available width of.
Returns
Available width of content.

Definition at line 1192 of file content.c.

References content__get_available_width(), and hlcache_handle_get_content().

Referenced by layout_line().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_get_contextual_content()

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.

Parameters
[in]hHandle to content to examine.
[in]xThe x coordinate to examine.
[in]yThe y coordinate to examine.
[out]dataThe 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_get_opaque()

bool content_get_opaque ( struct hlcache_handle h)

Determine if a content is opaque from handle.

Parameters
hhigh level cache handle to retrieve opacity from.
Returns
false if the content is not opaque or information is not known else true.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_get_quirks()

bool content_get_quirks ( struct hlcache_handle h)

Retrieve quirkiness of a content.

Parameters
hContent to examine
Returns
True if content is quirky, false otherwise

Definition at line 1308 of file content.c.

References hlcache_handle_get_content(), and content::quirks.

Referenced by browser_window_navigate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_get_refresh_url()

struct nsurl * content_get_refresh_url ( struct hlcache_handle h)

Retrieve the refresh URL for a content.

Parameters
hContent to retrieve refresh URL from
Returns
Pointer to URL, or NULL if none

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_get_selection()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_get_status()

content_status content_get_status ( struct hlcache_handle h)

Retrieve status of content.

Parameters
hhandle to the content to retrieve status from
Returns
Content status

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_get_status_message()

const char * content_get_status_message ( struct hlcache_handle h)

Retrieve status message associated with content.

Parameters
hhandle to the content to retrieve status message from
Returns
Pointer to status message, or NULL if not found.

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_is_locked()

bool content_is_locked ( struct hlcache_handle h)

Return whether a content is currently locked.

Parameters
hhandle to the content.
Returns
true iff locked, else false

Definition at line 1344 of file content.c.

References content__is_locked(), and hlcache_handle_get_content().

Referenced by browser_window_redraw_ready().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_keypress()

bool content_keypress ( struct hlcache_handle h,
uint32_t  key 
)

Handle keypresses.

Parameters
hContent handle
keyThe UCS4 character codepoint
Returns
true if key handled, false otherwise

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_mouse_action()

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.

Parameters
hContent handle
bwbrowser window
mousestate of mouse buttons and modifier keys
xcoordinate of mouse
ycoordinate 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_mouse_track()

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.

Parameters
hContent handle
bwbrowser window
mousestate of mouse buttons and modifier keys
xcoordinate of mouse
ycoordinate 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_open()

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.

Parameters
hhandle to content that has been opened
bwbrowser window containing the content
pagecontent of type CONTENT_HTML containing h, or NULL if not an object within a page
paramsobject 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_reformat()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_request_redraw()

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.

Parameters
hhigh-level cache handle
xx co-ord of left edge
yy co-ord of top edge
widthWidth of rectangle
heightHeight 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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_saw_insecure_objects()

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.

Parameters
hThe handle to the content
Returns
Whether the content referred to any insecure objects

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ content_scroll_at_point()

bool content_scroll_at_point ( struct hlcache_handle h,
int  x,
int  y,
int  scrx,
int  scry 
)

scroll content at coordnate

Parameters
[in]hHandle to content to examine.
[in]xThe x coordinate to examine.
[in]yThe 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().

Here is the call graph for this function:
Here is the caller graph for this function: