NetSurf
|
HTML Box tree construction interface. More...
Go to the source code of this file.
Functions | |
nserror | dom_to_box (struct dom_node *n, struct html_content *c, box_construct_complete_cb cb, void **box_conversion_context) |
Construct a box tree from a dom and html content. More... | |
nserror | cancel_dom_to_box (void *box_conversion_context) |
aborts any ongoing box construction More... | |
struct box * | box_for_node (struct dom_node *node) |
Retrieve the box for a dom node, if there is one. More... | |
bool | box_extract_link (const struct html_content *content, const struct dom_string *dsrel, struct nsurl *base, struct nsurl **result) |
Extract a URL from a relative link, handling junk like whitespace and attempting to read a real URL from "javascript:" links. More... | |
HTML Box tree construction interface.
This stage of rendering converts a tree of dom_nodes (produced by libdom) to a tree of struct box. The box tree represents the structure of the document as given by the CSS display and float properties.
For example, consider the following HTML:
This would produce approximately the following box tree with default CSS rules:
Note that the em has been collapsed into the INLINE_CONTAINER.
If these CSS rules were applied:
then the box tree would instead look like this:
Here implied boxes have been added and a float is present.
Definition in file box_construct.h.
bool box_extract_link | ( | const struct html_content * | content, |
const struct dom_string * | dsrel, | ||
struct nsurl * | base, | ||
struct nsurl ** | result | ||
) |
Extract a URL from a relative link, handling junk like whitespace and attempting to read a real URL from "javascript:" links.
content | html content |
dsrel | relative URL text taken from page |
base | base for relative URLs |
result | updated to target URL on heap, unchanged if extract failed |
struct box * box_for_node | ( | struct dom_node * | node | ) |
Retrieve the box for a dom node, if there is one.
node | The DOM node |
Definition at line 1373 of file box_construct.c.
Referenced by box_construct_element_after(), box_extract_properties(), html_texty_element_update(), and next_node().
nserror cancel_dom_to_box | ( | void * | box_conversion_context | ) |
aborts any ongoing box construction
Definition at line 1355 of file box_construct.c.
References convert_xml_to_box(), guit, netsurf_table::misc, box_construct_ctx::n, NSERROR_OK, and gui_misc_table::schedule.
Referenced by html_destroy().
nserror dom_to_box | ( | struct dom_node * | n, |
struct html_content * | c, | ||
box_construct_complete_cb | cb, | ||
void ** | box_conversion_context | ||
) |
Construct a box tree from a dom and html content.
n | dom document |
c | content of type CONTENT_HTML to construct box tree in |
cb | callback to report conversion completion |
box_conversion_context | pointer that recives the conversion context |
Definition at line 1320 of file box_construct.c.
References box_construct_ctx::bctx, html_content::bctx, box_construct_ctx::cb, box_construct_ctx::content, convert_xml_to_box(), guit, netsurf_table::misc, box_construct_ctx::n, NSERROR_NOMEM, box_construct_ctx::root_box, gui_misc_table::schedule, and talloc_zero.
Referenced by html_finish_conversion().