NetSurf
Functions
box_manipulate.h File Reference

Box tree manipulation interface. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

struct boxbox_create (css_select_results *styles, css_computed_style *style, bool style_owned, struct nsurl *href, const char *target, const char *title, lwc_string *id, void *context)
 Create a box tree node. More...
 
void box_add_child (struct box *parent, struct box *child)
 Add a child to a box tree node. More...
 
void box_insert_sibling (struct box *box, struct box *new_box)
 Insert a new box as a sibling to a box in a tree. More...
 
void box_unlink_and_free (struct box *box)
 Unlink a box from the box tree and then free it recursively. More...
 
void box_free (struct box *box)
 Free a box tree recursively. More...
 
void box_free_box (struct box *box)
 Free the data in a single box structure. More...
 
nserror box_handle_scrollbars (struct content *c, struct box *box, bool bottom, bool right)
 Applies the given scroll setup to a box. More...
 

Detailed Description

Box tree manipulation interface.

Definition in file box_manipulate.h.

Function Documentation

◆ box_add_child()

void box_add_child ( struct box parent,
struct box child 
)

Add a child to a box tree node.

Parameters
parentbox giving birth
childbox to link as last child of parent

Definition at line 163 of file box_manipulate.c.

References box::parent, parent, and box::prev.

Referenced by box_construct_element(), box_construct_element_after(), box_construct_generate(), box_construct_text(), box_input(), box_input_text(), box_normalise_block(), box_normalise_flex(), box_normalise_table(), box_normalise_table_row(), box_normalise_table_row_group(), and box_select().

Here is the caller graph for this function:

◆ box_create()

struct box * box_create ( css_select_results *  styles,
css_computed_style *  style,
bool  style_owned,
struct nsurl href,
const char *  target,
const char *  title,
lwc_string *  id,
void *  context 
)

Create a box tree node.

Parameters
stylesselection results for the box, or NULL
stylecomputed style for the box (not copied), or 0
style_ownedwhether style is owned by this box
hrefhref for the box (copied), or 0
targettarget for the box (not copied), or 0
titletitle for the box (not copied), or 0
idid for the box (not copied), or 0
contextcontext for allocations
Returns
allocated and initialised box, or 0 on memory exhaustion

styles is always owned by the box, if it is set. style is only owned by the box in the case of implied boxes.

Definition at line 92 of file box_manipulate.c.

References box::background, box::border, BOX_INLINE, box_talloc_destructor(), box::byte_offset, box::cached_place_below_level, box::children, box::col, box::columns, box::descendant_x0, box::descendant_x1, box::descendant_y0, box::descendant_y1, box::flags, box::float_children, box::float_container, box::gadget, box::height, box::href, box::id, box::iframe, box::inline_end, box::last, box::length, box::list_marker, box::list_value, box::margin, box::max_width, box::min_width, box::next, box::next_float, box::node, nsurl_ref(), box::object, box::object_params, box::padding, box::parent, box::prev, box::rows, box::scroll_x, box::scroll_y, box::space, box::start_column, box::style, STYLE_OWNED, box::styles, talloc, talloc_set_destructor, box::target, box::text, box::title, box::type, UNKNOWN_MAX_WIDTH, UNKNOWN_WIDTH, box::usemap, box_border::width, box::width, box::x, and box::y.

Referenced by box_construct_element(), box_construct_element_after(), box_construct_generate(), box_construct_marker(), box_construct_text(), box_input(), box_input_text(), box_normalise_block(), box_normalise_flex(), box_normalise_table(), box_normalise_table_row(), box_normalise_table_row_group(), box_normalise_table_spans(), and box_select().

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

◆ box_free()

void box_free ( struct box box)

Free a box tree recursively.

Parameters
boxbox to free recursively

The box and all its children is freed.

Definition at line 219 of file box_manipulate.c.

References box_free(), box_free_box(), box::children, and box::next.

Referenced by box_free(), box_normalise_inline_container(), box_normalise_table(), and box_unlink_and_free().

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

◆ box_free_box()

void box_free_box ( struct box box)

Free the data in a single box structure.

Parameters
boxbox to free

Definition at line 235 of file box_manipulate.c.

References CLONE, box::flags, form_free_control(), box::gadget, box::scroll_x, box::scroll_y, scrollbar_destroy(), box::styles, and talloc_free().

Referenced by box_free().

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

◆ box_handle_scrollbars()

nserror box_handle_scrollbars ( struct content c,
struct box box,
bool  bottom,
bool  right 
)

Applies the given scroll setup to a box.

This includes scroll creation/deletion as well as scroll dimension updates.

Parameters
ccontent in which the box is located
boxthe box to handle the scrolls for
bottomwhether the horizontal scrollbar should be present
rightwhether the vertical scrollbar should be present
Returns
true on success false otherwise

Definition at line 254 of file box_manipulate.c.

References box::border, BOTTOM, html_scrollbar_data::box, html_scrollbar_data::c, box::descendant_x1, box::descendant_y1, box::height, html_overflow_scroll_callback(), LEFT, NSERROR_NOMEM, NSERROR_OK, box::padding, RIGHT, box::scroll_x, box::scroll_y, scrollbar_create(), scrollbar_destroy(), scrollbar_get_data(), scrollbar_make_pair(), scrollbar_set_extents(), SCROLLBAR_WIDTH, TOP, box_border::width, and box::width.

Referenced by html_redraw_box().

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

◆ box_insert_sibling()

void box_insert_sibling ( struct box box,
struct box new_box 
)

Insert a new box as a sibling to a box in a tree.

Parameters
boxbox already in tree
new_boxbox to link into tree as next sibling

Definition at line 182 of file box_manipulate.c.

References box::last, box::next, box::parent, and box::prev.

◆ box_unlink_and_free()

void box_unlink_and_free ( struct box box)

Unlink a box from the box tree and then free it recursively.

Parameters
boxbox to unlink and free recursively.

Definition at line 196 of file box_manipulate.c.

References box_free(), box::next, box::parent, parent, and box::prev.

Here is the call graph for this function: