NetSurf
Functions
box_normalise.h File Reference

HTML Box tree normalise interface. More...

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

Go to the source code of this file.

Functions

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. More...
 

Detailed Description

HTML Box tree normalise interface.

A box tree is "normalized" if the following is satisfied:

parent permitted child nodes
BLOCK, INLINE_BLOCK BLOCK, INLINE_CONTAINER, TABLE
INLINE_CONTAINER INLINE, INLINE_BLOCK, FLOAT_LEFT, FLOAT_RIGHT, BR, TEXT,
INLINE_END
INLINE none
TABLE at least 1 TABLE_ROW_GROUP
TABLE_ROW_GROUP at least 1 TABLE_ROW
TABLE_ROW at least 1 TABLE_CELL
TABLE_CELL BLOCK, INLINE_CONTAINER, TABLE (same as BLOCK)
FLOAT_(LEFT|RIGHT) exactly 1 BLOCK or TABLE
@ LEFT
Definition: box.h:98
@ RIGHT
Definition: box.h:98
wimp_w parent
Definition: dialog.c:88

Definition in file box_normalise.h.

Function Documentation

◆ 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.

Parameters
blockbox of type BLOCK, INLINE_BLOCK, or TABLE_CELL
rootroot box of document
ccontent of boxes
Returns
true on success, false on memory exhaustion

The tree is modified to satisfy the following:

parent permitted child nodes
BLOCK, INLINE_BLOCK BLOCK, INLINE_CONTAINER, TABLE, FLEX
FLEX, INLINE_FLEX BLOCK, INLINE_CONTAINER, TABLE, FLEX
INLINE_CONTAINER INLINE, INLINE_BLOCK, FLOAT_LEFT, FLOAT_RIGHT, BR, TEXT, INLINE_FLEX
INLINE, TEXT none
TABLE at least 1 TABLE_ROW_GROUP
TABLE_ROW_GROUP at least 1 TABLE_ROW
TABLE_ROW at least 1 TABLE_CELL
TABLE_CELL BLOCK, INLINE_CONTAINER, TABLE, FLEX (same as BLOCK)
FLOAT_(LEFT|RIGHT) exactly 1 BLOCK, TABLE or FLEX

Definition at line 1088 of file box_normalise.c.

References nscss_select_ctx::base_url, html_content::base_url, html_content::bctx, box_add_child(), BOX_BLOCK, BOX_BR, box_create(), BOX_FLEX, BOX_FLOAT_LEFT, BOX_FLOAT_RIGHT, BOX_INLINE, BOX_INLINE_BLOCK, BOX_INLINE_CONTAINER, BOX_INLINE_END, BOX_INLINE_FLEX, box_normalise_block(), box_normalise_flex(), box_normalise_inline_container(), box_normalise_table(), BOX_TABLE, BOX_TABLE_CELL, BOX_TABLE_ROW, BOX_TABLE_ROW_GROUP, BOX_TEXT, box::children, nscss_select_ctx::ctx, box::href, box::last, box::next, nscss_get_blank_style(), NSLOG, box::parent, box::prev, nscss_select_ctx::quirks, html_content::quirks, root, nscss_select_ctx::root_style, html_content::select_ctx, box::style, box::target, box::type, html_content::unit_len_ctx, nscss_select_ctx::universal, and html_content::universal.

Referenced by box_normalise_block(), box_normalise_flex(), box_normalise_inline_container(), box_normalise_table_row(), and convert_xml_to_box().

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