NetSurf
Data Structures | Typedefs | Enumerations | Functions | Variables
private.h File Reference

Private data for text/html content. More...

#include <dom/bindings/hubbub/parser.h>
#include "netsurf/types.h"
#include "content/content_protected.h"
#include "content/handlers/css/utils.h"
Include dependency graph for private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  html_drag_owner
 For drags we don't own. More...
 
union  html_selection_owner
 For getting at selections in this content or things in this content. More...
 
union  html_focus_owner
 For directing input. More...
 
struct  html_content
 Data specific to CONTENT_HTML. More...
 

Typedefs

typedef struct html_content html_content
 Data specific to CONTENT_HTML. More...
 

Enumerations

enum  html_drag_type {
  HTML_DRAG_NONE , HTML_DRAG_SELECTION , HTML_DRAG_SCROLLBAR , HTML_DRAG_TEXTAREA_SELECTION ,
  HTML_DRAG_TEXTAREA_SCROLLBAR , HTML_DRAG_CONTENT_SELECTION , HTML_DRAG_CONTENT_SCROLL
}
 
enum  html_selection_type { HTML_SELECTION_NONE , HTML_SELECTION_TEXTAREA , HTML_SELECTION_SELF , HTML_SELECTION_CONTENT }
 
enum  html_focus_type { HTML_FOCUS_SELF , HTML_FOCUS_CONTENT , HTML_FOCUS_TEXTAREA }
 

Functions

void html__redraw_a_box (html_content *htmlc, struct box *box)
 redraw a box More...
 
void html_finish_conversion (html_content *htmlc)
 Complete conversion of an HTML document. More...
 
bool html_can_begin_conversion (html_content *htmlc)
 Test if an HTML content conversion can begin. More...
 
bool html_begin_conversion (html_content *htmlc)
 Begin conversion of an HTML document. More...
 
bool html_exec (struct content *c, const char *src, size_t srclen)
 execute some text as a script element More...
 
nserror html_script_exec (html_content *htmlc, bool allow_defer)
 Attempt script execution for defer and async scripts. More...
 
nserror html_script_free (html_content *htmlc)
 Free all script resources and references for a html content. More...
 
bool html_saw_insecure_scripts (html_content *htmlc)
 Check if any of the scripts loaded were insecure. More...
 
nserror html_proceed_to_done (html_content *html)
 Complete the HTML content state machine iff all scripts are finished. More...
 
bool html_redraw (struct content *c, struct content_redraw_data *data, const struct rect *clip, const struct redraw_context *ctx)
 Draw a CONTENT_HTML using the current set of plotters (plot). More...
 
bool html_redraw_borders (struct box *box, int x_parent, int y_parent, int p_width, int p_height, const struct rect *clip, float scale, const struct redraw_context *ctx)
 Draw borders for a box. More...
 
bool html_redraw_inline_borders (struct box *box, struct rect b, const struct rect *clip, float scale, bool first, bool last, const struct redraw_context *ctx)
 Draw an inline's borders. More...
 
dom_hubbub_error html_process_script (void *ctx, dom_node *node)
 process script node parser callback More...
 
struct formhtml_forms_get_forms (const char *docenc, dom_html_document *doc)
 
struct form_controlhtml_forms_get_control_for_node (struct form *forms, dom_node *node)
 
nserror html_css_fetcher_register (void)
 Register the fetcher for the pseudo x-ns-css scheme. More...
 
nserror html_css_fetcher_add_item (dom_string *data, struct nsurl *base_url, uint32_t *key)
 
bool fire_generic_dom_event (dom_string *type, dom_node *target, bool bubbles, bool cancelable)
 Construct an event and fire it at the DOM. More...
 
bool fire_dom_keyboard_event (dom_string *type, dom_node *target, bool bubbles, bool cancelable, uint32_t key)
 Construct a keyboard event and fire it at the DOM. More...
 

Variables

bool html_redraw_debug
 Render padding and margin box outlines in html_redraw(). More...
 
struct dom_string * html_dom_string_map
 
struct dom_string * html_dom_string_id
 
struct dom_string * html_dom_string_name
 
