NetSurf
|
#include <assert.h>
#include <string.h>
#include <strings.h>
#include "utils/nsoption.h"
#include "utils/corestrings.h"
#include "utils/log.h"
#include "utils/nsurl.h"
#include "netsurf/plot_style.h"
#include "netsurf/url_db.h"
#include "desktop/system_colour.h"
#include "css/internal.h"
#include "css/hints.h"
#include "css/select.h"
Go to the source code of this file.
Functions | |
static css_error | node_name (void *pw, void *node, css_qname *qname) |
Callback to retrieve a node's name. More... | |
static css_error | node_classes (void *pw, void *node, lwc_string ***classes, uint32_t *n_classes) |
Callback to retrieve a node's classes. More... | |
static css_error | node_id (void *pw, void *node, lwc_string **id) |
Callback to retrieve a node's ID. More... | |
static css_error | named_parent_node (void *pw, void *node, const css_qname *qname, void **parent) |
Callback to find a named parent node. More... | |
static css_error | named_sibling_node (void *pw, void *node, const css_qname *qname, void **sibling) |
Callback to find a named sibling node. More... | |
static css_error | named_generic_sibling_node (void *pw, void *node, const css_qname *qname, void **sibling) |
Callback to find a named generic sibling node. More... | |
static css_error | parent_node (void *pw, void *node, void **parent) |
Callback to retrieve the parent of a node. More... | |
static css_error | sibling_node (void *pw, void *node, void **sibling) |
Callback to retrieve the preceding sibling of a node. More... | |
static css_error | node_has_name (void *pw, void *node, const css_qname *qname, bool *match) |
Callback to determine if a node has the given name. More... | |
static css_error | node_has_class (void *pw, void *node, lwc_string *name, bool *match) |
Callback to determine if a node has the given class. More... | |
static css_error | node_has_id (void *pw, void *node, lwc_string *name, bool *match) |
Callback to determine if a node has the given id. More... | |
static css_error | node_has_attribute (void *pw, void *node, const css_qname *qname, bool *match) |
Callback to determine if a node has an attribute with the given name. More... | |
static css_error | node_has_attribute_equal (void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match) |
Callback to determine if a node has an attribute with given name and value. More... | |
static css_error | node_has_attribute_dashmatch (void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match) |
Callback to determine if a node has an attribute with the given name whose value dashmatches that given. More... | |
static css_error | node_has_attribute_includes (void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match) |
Callback to determine if a node has an attribute with the given name whose value includes that given. More... | |
static css_error | node_has_attribute_prefix (void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match) |
Callback to determine if a node has an attribute with the given name whose value has the prefix given. More... | |
static css_error | node_has_attribute_suffix (void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match) |
Callback to determine if a node has an attribute with the given name whose value has the suffix given. More... | |
static css_error | node_has_attribute_substring (void *pw, void *node, const css_qname *qname, lwc_string *value, bool *match) |
Callback to determine if a node has an attribute with the given name whose value contains the substring given. More... | |
static css_error | node_is_root (void *pw, void *node, bool *match) |
Callback to determine if a node is the root node of the document. More... | |
static css_error | node_count_siblings (void *pw, void *n, bool same_name, bool after, int32_t *count) |
Callback to count a node's siblings. More... | |
static css_error | node_is_empty (void *pw, void *node, bool *match) |
Callback to determine if a node is empty. More... | |
static css_error | node_is_link (void *pw, void *n, bool *match) |
Callback to determine if a node is a linking element. More... | |
static css_error | node_is_hover (void *pw, void *node, bool *match) |
Callback to determine if a node is currently being hovered over. More... | |
static css_error | node_is_active (void *pw, void *node, bool *match) |
Callback to determine if a node is currently activated. More... | |
static css_error | node_is_focus (void *pw, void *node, bool *match) |
Callback to determine if a node has the input focus. More... | |
static css_error | node_is_enabled (void *pw, void *node, bool *match) |
Callback to determine if a node is enabled. More... | |
static css_error | node_is_disabled (void *pw, void *node, bool *match) |
Callback to determine if a node is disabled. More... | |
static css_error | node_is_checked (void *pw, void *node, bool *match) |
Callback to determine if a node is checked. More... | |
static css_error | node_is_target (void *pw, void *node, bool *match) |
Callback to determine if a node is the target of the document URL. More... | |
static css_error | node_is_lang (void *pw, void *node, lwc_string *lang, bool *match) |
Callback to determine if a node has the given language. More... | |
static css_error | ua_default_for_property (void *pw, uint32_t property, css_hint *hint) |
Callback to retrieve the User-Agent defaults for a CSS property. More... | |
static css_error | set_libcss_node_data (void *pw, void *node, void *libcss_node_data) |
static css_error | get_libcss_node_data (void *pw, void *node, void **libcss_node_data) |
css_stylesheet * | nscss_create_inline_style (const uint8_t *data, size_t len, const char *charset, const char *url, bool allow_quirks) |
Create an inline style. More... | |
static void | nscss_dom_user_data_handler (dom_node_operation operation, dom_string *key, void *data, struct dom_node *src, struct dom_node *dst) |
css_select_results * | nscss_get_style (nscss_select_ctx *ctx, dom_node *n, const css_media *media, const css_unit_ctx *unit_len_ctx, const css_stylesheet *inline_style) |
Get style selection results for an element. More... | |
css_computed_style * | nscss_get_blank_style (nscss_select_ctx *ctx, const css_unit_ctx *unit_len_ctx, const css_computed_style *parent) |
Get a blank style. More... | |
css_error | named_ancestor_node (void *pw, void *node, const css_qname *qname, void **ancestor) |
Callback to find a named ancestor node. More... | |
static int | node_count_siblings_check (dom_node *node, bool check_name, dom_string *name) |
css_error | node_is_visited (void *pw, void *node, bool *match) |
Callback to determine if a node is a linking element whose target has been visited. More... | |
Variables | |
static css_select_handler | selection_handler |
Selection callback table for libcss. More... | |
|
static |
css_error named_ancestor_node | ( | void * | pw, |
void * | node, | ||
const css_qname * | qname, | ||
void ** | ancestor | ||
) |
Callback to find a named ancestor node.
pw | HTML document |
node | DOM node |
qname | Node name to search for |
ancestor | Pointer to location to receive ancestor |
Definition at line 471 of file select.c.
Referenced by css_hint_anchor_color(), and css_hint_table_cell_border_padding().
|
static |
Callback to find a named generic sibling node.
pw | HTML document |
node | DOM node |
qname | Node name to search for |
sibling | Pointer to location to receive ancestor |
Definition at line 581 of file select.c.
References type.
|
static |
|
static |
Callback to find a named sibling node.
pw | HTML document |
node | DOM node |
qname | Node name to search for |
sibling | Pointer to location to receive sibling |
Definition at line 513 of file select.c.
References type.
|
static |
Callback to retrieve a node's classes.
pw | HTML document |
node | DOM node |
classes | Pointer to location to receive class name array |
n_classes | Pointer to location to receive length of class name array |
|
static |
Callback to count a node's siblings.
pw | HTML document |
n | DOM node |
same_name | Only count siblings with the same name, or all |
after | Count anteceding instead of preceding siblings |
count | Pointer to location to receive result |
Definition at line 1319 of file select.c.
References count(), node_count_siblings_check(), and node_name().
|
static |
Definition at line 1272 of file select.c.
References node_name(), and type.
Referenced by node_count_siblings().
|
static |
Callback to determine if a node has an attribute with the given name.
pw | HTML document |
node | DOM node |
qname | Name to match |
match | Pointer to location to receive result |
|
static |
Callback to determine if a node has an attribute with the given name whose value dashmatches that given.
pw | HTML document |
node | DOM node |
qname | Name to match |
value | Value to match |
match | Pointer to location to receive result |
|
static |
Callback to determine if a node has an attribute with given name and value.
pw | HTML document |
node | DOM node |
qname | Name to match |
value | Value to match |
match | Pointer to location to receive result |
|
static |
Callback to determine if a node has an attribute with the given name whose value includes that given.
pw | HTML document |
node | DOM node |
qname | Name to match |
value | Value to match |
match | Pointer to location to receive result |
|
static |
Callback to determine if a node has an attribute with the given name whose value has the prefix given.
pw | HTML document |
node | DOM node |
qname | Name to match |
value | Value to match |
match | Pointer to location to receive result |
|
static |
Callback to determine if a node has an attribute with the given name whose value contains the substring given.
pw | HTML document |
node | DOM node |
qname | Name to match |
value | Value to match |
match | Pointer to location to receive result |
|
static |
Callback to determine if a node has an attribute with the given name whose value has the suffix given.
pw | HTML document |
node | DOM node |
qname | Name to match |
value | Value to match |
match | Pointer to location to receive result |
|
static |
Callback to determine if a node has the given class.
pw | HTML document |
node | DOM node |
name | Name to match |
match | Pointer to location to receive result |
|
static |
Callback to determine if a node has the given id.
pw | HTML document |
node | DOM node |
name | Name to match |
match | Pointer to location to receive result |
|
static |
Callback to determine if a node has the given name.
pw | HTML document |
node | DOM node |
qname | Name to match |
match | Pointer to location to receive result |
Definition at line 718 of file select.c.
References nscss_select_ctx::universal.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Callback to determine if a node is currently being hovered over.
pw | HTML document |
node | DOM node |
match | Pointer to location to receive result |
|
static |
Callback to determine if a node has the given language.
pw | HTML document |
node | DOM node |
lang | Language specifier to match |
match | Pointer to location to receive result |
|
static |
Callback to determine if a node is a linking element.
pw | HTML document |
n | DOM node |
match | Pointer to location to receive result |
Definition at line 1432 of file select.c.
References node_name().
|
static |
|
static |
Callback to determine if a node is the target of the document URL.
pw | HTML document |
node | DOM node |
match | Pointer to location to receive result |
css_error node_is_visited | ( | void * | pw, |
void * | node, | ||
bool * | match | ||
) |
Callback to determine if a node is a linking element whose target has been visited.
pw | HTML document |
node | DOM node |
match | Pointer to location to receive result |
Definition at line 1471 of file select.c.
References nscss_select_ctx::base_url, NSERROR_OK, nsurl_join(), nsurl_unref(), urldb_get_url_data(), and url_data::visits.
Referenced by css_hint_anchor_color().
|
static |
Callback to retrieve a node's name.
pw | HTML document |
node | DOM node |
qname | Pointer to location to receive node name |
Definition at line 373 of file select.c.
Referenced by dump_dom_element(), html_begin_conversion(), libdom_find_first_element(), node_count_siblings(), node_count_siblings_check(), node_is_link(), save_complete_handle_attr(), save_complete_handle_attr_value(), and save_complete_handle_attrs().
css_stylesheet * nscss_create_inline_style | ( | const uint8_t * | data, |
size_t | len, | ||
const char * | charset, | ||
const char * | url, | ||
bool | allow_quirks | ||
) |
Create an inline style.
data | Source data |
len | Length of data in bytes |
charset | Charset of data, or NULL if unknown |
url | Base URL of document containing data |
allow_quirks | True to permit CSS parsing quirks |
Definition at line 148 of file select.c.
References ns_system_colour(), nscss_resolve_url(), and NSLOG.
Referenced by box_get_style().
|
static |
Definition at line 195 of file select.c.
References NSLOG, and selection_handler.
Referenced by set_libcss_node_data().
css_computed_style * nscss_get_blank_style | ( | nscss_select_ctx * | ctx, |
const css_unit_ctx * | unit_len_ctx, | ||
const css_computed_style * | parent | ||
) |
Get a blank style.
ctx | CSS selection context |
unit_unit_len_ctx | Unit length conversion context |
parent | Parent style to cascade inherited properties from |
Definition at line 334 of file select.c.
References nscss_select_ctx::ctx, parent, and selection_handler.
Referenced by box_normalise_block(), box_normalise_flex(), box_normalise_table(), box_normalise_table_row(), box_normalise_table_row_group(), and box_normalise_table_spans().
css_select_results * nscss_get_style | ( | nscss_select_ctx * | ctx, |
dom_node * | n, | ||
const css_media * | media, | ||
const css_unit_ctx * | unit_len_ctx, | ||
const css_stylesheet * | inline_style | ||
) |
Get style selection results for an element.
ctx | CSS selection context |
n | Element to select for |
media | Permitted media types |
unit_unit_len_ctx | Unit length conversion context |
inline_style | Inline style associated with element, or NULL |
Definition at line 253 of file select.c.
References nscss_select_ctx::ctx, nscss_select_ctx::parent_style, and selection_handler.
Referenced by box_get_style().
|
static |
Callback to retrieve the parent of a node.
pw | HTML document |
node | DOM node |
parent | Pointer to location to receive parent |
Definition at line 644 of file select.c.
References parent.
Referenced by box_extract_properties().
|
static |
Definition at line 1732 of file select.c.
References nscss_dom_user_data_handler().
|
static |
Callback to retrieve the preceding sibling of a node.
pw | HTML document |
node | DOM node |
sibling | Pointer to location to receive sibling |
Definition at line 662 of file select.c.
References type.
|
static |
Callback to retrieve the User-Agent defaults for a CSS property.
pw | HTML document |
property | Property to retrieve defaults for |
hint | Pointer to hint object to populate |
Definition at line 1693 of file select.c.
References nsoption_int, PLOT_FONT_FAMILY_CURSIVE, PLOT_FONT_FAMILY_FANTASY, PLOT_FONT_FAMILY_MONOSPACE, PLOT_FONT_FAMILY_SANS_SERIF, and PLOT_FONT_FAMILY_SERIF.
|
static |
Selection callback table for libcss.
Definition at line 97 of file select.c.
Referenced by nscss_dom_user_data_handler(), nscss_get_blank_style(), and nscss_get_style().