Libcroco
Data Structures | Macros | Functions
cr-cascade.c File Reference
#include <string.h>
#include "cr-cascade.h"

Go to the source code of this file.

Data Structures

struct  _CRCascadePriv
 

Macros

#define PRIVATE(a_this)   ((a_this)->priv)
 

Functions

CRCascadecr_cascade_new (CRStyleSheet *a_author_sheet, CRStyleSheet *a_user_sheet, CRStyleSheet *a_ua_sheet)
 cr_cascade_new: @a_author_sheet: the author origin style sheet. More...
 
CRStyleSheetcr_cascade_get_sheet (CRCascade *a_this, enum CRStyleOrigin a_origin)
 cr_cascade_get_sheet: @a_this: the current instance of CRCascade. More...
 
enum CRStatus cr_cascade_set_sheet (CRCascade *a_this, CRStyleSheet *a_sheet, enum CRStyleOrigin a_origin)
 cr_cascade_set_sheet: @a_this: the current instance of CRCascade. More...
 
void cr_cascade_ref (CRCascade *a_this)
 cr_cascade_ref: @a_this: the current instance of CRCascade More...
 
void cr_cascade_unref (CRCascade *a_this)
 cr_cascade_unref: @a_this: the current instance of CRCascade. More...
 
void cr_cascade_destroy (CRCascade *a_this)
 cr_cascade_destroy: @a_this: the current instance of CRCascade More...
 

Macro Definition Documentation

◆ PRIVATE

#define PRIVATE (   a_this)    ((a_this)->priv)

Definition at line 32 of file cr-cascade.c.

Function Documentation

◆ cr_cascade_destroy()

void cr_cascade_destroy ( CRCascade a_this)

cr_cascade_destroy: @a_this: the current instance of CRCascade

Destructor of CRCascade.

Definition at line 195 of file cr-cascade.c.

References cr_stylesheet_unref(), NB_ORIGINS, and PRIVATE.

Referenced by cr_cascade_unref().

◆ cr_cascade_get_sheet()

CRStyleSheet* cr_cascade_get_sheet ( CRCascade a_this,
enum CRStyleOrigin  a_origin 
)

cr_cascade_get_sheet: @a_this: the current instance of CRCascade.

@a_origin: the origin of the style sheet as defined in the css2 spec in chapter 6.4. Gets a given origin sheet.

Gets a sheet, part of the cascade. Note that the returned stylesheet is refcounted so if the caller wants to manage it's lifecycle, it must use cr_stylesheet_ref()/cr_stylesheet_unref() instead of the cr_stylesheet_destroy() method. Returns the style sheet, or NULL if it does not exist.

Definition at line 114 of file cr-cascade.c.

References NB_ORIGINS, ORIGIN_UA, and PRIVATE.

Referenced by cr_sel_eng_get_matched_properties_from_cascade().

◆ cr_cascade_new()

CRCascade* cr_cascade_new ( CRStyleSheet a_author_sheet,
CRStyleSheet a_user_sheet,
CRStyleSheet a_ua_sheet 
)

cr_cascade_new: @a_author_sheet: the author origin style sheet.

May be NULL. @a_user_sheet: the user origin style sheet. May be NULL. @a_ua_sheet: the user agent origin style sheet. May be NULL.

Constructor of the CRCascade class. Note that all three parameters of this method are ref counted and their refcount is increased. Their refcount will be decreased at the destruction of the instance of CRCascade. So the caller should not call their destructor. The caller should call their ref/unref method instead if it wants

Returns the newly built instance of CRCascade or NULL if an error arose during constrution.

Definition at line 64 of file cr-cascade.c.

References cr_cascade_set_sheet(), cr_utils_trace_info, ORIGIN_AUTHOR, ORIGIN_UA, ORIGIN_USER, and PRIVATE.

Referenced by cr_om_parser_parse_paths_to_cascade().

◆ cr_cascade_ref()

void cr_cascade_ref ( CRCascade a_this)

cr_cascade_ref: @a_this: the current instance of CRCascade

Increases the reference counter of the current instance of CRCascade.

Definition at line 159 of file cr-cascade.c.

References PRIVATE.

◆ cr_cascade_set_sheet()

enum CRStatus cr_cascade_set_sheet ( CRCascade a_this,
CRStyleSheet a_sheet,
enum CRStyleOrigin  a_origin 
)

cr_cascade_set_sheet: @a_this: the current instance of CRCascade.

@a_sheet: the stylesheet to set. @a_origin: the origin of the stylesheet.

Sets a stylesheet in the cascade

Returns CR_OK upon successfull completion, an error code otherwise.

Definition at line 135 of file cr-cascade.c.

References CR_BAD_PARAM_ERROR, CR_OK, cr_stylesheet_ref(), cr_stylesheet_unref(), NB_ORIGINS, _CRStyleSheet::origin, ORIGIN_UA, and PRIVATE.

Referenced by cr_cascade_new().

◆ cr_cascade_unref()

void cr_cascade_unref ( CRCascade a_this)

cr_cascade_unref: @a_this: the current instance of CRCascade.

Decrements the reference counter associated to this instance of CRCascade. If the reference counter reaches zero, the instance is destroyed using cr_cascade_destroy()

Definition at line 177 of file cr-cascade.c.

References cr_cascade_destroy(), and PRIVATE.