|
libcss
|
#include <assert.h>#include <string.h>#include <libwapcaplet/libwapcaplet.h>#include <libcss/select.h>#include "bytecode/bytecode.h"#include "bytecode/opcodes.h"#include "stylesheet.h"#include "select/arena.h"#include "select/calc.h"#include "select/computed.h"#include "select/dispatch.h"#include "select/hash.h"#include "select/mq.h"#include "select/propset.h"#include "select/font_face.h"#include "select/select.h"#include "select/strings.h"#include "select/unit.h"#include "utils/parserutilserror.h"#include "utils/utils.h"Classes | |
| struct | css_select_sheet |
| struct | css_select_ctx |
| struct | css_select_font_faces_list |
| struct | css_select_font_faces_state |
| struct | css_select_rule_source |
Macros | |
| #define | IMPORT_STACK_SIZE 256 |
Typedefs | |
| typedef struct css_select_sheet | css_select_sheet |
| typedef struct css_select_font_faces_list | css_select_font_faces_list |
| typedef struct css_select_font_faces_state | css_select_font_faces_state |
| typedef struct css_select_rule_source | css_select_rule_source |
Enumerations | |
| enum | share_candidate_type { CANDIDATE_SIBLING , CANDIDATE_COUSIN } |
| #define IMPORT_STACK_SIZE 256 |
| typedef struct css_select_font_faces_list css_select_font_faces_list |
Container for selected font faces
| typedef struct css_select_font_faces_state css_select_font_faces_state |
Font face selection state
| typedef struct css_select_rule_source css_select_rule_source |
CSS rule source
| typedef struct css_select_sheet css_select_sheet |
Container for stylesheet selection info
| enum share_candidate_type |
| bool css__outranks_existing | ( | uint16_t | op, |
| bool | important, | ||
| css_select_state * | state, | ||
| enum flag_value | explicit_default | ||
| ) |
| css_error css_libcss_node_data_handler | ( | css_select_handler * | handler, |
| css_node_data_action | action, | ||
| void * | pw, | ||
| void * | node, | ||
| void * | clone_node, | ||
| void * | libcss_node_data | ||
| ) |
Handle libcss_node_data on DOM changes/deletion.
When a DOM node is deleted, if it has libcss_node_data, call with action CSS_NODE_DELETED, to ensure the libcss_node_data is not leaked. Does not call handler->set_libcss_node_data.
When a DOM node is modified, if the node has libcss_node_data, call with CSS_NODE_MODIFIED. This will result in a call to handler->set_libcss_node_data for the node.
When a DOM node's ancestors are modified, if the node has libcss_node_data, call with CSS_NODE_ANCESTORS_MODIFIED. This will result in a call to handler->set_libcss_node_data for the node.
When a DOM node with libcss_node_data is cloned, and its ancestors are also clones, call with CSS_NODE_CLONED. This will result in a call to handler->set_libcss_node_data for the clone node.
| handler | Selection handler vtable |
| action | Type of node action. |
| pw | Client data |
| node | DOM node to get data from |
| clone_node | Clone node, or NULL |
| libcss_node_data | Node data (non-NULL) |
| css_error css_select_ctx_append_sheet | ( | css_select_ctx * | ctx, |
| const css_stylesheet * | sheet, | ||
| css_origin | origin, | ||
| const char * | media | ||
| ) |
Append a stylesheet to a selection context
| ctx | The context to append to |
| sheet | The sheet to append |
| origin | Origin of the sheet |
| media | Media string for the stylesheet |
| css_error css_select_ctx_count_sheets | ( | css_select_ctx * | ctx, |
| uint32_t * | count | ||
| ) |
Count the number of top-level sheets in a selection context
| ctx | Context to consider |
| count | Pointer to location to receive count of sheets |
| css_error css_select_ctx_create | ( | css_select_ctx ** | result | ) |
Create a selection context
| result | Pointer to location to receive created context |
| css_error css_select_ctx_destroy | ( | css_select_ctx * | ctx | ) |
Destroy a selection context
| ctx | The context to destroy |
| css_error css_select_ctx_get_sheet | ( | css_select_ctx * | ctx, |
| uint32_t | index, | ||
| const css_stylesheet ** | sheet | ||
| ) |
Retrieve a sheet from a selection context
| ctx | Context to look in |
| index | Index in context to look |
| sheet | Pointer to location to receive sheet |
| css_error css_select_ctx_insert_sheet | ( | css_select_ctx * | ctx, |
| const css_stylesheet * | sheet, | ||
| uint32_t | index, | ||
| css_origin | origin, | ||
| const char * | media | ||
| ) |
Insert a stylesheet into a selection context
| ctx | The context to insert into |
| sheet | Sheet to insert |
| index | Index in context to insert sheet |
| origin | Origin of the sheet |
| media | Media string for the stylesheet |
| css_error css_select_ctx_remove_sheet | ( | css_select_ctx * | ctx, |
| const css_stylesheet * | sheet | ||
| ) |
Remove a sheet from a selection context
| ctx | The context to remove from |
| sheet | Sheet to remove |
| css_error css_select_default_style | ( | css_select_ctx * | ctx, |
| css_select_handler * | handler, | ||
| void * | pw, | ||
| css_computed_style ** | style | ||
| ) |
Get a default style, e.g. for an implied element's anonymous box
| ctx | Selection context (used to avoid recreating default) |
| handler | Dispatch table of handler functions |
| pw | Client-specific private data for handler functions |
| style | Pointer to location to receive default style |
| css_error css_select_font_faces | ( | css_select_ctx * | ctx, |
| const css_media * | media, | ||
| const css_unit_ctx * | unit_ctx, | ||
| lwc_string * | font_family, | ||
| css_select_font_faces_results ** | result | ||
| ) |
Search a selection context for defined font faces
| ctx | Selection context |
| media | Currently active media spec |
| unit_ctx | Current unit conversion context. |
| font_family | Font family to search for |
| result | Pointer to location to receive result |
| css_error css_select_font_faces_results_destroy | ( | css_select_font_faces_results * | results | ) |
Destroy a font-face result set
| results | Result set to destroy |
| css_error css_select_results_destroy | ( | css_select_results * | results | ) |
Destroy a selection result set
| results | Result set to destroy |
| css_error css_select_style | ( | css_select_ctx * | ctx, |
| void * | node, | ||
| const css_unit_ctx * | unit_ctx, | ||
| const css_media * | media, | ||
| const css_stylesheet * | inline_style, | ||
| css_select_handler * | handler, | ||
| void * | pw, | ||
| css_select_results ** | result | ||
| ) |
Select a style for the given node
| ctx | Selection context to use |
| node | Node to select style for |
| unit_ctx | Context for length unit conversions. |
| media | Currently active media specification |
| inline_style | Corresponding inline style for node, or NULL |
| handler | Dispatch table of handler functions |
| pw | Client-specific private data for handler functions |
| result | Pointer to location to receive result set |
In computing the style, no reference is made to the parent node's style. Therefore, the resultant computed style is not ready for immediate use, as some properties may be marked as inherited. Use css_computed_style_compose() to obtain a fully computed style.
This two-step approach to style computation is designed to allow the client to store the partially computed style and efficiently update the fully computed style for a node when layout changes.