NetSurf
|
implementation of box tree manipulation. More...
#include "utils/errors.h"
#include "utils/talloc.h"
#include "utils/nsurl.h"
#include "netsurf/types.h"
#include "netsurf/mouse.h"
#include "desktop/scrollbar.h"
#include "html/private.h"
#include "html/form_internal.h"
#include "html/interaction.h"
#include "html/box.h"
#include "html/box_manipulate.h"
Go to the source code of this file.
Functions | |
static int | box_talloc_destructor (struct box *b) |
Destructor for box nodes which own styles. More... | |
struct box * | box_create (css_select_results *styles, css_computed_style *style, bool style_owned, 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... | |
implementation of box tree manipulation.
Definition in file box_manipulate.c.
Add a child to a box tree node.
parent | box giving birth |
child | box 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().
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.
styles | selection results for the box, or NULL |
style | computed style for the box (not copied), or 0 |
style_owned | whether style is owned by this box |
href | href for the box (copied), or 0 |
target | target for the box (not copied), or 0 |
title | title for the box (not copied), or 0 |
id | id for the box (not copied), or 0 |
context | context for allocations |
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().
void box_free | ( | struct box * | box | ) |
Free a box tree recursively.
box | box 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().
void box_free_box | ( | struct box * | box | ) |
Free the data in a single box structure.
box | box 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().
Applies the given scroll setup to a box.
This includes scroll creation/deletion as well as scroll dimension updates.
c | content in which the box is located |
box | the box to handle the scrolls for |
bottom | whether the horizontal scrollbar should be present |
right | whether the vertical scrollbar should be present |
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().
Insert a new box as a sibling to a box in a tree.
box | box already in tree |
new_box | box 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.
|
static |
Destructor for box nodes which own styles.
b | The box being destroyed. |
Definition at line 49 of file box_manipulate.c.
References box::flags, box::href, box::id, box::node, nsurl_unref(), box::scroll_x, box::scroll_y, scrollbar_destroy(), scrollbar_get_data(), box::style, STYLE_OWNED, and box::styles.
Referenced by box_create().
void box_unlink_and_free | ( | struct box * | box | ) |
Unlink a box from the box tree and then free it recursively.
box | box 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.