libcss
Loading...
Searching...
No Matches
select.h
Go to the documentation of this file.
1/*
2 * This file is part of LibCSS
3 * Licensed under the MIT License,
4 * http://www.opensource.org/licenses/mit-license.php
5 * Copyright 2009 John-Mark Bell <jmb@netsurf-browser.org>
6 */
7
8#ifndef css_select_select_h_
9#define css_select_select_h_
10
11#include <stdbool.h>
12#include <stdint.h>
13
14#include <libcss/select.h>
15
16#include "stylesheet.h"
17
25
26typedef struct prop_state {
27 uint32_t specificity; /* Specificity of property in result */
28 unsigned int set : 1, /* Whether property is set in result */
29 origin : 2, /* Origin of property in result */
30 important : 1; /* Importance of property in result */
31 enum flag_value explicit_default : 3; /* Property is set to inherit */
33
34
54
60
65
69typedef struct css_select_state {
70 void *node; /* Node we're selecting for */
71 const css_media *media; /* Currently active media spec */
72 const css_unit_ctx *unit_ctx; /* Unit conversion context. */
73 css_select_results *results; /* Result set to populate */
74
76 struct revert_data *revert; /* Length: CSS_ORIGIN_AUTHOR */
77
78 css_pseudo_element current_pseudo; /* Current pseudo element */
79 css_computed_style *computed; /* Computed style to populate */
80
81 css_select_handler *handler; /* Handler functions */
82 void *pw; /* Client data for handlers */
83
84 const css_stylesheet *sheet; /* Current sheet being processed */
85
86 css_origin current_origin; /* Origin of current sheet */
87 uint32_t current_specificity; /* Specificity of current rule */
88
89 css_qname element; /* Element we're selecting for */
90 lwc_string *id; /* Node id, if any */
91 lwc_string **classes; /* Node classes, if any */
92 uint32_t n_classes; /* Number of classes */
93
94 reject_item reject_cache[128]; /* Reject cache (filled from end) */
95 reject_item *next_reject; /* Next free slot in reject cache */
96
97 struct css_node_data *node_data; /* Data we'll store on node */
98
101
102static inline void advance_bytecode(css_style *style, uint32_t n_bytes)
103{
104 style->used -= (n_bytes / sizeof(css_code_t));
105 style->bytecode = style->bytecode + (n_bytes / sizeof(css_code_t));
106}
107
108bool css__outranks_existing(uint16_t op, bool important,
109 css_select_state *state, enum flag_value explicit_default);
110
111#endif
112
uint32_t css_bloom
Definition bloom.h:56
flag_value
Definition bytecode.h:23
uint32_t css_code_t
Definition bytecode.h:19
@ CSS_N_PROPERTIES
Definition properties.h:144
css_pseudo_element
Definition select.h:23
@ CSS_PSEUDO_ELEMENT_COUNT
Definition select.h:30
dict style
Definition select_config.py:26
css_node_flags
Definition select.h:35
@ CSS_NODE_FLAGS_HAS_INLINE_STYLE
Definition select.h:38
@ CSS_NODE_FLAGS_PSEUDO_CLASS_HOVER
Definition select.h:41
@ CSS_NODE_FLAGS_HAS_HINTS
Definition select.h:37
@ CSS_NODE_FLAGS_PSEUDO_CLASS_LINK
Definition select.h:42
@ CSS_NODE_FLAGS_NONE
Definition select.h:36
@ CSS_NODE_FLAGS_TAINT_PSEUDO_CLASS
Definition select.h:44
@ CSS_NODE_FLAGS__PSEUDO_CLASSES_MASK
Definition select.h:47
@ CSS_NODE_FLAGS_PSEUDO_CLASS_ACTIVE
Definition select.h:39
@ CSS_NODE_FLAGS_PSEUDO_CLASS_FOCUS
Definition select.h:40
@ CSS_NODE_FLAGS_PSEUDO_CLASS_VISITED
Definition select.h:43
@ CSS_NODE_FLAGS_TAINT_ATTRIBUTE
Definition select.h:45
@ CSS_NODE_FLAGS_TAINT_SIBLING
Definition select.h:46
bool css__outranks_existing(uint16_t op, bool important, css_select_state *state, enum flag_value explicit_default)
Definition select.c:2762
css_selector_type
Definition stylesheet.h:36
Definition autogenerated_computed.h:282
Definition types.h:204
Definition select.h:55
css_node_flags flags
Definition select.h:58
css_select_results partial
Definition select.h:56
css_bloom * bloom
Definition select.h:57
Definition types.h:246
Definition select.h:51
Definition select.h:36
Definition select.h:69
css_qname element
Definition select.h:89
css_select_results * results
Definition select.h:73
lwc_string ** classes
Definition select.h:91
const css_media * media
Definition select.h:71
void * pw
Definition select.h:82
const css_stylesheet * sheet
Definition select.h:84
css_pseudo_element current_pseudo
Definition select.h:78
prop_state props[CSS_N_PROPERTIES][CSS_PSEUDO_ELEMENT_COUNT]
Definition select.h:99
css_computed_style * computed
Definition select.h:79
css_origin current_origin
Definition select.h:86
struct css_node_data * node_data
Definition select.h:97
reject_item * next_reject
Definition select.h:95
uint32_t current_specificity
Definition select.h:87
reject_item reject_cache[128]
Definition select.h:94
struct revert_data * revert
Definition select.h:76
uint32_t n_classes
Definition select.h:92
lwc_string * id
Definition select.h:90
const css_unit_ctx * unit_ctx
Definition select.h:72
css_select_handler * handler
Definition select.h:81
void * node
Definition select.h:70
Definition stylesheet.h:29
Definition stylesheet.h:170
Definition unit.h:39
Definition select.h:26
unsigned int set
Definition select.h:28
enum flag_value explicit_default
Definition select.h:31
unsigned int origin
Definition select.h:29
unsigned int important
Definition select.h:30
uint32_t specificity
Definition select.h:27
Definition select.h:21
lwc_string * value
Definition select.h:22
css_selector_type type
Definition select.h:23
Definition select.h:61
css_computed_style * style[CSS_PSEUDO_ELEMENT_COUNT]
Definition select.h:63
prop_state props[CSS_N_PROPERTIES][CSS_PSEUDO_ELEMENT_COUNT]
Definition select.h:62
css_origin
Definition types.h:72