struct dom_string * html_dom_string_area
 
struct dom_string * html_dom_string_a
 
struct dom_string * html_dom_string_nohref
 
struct dom_string * html_dom_string_href
 
struct dom_string * html_dom_string_target
 
struct dom_string * html_dom_string_shape
 
struct dom_string * html_dom_string_default
 
struct dom_string * html_dom_string_rect
 
struct dom_string * html_dom_string_rectangle
 
struct dom_string * html_dom_string_coords
 
struct dom_string * html_dom_string_circle
 
struct dom_string * html_dom_string_poly
 
struct dom_string * html_dom_string_polygon
 
struct dom_string * html_dom_string_text_javascript
 
struct dom_string * html_dom_string_type
 
struct dom_string * html_dom_string_src
 

Detailed Description

Private data for text/html content.

Definition in file private.h.

Typedef Documentation

◆ html_content

typedef struct html_content html_content

Data specific to CONTENT_HTML.

Enumeration Type Documentation

◆ html_drag_type

Enumerator
HTML_DRAG_NONE 
HTML_DRAG_SELECTION 

No drag.

HTML_DRAG_SCROLLBAR 

Own; Text selection.

HTML_DRAG_TEXTAREA_SELECTION 

Not own; drag in scrollbar widget.

HTML_DRAG_TEXTAREA_SCROLLBAR 

Not own; drag in textarea widget.

HTML_DRAG_CONTENT_SELECTION 

Not own; drag in textarea widget.

HTML_DRAG_CONTENT_SCROLL 

Not own; drag in child content.

Not own; drag in child content

Definition at line 39 of file private.h.

◆ html_focus_type

Enumerator
HTML_FOCUS_SELF 

Focus is our own.

HTML_FOCUS_CONTENT 

Focus belongs to child content.

HTML_FOCUS_TEXTAREA 

Focus belongs to textarea.

Definition at line 75 of file private.h.

◆ html_selection_type

Enumerator
HTML_SELECTION_NONE 
HTML_SELECTION_TEXTAREA 

No selection.

HTML_SELECTION_SELF 

Selection in one of our textareas.

HTML_SELECTION_CONTENT 

Selection in this html content.

Selection in child content

Definition at line 59 of file private.h.

Function Documentation

◆ fire_dom_keyboard_event()

bool fire_dom_keyboard_event ( dom_string *  type,
dom_node *  target,
bool  bubbles,
bool  cancelable,
uint32_t  key 
)

Construct a keyboard event and fire it at the DOM.

Definition at line 133 of file html.c.

References fire_dom_event(), NS_KEY_DOWN, NS_KEY_ESCAPE, NS_KEY_LEFT, NS_KEY_PAGE_DOWN, NS_KEY_PAGE_UP, NS_KEY_RIGHT, NS_KEY_TEXT_END, NS_KEY_TEXT_START, NS_KEY_UP, NSLOG, result, type, and utf8_from_ucs4().

Referenced by html_keypress().

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

◆ fire_generic_dom_event()

bool fire_generic_dom_event ( dom_string *  type,
dom_node *  target,
bool  bubbles,
bool  cancelable 
)

Construct an event and fire it at the DOM.

Definition at line 111 of file html.c.

References fire_dom_event(), NSLOG, result, and type.

Referenced by mouse_action_drag_none().

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

◆ html__redraw_a_box()

void html__redraw_a_box ( struct html_content html,
struct box box 
)

redraw a box

Parameters
htmlcHTML content
boxThe box to redraw.

redraw a box

Parameters
htmlcontent containing the box, of type CONTENT_HTML
boxbox to redraw.

Definition at line 1130 of file html.c.

References BOTTOM, box_coords(), content__request_redraw(), box::height, LEFT, box::padding, RIGHT, TOP, box::width, box::x, and box::y.

Referenced by form__select_process_selection(), form_radio_set(), gadget_mouse_action(), html__set_file_gadget_filename(), html_overflow_scroll_callback(), and html_texty_element_update().

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

◆ html_begin_conversion()

bool html_begin_conversion ( html_content htmlc)

Begin conversion of an HTML document.

Parameters
htmlcContent to convert

Definition at line 833 of file html.c.

References html_content::aborted, form::action, content::active, html_content::base, html_content::base_url, content_broadcast_error(), content_get_url(), content_set_error(), html_content::conversion_begun, html_content::document, form::document_charset, html_content::encoding, html_content::encoding_source, html_content::forms, html_can_begin_conversion(), html_finish_conversion(), html_forms_get_forms(), html_script_exec(), libdom_hubbub_error_to_nserror(), node_name(), NSERROR_DOM, NSERROR_NOMEM, NSERROR_OK, NSERROR_STOPPED, NSLOG, nsurl_access(), nsurl_join(), nsurl_unref(), html_content::parse_completed, html_content::parser, and form::prev.

Referenced by convert_script_async_cb(), convert_script_defer_cb(), convert_script_sync_cb(), html_convert(), and html_convert_css_callback().

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

◆ html_can_begin_conversion()

bool html_can_begin_conversion ( html_content htmlc)

Test if an HTML content conversion can begin.

Parameters
htmlchtml content to test
Returns
true iff the html content conversion can begin

Definition at line 814 of file html.c.

References content::active, html_content::base, html_stylesheet::modified, html_content::stylesheet_count, and html_content::stylesheets.

Referenced by convert_script_async_cb(), convert_script_defer_cb(), convert_script_sync_cb(), html_begin_conversion(), html_convert(), and html_convert_css_callback().

Here is the caller graph for this function:

◆ html_css_fetcher_add_item()

nserror html_css_fetcher_add_item ( dom_string *  data,
struct nsurl base_url,
uint32_t *  key 
)

Definition at line 305 of file css_fetcher.c.

References html_css_fetcher_item::base_url, current_key, html_css_fetcher_item::data, items, html_css_fetcher_item::key, NSERROR_NOMEM, NSERROR_OK, nsurl_ref(), and RING_INSERT.

Referenced by html_stylesheet_from_domnode().

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

◆ html_css_fetcher_register()

nserror html_css_fetcher_register ( void  )

Register the fetcher for the pseudo x-ns-css scheme.

Returns
NSERROR_OK on successful registration or error code on failure.

Definition at line 286 of file css_fetcher.c.

References fetcher_add(), html_css_fetcher_abort(), html_css_fetcher_can_fetch(), html_css_fetcher_finalise(), html_css_fetcher_free(), html_css_fetcher_initialise(), html_css_fetcher_poll(), html_css_fetcher_setup(), html_css_fetcher_start(), and fetcher_operation_table::initialise.

Referenced by html_css_init().

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

◆ html_exec()

bool html_exec ( struct content c,
const char *  src,
size_t  srclen 
)

execute some text as a script element

Definition at line 2090 of file html.c.

References html_content::document, NSLOG, and result.

Referenced by mouse_action_drag_none().

Here is the caller graph for this function:

◆ html_finish_conversion()

void html_finish_conversion ( html_content htmlc)

Complete conversion of an HTML document.

Parameters
htmlcContent to convert

Definition at line 341 of file html.c.

References html_content::aborted, html_content::base, html_content::box_conversion_context, content_broadcast(), content_broadcast_error(), CONTENT_MSG_STATUS, content_set_error(), content_set_status(), html_content::document, dom_to_box(), content_msg_data::explicit_status_text, html_box_convert_done(), html_css_new_selection_context(), html_get_dimensions(), html_object_free_objects(), js_fire_event(), html_content::jsthread, messages_get(), NSERROR_DOM, NSERROR_OK, NSERROR_STOPPED, NSLOG, and html_content::select_ctx.

Referenced by html_begin_conversion().

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

◆ html_forms_get_control_for_node()

struct form_control * html_forms_get_control_for_node ( struct form forms,
dom_node *  node 
)

Definition at line 545 of file forms.c.

References form::controls, invent_fake_gadget(), form_control::next, form_control::node, parse_button_element(), parse_input_element(), parse_select_element(), parse_textarea_element(), and form::prev.

Referenced by box_button(), box_input(), box_select(), and box_textarea().

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

