ELinks 0.18.0
|
#include "elinks.h"
#include <stdio.h>
#include <dom/dom.h>
#include <dom/bindings/hubbub/parser.h>
#include <libcss/libcss.h>
#include "cache/cache.h"
#include "document/html/internal.h"
#include "document/libdom/css.h"
#include "document/libdom/mapa.h"
#include "document/libdom/corestrings.h"
#include "util/string.h"
Macros | |
#define | UNUSED(a) |
Functions | |
static css_error | node_name (void *pw, void *node, css_qname *qname) |
Callback to retrieve a node's name. | |
static css_error | node_classes (void *pw, void *node, lwc_string ***classes, uint32_t *n_classes) |
Callback to retrieve a node's classes. | |
static css_error | node_id (void *pw, void *node, lwc_string **id) |
Callback to retrieve a node's ID. | |
static css_error | named_parent_node (void *pw, void *node, const css_qname *qname, void **parent) |
Callback to find a named parent node. | |
static css_error | named_sibling_node (void *pw, void *node, const css_qname *qname, void **sibling) |
Callback to find a named sibling node. | |
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. | |
static css_error | parent_node (void *pw, void *node, void **parent) |
Callback to retrieve the parent of a node. | |
static css_error | sibling_node (void *pw, void *node, void **sibling) |
Callback to retrieve the preceding sibling of a node. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
static css_error | node_is_empty (void *pw, void *node, bool *match) |
Callback to determine if a node is empty. | |
static css_error | node_is_link (void *pw, void *n, bool *match) |
Callback to determine if a node is a linking element. | |
static css_error | node_is_hover (void *pw, void *node, bool *match) |
Callback to determine if a node is currently being hovered over. | |
static css_error | node_is_active (void *pw, void *node, bool *match) |
Callback to determine if a node is currently activated. | |
static css_error | node_is_focus (void *pw, void *node, bool *match) |
Callback to determine if a node has the input focus. | |
static css_error | node_is_enabled (void *pw, void *node, bool *match) |
Callback to determine if a node is enabled. | |
static css_error | node_is_disabled (void *pw, void *node, bool *match) |
Callback to determine if a node is disabled. | |
static css_error | node_is_checked (void *pw, void *node, bool *match) |
Callback to determine if a node is checked. | |
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. | |
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. | |
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. | |
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) |
static css_error | named_ancestor_node (void *pw, void *node, const css_qname *qname, void **ancestor) |
Callback to find a named ancestor node. | |
static 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. | |
static css_error | node_presentational_hint (void *pw, void *node, uint32_t *nhints, css_hint **hints) |
static css_error | resolve_url_empty (void *pw, const char *base, lwc_string *rel, lwc_string **abs) |
css_error | resolve_url (void *pw, const char *base, lwc_string *rel, lwc_string **abs) |
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. | |
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. | |
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. | |
static int | node_count_siblings_check (dom_node *node, bool check_name, dom_string *name) |
static void | apply_color (struct html_context *html_context, struct html_element *html_element, css_color color_shade) |
static void | apply_background_color (struct html_context *html_context, struct html_element *html_element, css_color color_shade) |
static void | apply_font_attribute (struct html_context *html_context, struct html_element *element, bool underline, bool bold, bool strike) |
static void | apply_list_style (struct html_context *html_context, struct html_element *element, uint8_t list_type) |
static void | apply_display (struct html_context *html_context, struct html_element *element, uint8_t display) |
static void | apply_text_align (struct html_context *html_context, struct html_element *element, uint8_t text_align) |
static void | apply_font_style (struct html_context *html_context, struct html_element *element, uint8_t font_style) |
static bool | is_bold (int val) |
void | select_css (struct html_context *html_context, struct html_element *html_element) |
static css_error | handle_import (void *pw, css_stylesheet *parent, lwc_string *url) |
static void | parse_css_common (struct html_context *html_context, const char *text, int length, struct uri *uri) |
void | parse_css (struct html_context *html_context, char *name) |
void | import_css2 (struct html_context *html_context, struct uri *uri) |
void * | el_match_selector (const char *selector, void *node) |
Variables | |
static css_select_handler | selection_handler |
Selection callback table for libcss. | |
#define UNUSED | ( | a | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
void * el_match_selector | ( | const char * | selector, |
void * | node ) |
f_size = FDIV(FMUL(F_96, FDIV(INTTOFIX(nsoption_int(font_size)), F_10)), F_72); f_min = FDIV(FMUL(F_96, FDIV(INTTOFIX(nsoption_int(font_min_size)), F_10)), F_72);
|
static |
|
static |
void import_css2 | ( | struct html_context * | html_context, |
struct uri * | uri ) |
|
static |
|
static |
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 |
|
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 |
|
static |
Callback to find a named parent node.
pw | HTML document |
node | DOM node |
qname | Node name to search for |
parent | Pointer to location to receive parent |
|
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 |
|
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 |
|
static |
|
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 |
|
static |
Callback to retrieve a node's ID.
pw | HTML document |
node | DOM node |
id | Pointer to location to receive id value |
|
static |
Callback to determine if a node is currently activated.
pw | HTML document |
node | DOM node |
match | Pointer to location to receive result |
|
static |
Callback to determine if a node is checked.
pw | HTML document |
node | DOM node |
match | Pointer to location to receive result |
|
static |
Callback to determine if a node is disabled.
pw | HTML document |
node | DOM node |
match | Pointer to location to receive result |
|
static |
Callback to determine if a node is empty.
pw | HTML document |
node | DOM node |
match | Pointer to location to receive result |
|
static |
Callback to determine if a node is enabled.
pw | HTML document |
node | DOM node |
match | Pointer to location to receive result |
|
static |
Callback to determine if a node has the input focus.
pw | HTML document |
node | DOM node |
match | Pointer to location to receive result |
|
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 |
|
static |
Callback to determine if a node is the root node of the document.
pw | HTML document |
node | DOM node |
match | Pointer to location to receive result |
|
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 |
|
static |
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 |
|
static |
Callback to retrieve a node's name.
pw | HTML document |
node | DOM node |
qname | Pointer to location to receive node name |
|
static |
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 |
|
static |
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 |
parent | Parent style to cascade inherited properties from |
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 |
inline_style | Inline style associated with element, or NULL |
|
static |
Callback to retrieve the parent of a node.
pw | HTML document |
node | DOM node |
parent | Pointer to location to receive parent |
void parse_css | ( | struct html_context * | html_context, |
char * | name ) |
|
static |
css_error resolve_url | ( | void * | pw, |
const char * | base, | ||
lwc_string * | rel, | ||
lwc_string ** | abs ) |
|
static |
void select_css | ( | struct html_context * | html_context, |
struct html_element * | html_element ) |
f_size = FDIV(FMUL(F_96, FDIV(INTTOFIX(nsoption_int(font_size)), F_10)), F_72); f_min = FDIV(FMUL(F_96, FDIV(INTTOFIX(nsoption_int(font_min_size)), F_10)), F_72);
ctx.root_style = root_style; ctx.parent_style = parent_style;
|
static |
|
static |
Callback to retrieve the preceding sibling of a node.
pw | HTML document |
node | DOM node |
sibling | Pointer to location to receive sibling |
|
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 |
|
static |
Selection callback table for libcss.