NetSurf
content
handlers
html
box_normalise.h
Go to the documentation of this file.
1
/*
2
* Copyright 2020 Vincent Sanders <vince@netsurf-browser.org>
3
*
4
* This file is part of NetSurf, http://www.netsurf-browser.org/
5
*
6
* NetSurf is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
9
*
10
* NetSurf is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*/
18
19
/**
20
* \file
21
* HTML Box tree normalise interface.
22
*
23
* A box tree is "normalized" if the following is satisfied:
24
* \code
25
* parent permitted child nodes
26
* BLOCK, INLINE_BLOCK BLOCK, INLINE_CONTAINER, TABLE
27
* INLINE_CONTAINER INLINE, INLINE_BLOCK, FLOAT_LEFT, FLOAT_RIGHT, BR, TEXT,
28
* INLINE_END
29
* INLINE none
30
* TABLE at least 1 TABLE_ROW_GROUP
31
* TABLE_ROW_GROUP at least 1 TABLE_ROW
32
* TABLE_ROW at least 1 TABLE_CELL
33
* TABLE_CELL BLOCK, INLINE_CONTAINER, TABLE (same as BLOCK)
34
* FLOAT_(LEFT|RIGHT) exactly 1 BLOCK or TABLE
35
* \endcode
36
*
37
*/
38
39
#ifndef NETSURF_HTML_BOX_NORMALISE_H
40
#define NETSURF_HTML_BOX_NORMALISE_H
41
42
/**
43
* Ensure the box tree is correctly nested by adding and removing nodes.
44
*
45
* \param block box of type BLOCK, INLINE_BLOCK, or TABLE_CELL
46
* \param root root box of document
47
* \param c content of boxes
48
* \return true on success, false on memory exhaustion
49
*
50
* The tree is modified to satisfy the following:
51
* \code
52
* parent permitted child nodes
53
* BLOCK, INLINE_BLOCK BLOCK, INLINE_CONTAINER, TABLE, FLEX
54
* FLEX, INLINE_FLEX BLOCK, INLINE_CONTAINER, TABLE, FLEX
55
* INLINE_CONTAINER INLINE, INLINE_BLOCK, FLOAT_LEFT, FLOAT_RIGHT, BR, TEXT, INLINE_FLEX
56
* INLINE, TEXT none
57
* TABLE at least 1 TABLE_ROW_GROUP
58
* TABLE_ROW_GROUP at least 1 TABLE_ROW
59
* TABLE_ROW at least 1 TABLE_CELL
60
* TABLE_CELL BLOCK, INLINE_CONTAINER, TABLE, FLEX (same as BLOCK)
61
* FLOAT_(LEFT|RIGHT) exactly 1 BLOCK, TABLE or FLEX
62
* \endcode
63
*/
64
bool
box_normalise_block
(
struct
box
*block,
const
struct
box
*
root
,
struct
html_content
*c);
65
66
#endif
box_normalise_block
bool box_normalise_block(struct box *block, const struct box *root, struct html_content *c)
Ensure the box tree is correctly nested by adding and removing nodes.
Definition:
box_normalise.c:1088
root
static struct directory * root
Definition:
filename.c:55
box
Node in box tree.
Definition:
box.h:177
html_content
Data specific to CONTENT_HTML.
Definition:
private.h:93
Generated on Fri Nov 15 2024 15:33:54 for NetSurf by
1.9.4