ELinks 0.18.0
stylesheet.c File Reference

CSS stylesheet handling. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "elinks.h"
#include "document/css/property.h"
#include "document/css/stylesheet.h"
#include "util/error.h"
#include "util/lists.h"
#include "util/memory.h"
#include "util/string.h"
Include dependency graph for stylesheet.c:

Functions

struct css_selectorfind_css_selector (struct css_selector_set *sels, css_selector_type_T type, enum css_selector_relation rel, const char *name, int namelen)
 Looks up the selector of the name name and length namelen in the given set of selectors.
struct css_selectorinit_css_selector (struct css_selector_set *sels, css_selector_type_T type, enum css_selector_relation relation, const char *name, int namelen)
 Initialize the selector structure.
void set_css_selector_relation (struct css_selector *selector, enum css_selector_relation relation)
 Use this function instead of modifying css_selector.relation directly.
struct css_selectorget_css_selector (struct css_selector_set *sels, css_selector_type_T type, enum css_selector_relation rel, const char *name, int namelen)
 Returns a new freshly made selector adding it to the given selector set, or NULL.
static struct css_selectorcopy_css_selector (struct css_stylesheet *css, struct css_selector *orig)
static void add_selector_property (struct css_selector *selector, struct css_property *prop)
void add_selector_properties (struct css_selector *selector, struct css_property list *properties)
 Add all properties from the list to the given selector.
static struct css_selectorclone_css_selector (struct css_stylesheet *css, struct css_selector *orig)
void merge_css_selectors (struct css_selector *sel1, struct css_selector *sel2)
 Join sel2 to sel1, sel1 taking precedence in all conflicts.
void done_css_selector (struct css_selector *selector)
 Destroy a selector.
void init_css_selector_set (struct css_selector_set *set)
void done_css_selector_set (struct css_selector_set *set)
void add_css_selector_to_set (struct css_selector *selector, struct css_selector_set *set)
void del_css_selector_from_set (struct css_selector *selector)
void mirror_css_stylesheet (struct css_stylesheet *css1, struct css_stylesheet *css2)
 Mirror given CSS stylesheet css1 to an identical copy of itself (including all the selectors), css2.
void done_css_stylesheet (struct css_stylesheet *css)
 Releases all the content of the stylesheet (but not the stylesheet itself).

Detailed Description

CSS stylesheet handling.

Function Documentation

◆ add_css_selector_to_set()

void add_css_selector_to_set ( struct css_selector * selector,
struct css_selector_set * set )

◆ add_selector_properties()

void add_selector_properties ( struct css_selector * selector,
struct css_property list * properties )

Add all properties from the list to the given selector.

◆ add_selector_property()

void add_selector_property ( struct css_selector * selector,
struct css_property * prop )
static

◆ clone_css_selector()

struct css_selector * clone_css_selector ( struct css_stylesheet * css,
struct css_selector * orig )
static

◆ copy_css_selector()

struct css_selector * copy_css_selector ( struct css_stylesheet * css,
struct css_selector * orig )
static

◆ del_css_selector_from_set()

void del_css_selector_from_set ( struct css_selector * selector)

◆ done_css_selector()

void done_css_selector ( struct css_selector * selector)

Destroy a selector.

done_css_stylesheet() normally does that for you.

◆ done_css_selector_set()

void done_css_selector_set ( struct css_selector_set * set)

◆ done_css_stylesheet()

void done_css_stylesheet ( struct css_stylesheet * css)

Releases all the content of the stylesheet (but not the stylesheet itself).

◆ find_css_selector()

struct css_selector * find_css_selector ( struct css_selector_set * sels,
css_selector_type_T type,
enum css_selector_relation rel,
const char * name,
int namelen )

Looks up the selector of the name name and length namelen in the given set of selectors.

◆ get_css_selector()

struct css_selector * get_css_selector ( struct css_selector_set * sels,
css_selector_type_T type,
enum css_selector_relation rel,
const char * name,
int namelen )

Returns a new freshly made selector adding it to the given selector set, or NULL.

◆ init_css_selector()

struct css_selector * init_css_selector ( struct css_selector_set * set,
css_selector_type_T type,
enum css_selector_relation relation,
const char * name,
int namelen )

Initialize the selector structure.

This is a rather low-level function from your POV.

◆ init_css_selector_set()

void init_css_selector_set ( struct css_selector_set * set)

◆ merge_css_selectors()

void merge_css_selectors ( struct css_selector * sel1,
struct css_selector * sel2 )

Join sel2 to sel1, sel1 taking precedence in all conflicts.

◆ mirror_css_stylesheet()

void mirror_css_stylesheet ( struct css_stylesheet * css1,
struct css_stylesheet * css2 )

Mirror given CSS stylesheet css1 to an identical copy of itself (including all the selectors), css2.

◆ set_css_selector_relation()

void set_css_selector_relation ( struct css_selector * selector,
enum css_selector_relation relation )

Use this function instead of modifying css_selector.relation directly.