From e8d0ba15ad4a91b4644cac0095f40bb3246ec509 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 29 Apr 2020 20:37:42 +0100 Subject: split html box processing code reduce the module size of the html box handling code by splitting into smaller sections. No functional code change. --- content/handlers/html/box_manipulate.h | 106 +++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 content/handlers/html/box_manipulate.h (limited to 'content/handlers/html/box_manipulate.h') diff --git a/content/handlers/html/box_manipulate.h b/content/handlers/html/box_manipulate.h new file mode 100644 index 000000000..43a66a7d9 --- /dev/null +++ b/content/handlers/html/box_manipulate.h @@ -0,0 +1,106 @@ +/* + * Copyright 2005 James Bursa + * Copyright 2003 Phil Mellor + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file + * Box tree manipulation interface. + */ + +#ifndef NETSURF_HTML_BOX_MANIPULATE_H +#define NETSURF_HTML_BOX_MANIPULATE_H + + +/** + * Create a box tree node. + * + * \param styles selection results for the box, or NULL + * \param style computed style for the box (not copied), or 0 + * \param style_owned whether style is owned by this box + * \param href href for the box (copied), or 0 + * \param target target for the box (not copied), or 0 + * \param title title for the box (not copied), or 0 + * \param id id for the box (not copied), or 0 + * \param context context for allocations + * \return 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. + */ +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); + + +/** + * Add a child to a box tree node. + * + * \param parent box giving birth + * \param child box to link as last child of parent + */ +void box_add_child(struct box *parent, struct box *child); + + +/** + * Insert a new box as a sibling to a box in a tree. + * + * \param box box already in tree + * \param new_box box to link into tree as next sibling + */ +void box_insert_sibling(struct box *box, struct box *new_box); + + +/** + * Unlink a box from the box tree and then free it recursively. + * + * \param box box to unlink and free recursively. + */ +void box_unlink_and_free(struct box *box); + + +/** + * Free a box tree recursively. + * + * \param box box to free recursively + * + * The box and all its children is freed. + */ +void box_free(struct box *box); + + +/** + * Free the data in a single box structure. + * + * \param box box to free + */ +void box_free_box(struct box *box); + + +/** + * Applies the given scroll setup to a box. This includes scroll + * creation/deletion as well as scroll dimension updates. + * + * \param c content in which the box is located + * \param box the box to handle the scrolls for + * \param bottom whether the horizontal scrollbar should be present + * \param right whether the vertical scrollbar should be present + * \return true on success false otherwise + */ +nserror box_handle_scrollbars(struct content *c, struct box *box, + bool bottom, bool right); + + +#endif -- cgit v1.2.3