◆ html_forms_get_forms()

struct form * html_forms_get_forms ( const char *  docenc,
dom_html_document *  doc 
)

Definition at line 126 of file forms.c.

References form::node, parse_form_element(), and form::prev.

Referenced by html_begin_conversion().

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

◆ html_proceed_to_done()

nserror html_proceed_to_done ( html_content html)

Complete the HTML content state machine iff all scripts are finished.

Definition at line 285 of file html.c.

References content::active, html_content::base, content__get_status(), content_set_done(), CONTENT_STATUS_DONE, CONTENT_STATUS_LOADING, CONTENT_STATUS_READY, NSERROR_OK, NSERROR_UNKNOWN, and NSLOG.

Referenced by html_box_convert_done(), and html_script_exec().

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

◆ html_process_script()

dom_hubbub_error html_process_script ( void *  ctx,
dom_node *  node 
)

process script node parser callback

Definition at line 566 of file script.c.

References html_content::base, content_broadcast(), CONTENT_MSG_GETTHREAD, exec_inline_script(), exec_src_script(), content_msg_data::jsthread, html_content::jsthread, html_script::mimetype, NSLOG, html_content::parser, and content_msg_data::src.

Referenced by dom_SCRIPT_showed_up(), html_create_html_data(), and html_process_encoding_change().

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

◆ html_redraw()

bool html_redraw ( struct content c,
struct content_redraw_data data,
const struct rect clip,
const struct redraw_context ctx 
)

Draw a CONTENT_HTML using the current set of plotters (plot).

Parameters
ccontent of type CONTENT_HTML
dataredraw data for this content redraw
clipcurrent clip region
ctxcurrent redraw context
Returns
true if successful, false otherwise

x, y, clip_[xy][01] are in target coordinates.

Definition at line 1944 of file redraw.c.

References html_content::background_colour, content_redraw_data::background_colour, box::border, BOTTOM, form_control::box, box_coords(), clip(), plotter_table::clip, form_control::data, plot_style_s::fill_colour, plot_style_s::fill_type, form_clip_inside_select_menu(), form_redraw_select_menu(), box::height, form_control::html, html_redraw_box(), redraw_context::interactive, html_content::layout, LEFT, NS_TRANSPARENT, NSERROR_OK, box::padding, redraw_context::plot, PLOT_OP_TYPE_SOLID, plotter_table::rectangle, result, form_control::select, TOP, html_content::visible_select_menu, and box_border::width.

Here is the call graph for this function:

◆ html_redraw_borders()

bool html_redraw_borders ( struct box box,
int  x_parent,
int  y_parent,
int  p_width,
int  p_height,
const struct rect clip,
float  scale,
const struct redraw_context ctx 
)

Draw borders for a box.

Parameters
boxbox to draw
x_parentcoordinate of left padding edge of parent of box
y_parentcoordinate of top padding edge of parent of box
p_widthwidth of padding box
p_heightheight of padding box
clipcliping area for redrawing border.
scalescale for redraw
ctxcurrent redraw context
Returns
true if successful, false otherwise

Definition at line 444 of file redraw_border.c.

References box::border, BOTTOM, box_border::c, clip(), html_redraw_border_plot(), LEFT, nscss_color_is_transparent, nscss_color_to_ns, NSERROR_OK, RIGHT, box_border::style, box::style, TOP, box_border::width, box::x, and box::y.

Referenced by html_redraw_box().

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

◆ html_redraw_inline_borders()

bool html_redraw_inline_borders ( struct box box,
struct rect  b,
const struct rect clip,
float  scale,
bool  first,
bool  last,
const struct redraw_context ctx 
)

Draw an inline's borders.

Parameters
boxBOX_INLINE which created the border
bcoordinates of border edge rectangle
clipcliping area for redrawing border.
scalescale for redraw
firsttrue if this is the first rectangle associated with the inline
lasttrue if this is the last rectangle associated with the inline
ctxcurrent redraw context
Returns
true if successful, false otherwise

Definition at line 707 of file redraw_border.c.

