NetSurf
|
Box tree normalisation implementation. More...
#include <assert.h>
#include <stdbool.h>
#include <string.h>
#include "utils/log.h"
#include "utils/errors.h"
#include "css/select.h"
#include "html/private.h"
#include "html/table.h"
#include "html/box.h"
#include "html/box_manipulate.h"
#include "html/box_normalise.h"
Go to the source code of this file.
Data Structures | |
struct | span_info |
Row spanning information for a cell. More... | |
struct | columns |
Column record for a table. More... | |
Functions | |
static bool | calculate_table_row (struct columns *col_info, unsigned int col_span, unsigned int row_span, unsigned int *start_column, struct box *cell) |
Compute the column index at which the current cell begins. More... | |
static bool | box_normalise_table_row (struct box *row, const struct box *root, struct columns *col_info, html_content *c) |
static bool | box_normalise_table_row_group (struct box *row_group, const struct box *root, struct columns *col_info, html_content *c) |
static bool | box_normalise_table_spans (struct box *table, const struct box *root, struct span_info *spans, html_content *c) |
Normalise table cell column/row counts for colspan/rowspan = 0. More... | |
static bool | box_normalise_table (struct box *table, const struct box *root, html_content *c) |
static bool | box_normalise_flex (struct box *flex_container, const struct box *root, html_content *c) |
static bool | box_normalise_inline_container (struct box *cont, const struct box *root, html_content *c) |
bool | box_normalise_block (struct box *block, const struct box *root, html_content *c) |
Ensure the box tree is correctly nested by adding and removing nodes. More... | |
Box tree normalisation implementation.
Definition in file box_normalise.c.
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.
block | box of type BLOCK, INLINE_BLOCK, or TABLE_CELL |
root | root box of document |
c | content of boxes |
The tree is modified to satisfy the following:
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().
|
static |
Definition at line 818 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_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(), and box_normalise_inline_container().
|
static |
Definition at line 995 of file box_normalise.c.
References BOX_BLOCK, BOX_BR, BOX_FLEX, BOX_FLOAT_LEFT, BOX_FLOAT_RIGHT, box_free(), BOX_INLINE, BOX_INLINE_BLOCK, BOX_INLINE_CONTAINER, BOX_INLINE_END, BOX_INLINE_FLEX, box_normalise_block(), box_normalise_flex(), box_normalise_table(), BOX_TABLE, BOX_TABLE_CELL, BOX_TABLE_ROW, BOX_TABLE_ROW_GROUP, BOX_TEXT, box::children, box::last, box::next, NSLOG, box::parent, box::prev, root, and box::type.
Referenced by box_normalise_block().
|
static |
Definition at line 617 of file box_normalise.c.
References span_info::auto_row, 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_free(), BOX_INLINE, BOX_INLINE_BLOCK, BOX_INLINE_CONTAINER, BOX_INLINE_END, BOX_INLINE_FLEX, box_normalise_table_row_group(), box_normalise_table_spans(), BOX_TABLE, BOX_TABLE_CELL, BOX_TABLE_ROW, BOX_TABLE_ROW_GROUP, BOX_TEXT, box::children, box::columns, columns::current_column, box::href, box::last, box::next, nscss_get_blank_style(), NSLOG, columns::num_columns, columns::num_rows, box::parent, box::prev, html_content::quirks, root, span_info::row_span, box::rows, html_content::select_ctx, columns::spans, box::style, box::target, box::type, html_content::unit_len_ctx, and html_content::universal.
Referenced by box_normalise_block(), box_normalise_flex(), and box_normalise_inline_container().
|
static |
Definition at line 149 of file box_normalise.c.
References span_info::auto_row, 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_TABLE, BOX_TABLE_CELL, BOX_TABLE_ROW, BOX_TABLE_ROW_GROUP, BOX_TEXT, calculate_table_row(), box::children, box::columns, nscss_select_ctx::ctx, columns::current_column, box::href, box::last, box::next, nscss_get_blank_style(), NSLOG, columns::num_columns, columns::num_rows, box::parent, box::prev, nscss_select_ctx::quirks, html_content::quirks, root, nscss_select_ctx::root_style, span_info::row_span, box::rows, html_content::select_ctx, columns::spans, box::start_column, box::style, box::target, box::type, html_content::unit_len_ctx, nscss_select_ctx::universal, and html_content::universal.
Referenced by box_normalise_table_row_group().
|
static |
Definition at line 288 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_table_row(), 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, columns::num_rows, box::parent, box::prev, nscss_select_ctx::quirks, html_content::quirks, root, nscss_select_ctx::root_style, box::rows, 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_table().
|
static |
Normalise table cell column/row counts for colspan/rowspan = 0.
Additionally, generate empty cells.
table | Table to process |
root | root box of document |
spans | Array of length table->columns for use in empty cell detection |
c | Content containing table |
Definition at line 457 of file box_normalise.c.
References nscss_select_ctx::base_url, html_content::base_url, html_content::bctx, box_create(), BOX_TABLE_CELL, box::children, box::col, box::columns, nscss_select_ctx::ctx, box::href, box::last, box::next, nscss_get_blank_style(), box::parent, box::prev, nscss_select_ctx::quirks, html_content::quirks, root, nscss_select_ctx::root_style, span_info::row_span, box::rows, html_content::select_ctx, box::start_column, box::style, box::target, box::type, html_content::unit_len_ctx, nscss_select_ctx::universal, and html_content::universal.
Referenced by box_normalise_table().
|
static |
Compute the column index at which the current cell begins.
Additionally, update the column record to reflect row spanning.
col_info | Column record |
col_span | Number of columns that current cell spans |
row_span | Number of rows that current cell spans |
start_column | Pointer to location to receive column index |
cell | Box for current table cell |
Definition at line 83 of file box_normalise.c.
References span_info::auto_row, columns::current_column, columns::num_columns, box::parent, span_info::rg, span_info::row_span, columns::spans, and box::start_column.
Referenced by box_normalise_table_row().