libcss
Loading...
Searching...
No Matches
Classes | Typedefs | Enumerations | Functions
select.h File Reference
#include <libcss/errors.h>
#include <libcss/functypes.h>
#include <libcss/hint.h>
#include <libcss/types.h>
#include <libcss/computed.h>
#include <libcss/unit.h>

Go to the source code of this file.

Classes

struct  css_select_results
 
struct  css_select_handler
 
struct  css_select_font_faces_results
 

Typedefs

typedef enum css_pseudo_element css_pseudo_element
 
typedef struct css_select_results css_select_results
 
typedef enum css_select_handler_version css_select_handler_version
 
typedef struct css_select_handler css_select_handler
 
typedef struct css_select_font_faces_results css_select_font_faces_results
 

Enumerations

enum  css_pseudo_element {
  CSS_PSEUDO_ELEMENT_NONE = 0 , CSS_PSEUDO_ELEMENT_FIRST_LINE = 1 , CSS_PSEUDO_ELEMENT_FIRST_LETTER = 2 , CSS_PSEUDO_ELEMENT_BEFORE = 3 ,
  CSS_PSEUDO_ELEMENT_AFTER = 4 , CSS_PSEUDO_ELEMENT_COUNT = 5
}
 
enum  css_select_handler_version { CSS_SELECT_HANDLER_VERSION_1 = 1 }
 
enum  css_node_data_action { CSS_NODE_DELETED , CSS_NODE_MODIFIED , CSS_NODE_ANCESTORS_MODIFIED , CSS_NODE_CLONED }
 

Functions

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)
 
css_error css_select_ctx_create (css_select_ctx **result)
 
css_error css_select_ctx_destroy (css_select_ctx *ctx)
 
css_error css_select_ctx_append_sheet (css_select_ctx *ctx, const css_stylesheet *sheet, css_origin origin, const char *media)
 
css_error css_select_ctx_insert_sheet (css_select_ctx *ctx, const css_stylesheet *sheet, uint32_t index, css_origin origin, const char *media)
 
css_error css_select_ctx_remove_sheet (css_select_ctx *ctx, const css_stylesheet *sheet)
 
css_error css_select_ctx_count_sheets (css_select_ctx *ctx, uint32_t *count)
 
css_error css_select_ctx_get_sheet (css_select_ctx *ctx, uint32_t index, const css_stylesheet **sheet)
 
css_error css_select_default_style (css_select_ctx *ctx, css_select_handler *handler, void *pw, css_computed_style **style)
 
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)
 
css_error css_select_results_destroy (css_select_results *results)
 
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)
 
css_error css_select_font_faces_results_destroy (css_select_font_faces_results *results)
 

Typedef Documentation

◆ css_pseudo_element

◆ css_select_font_faces_results

Font face selection result set

◆ css_select_handler

◆ css_select_handler_version

◆ css_select_results

Style selection result set

Enumeration Type Documentation

◆ css_node_data_action

Enumerator
CSS_NODE_DELETED 
CSS_NODE_MODIFIED 
CSS_NODE_ANCESTORS_MODIFIED 
CSS_NODE_CLONED 

◆ css_pseudo_element

Enumerator
CSS_PSEUDO_ELEMENT_NONE 
CSS_PSEUDO_ELEMENT_FIRST_LINE 
CSS_PSEUDO_ELEMENT_FIRST_LETTER 
CSS_PSEUDO_ELEMENT_BEFORE 
CSS_PSEUDO_ELEMENT_AFTER 
CSS_PSEUDO_ELEMENT_COUNT 

Number of pseudo elements

◆ css_select_handler_version

Enumerator
CSS_SELECT_HANDLER_VERSION_1 

Function Documentation

◆ css_libcss_node_data_handler()

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.

Parameters
handlerSelection handler vtable
actionType of node action.
pwClient data
nodeDOM node to get data from
clone_nodeClone node, or NULL
libcss_node_dataNode data (non-NULL)
Returns
CSS_OK on success, or appropriate error otherwise

◆ css_select_ctx_append_sheet()

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

Parameters
ctxThe context to append to
sheetThe sheet to append
originOrigin of the sheet
mediaMedia string for the stylesheet
Returns
CSS_OK on success, appropriate error otherwise

◆ css_select_ctx_count_sheets()

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

Parameters
ctxContext to consider
countPointer to location to receive count of sheets
Returns
CSS_OK on success, appropriate error otherwise

◆ css_select_ctx_create()

css_error css_select_ctx_create ( css_select_ctx **  result)

Create a selection context

Parameters
resultPointer to location to receive created context
Returns
CSS_OK on success, appropriate error otherwise.

◆ css_select_ctx_destroy()

css_error css_select_ctx_destroy ( css_select_ctx ctx)

Destroy a selection context

Parameters
ctxThe context to destroy
Returns
CSS_OK on success, appropriate error otherwise

◆ css_select_ctx_get_sheet()

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

Parameters
ctxContext to look in
indexIndex in context to look
sheetPointer to location to receive sheet
Returns
CSS_OK on success, appropriate error otherwise

◆ css_select_ctx_insert_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

Parameters
ctxThe context to insert into
sheetSheet to insert
indexIndex in context to insert sheet
originOrigin of the sheet
mediaMedia string for the stylesheet
Returns
CSS_OK on success, appropriate error otherwise

◆ css_select_ctx_remove_sheet()

css_error css_select_ctx_remove_sheet ( css_select_ctx ctx,
const css_stylesheet sheet 
)

Remove a sheet from a selection context

Parameters
ctxThe context to remove from
sheetSheet to remove
Returns
CSS_OK on success, appropriate error otherwise

◆ css_select_default_style()

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

Parameters
ctxSelection context (used to avoid recreating default)
handlerDispatch table of handler functions
pwClient-specific private data for handler functions
stylePointer to location to receive default style
Returns
CSS_OK on success, appropriate error otherwise.

◆ css_select_font_faces()

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

Parameters
ctxSelection context
mediaCurrently active media spec
unit_ctxCurrent unit conversion context.
font_familyFont family to search for
resultPointer to location to receive result
Returns
CSS_OK on success, appropriate error otherwise.

◆ css_select_font_faces_results_destroy()

css_error css_select_font_faces_results_destroy ( css_select_font_faces_results results)

Destroy a font-face result set

Parameters
resultsResult set to destroy
Returns
CSS_OK on success, appropriate error otherwise

◆ css_select_results_destroy()

css_error css_select_results_destroy ( css_select_results results)

Destroy a selection result set

Parameters
resultsResult set to destroy
Returns
CSS_OK on success, appropriate error otherwise

◆ css_select_style()

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

Parameters
ctxSelection context to use
nodeNode to select style for
unit_ctxContext for length unit conversions.
mediaCurrently active media specification
inline_styleCorresponding inline style for node, or NULL
handlerDispatch table of handler functions
pwClient-specific private data for handler functions
resultPointer to location to receive result set
Returns
CSS_OK on success, appropriate error otherwise.

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.