References box::border, BOTTOM, box_border::c, clip(), html_redraw_border_plot(), LEFT, nscss_color_is_transparent, nscss_color_to_ns, NSERROR_OK, RIGHT, box_border::style, box::style, TOP, box_border::width, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by html_redraw_box().

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

◆ html_saw_insecure_scripts()

bool html_saw_insecure_scripts ( html_content htmlc)

Check if any of the scripts loaded were insecure.

Definition at line 611 of file script.c.

References content_saw_insecure_objects(), html_script::data, html_script::handle, html_script::HTML_SCRIPT_INLINE, html_content::scripts, html_content::scripts_count, and html_script::type.

Referenced by html_saw_insecure_objects().

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

◆ html_script_exec()

nserror html_script_exec ( html_content htmlc,
bool  allow_defer 
)

Attempt script execution for defer and async scripts.

execute scripts using algorithm found in: http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.html#the-script-element

Parameters
htmlchtml content.
allow_deferallow deferred execution, if not, only async scripts.
Returns
NSERROR_OK error code.

Definition at line 59 of file script.c.

References html_script::already_started, content_get_source_data(), content_get_status(), content_get_type(), CONTENT_STATUS_DONE, CONTENT_STATUS_ERROR, html_script::data, html_script::handle, hlcache_handle_get_url(), html_proceed_to_done(), html_script::HTML_SCRIPT_ASYNC, html_script::HTML_SCRIPT_DEFER, html_content::jsthread, NSERROR_BAD_PARAMETER, NSERROR_OK, nsurl_access(), html_content::scripts, html_content::scripts_count, select_script_handler(), and html_script::type.

Referenced by convert_script_async_cb(), and html_begin_conversion().

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

◆ html_script_free()

nserror html_script_free ( html_content htmlc)

Free all script resources and references for a html content.

Parameters
htmlchtml content.
Returns
NSERROR_OK or error code.

Definition at line 636 of file script.c.

References html_script::data, html_script::handle, hlcache_handle_release(), html_script::HTML_SCRIPT_ASYNC, html_script::HTML_SCRIPT_DEFER, html_script::HTML_SCRIPT_INLINE, html_script::HTML_SCRIPT_SYNC, html_script::mimetype, NSERROR_OK, html_content::scripts, html_content::scripts_count, html_script::string, and html_script::type.

Referenced by html_destroy().

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

Variable Documentation

◆ html_dom_string_a

struct dom_string* html_dom_string_a
extern

◆ html_dom_string_area

struct dom_string* html_dom_string_area
extern

◆ html_dom_string_circle

struct dom_string* html_dom_string_circle
extern

◆ html_dom_string_coords

struct dom_string* html_dom_string_coords
extern

◆ html_dom_string_default

struct dom_string* html_dom_string_default
extern

◆ html_dom_string_href

struct dom_string* html_dom_string_href
extern

◆ html_dom_string_id

struct dom_string* html_dom_string_id
extern

◆ html_dom_string_map

struct dom_string* html_dom_string_map
extern

◆ html_dom_string_name

struct dom_string* html_dom_string_name
extern

◆ html_dom_string_nohref

struct dom_string* html_dom_string_nohref
extern

◆ html_dom_string_poly

struct dom_string* html_dom_string_poly
extern

◆ html_dom_string_polygon

struct dom_string* html_dom_string_polygon
extern

◆ html_dom_string_rect

struct dom_string* html_dom_string_rect
extern

◆ html_dom_string_rectangle

struct dom_string* html_dom_string_rectangle
extern

◆ html_dom_string_shape

struct dom_string* html_dom_string_shape
extern

◆ html_dom_string_src

struct dom_string* html_dom_string_src
extern

◆ html_dom_string_target

struct dom_string* html_dom_string_target
extern

◆ html_dom_string_text_javascript

struct dom_string* html_dom_string_text_javascript
extern

◆ html_dom_string_type

struct dom_string* html_dom_string_type
extern

◆ html_redraw_debug

bool html_redraw_debug
extern

Render padding and margin box outlines in html_redraw().

Definition at line 68 of file redraw.c.

Referenced by html_redraw_box().