ELinks 0.18.0
|
CSS main parser. More...
#include <stdlib.h>
#include <string.h>
#include "elinks.h"
#include "config/options.h"
#include "document/css/css.h"
#include "document/css/parser.h"
#include "document/css/property.h"
#include "document/css/scanner.h"
#include "document/css/stylesheet.h"
#include "document/css/value.h"
#include "util/color.h"
#include "util/lists.h"
#include "util/error.h"
#include "util/memory.h"
#include "util/string.h"
Data Structures | |
struct | selector_pkg |
Functions | |
static void | css_parse_ruleset (struct css_stylesheet *css, struct scanner *scanner) |
Parse a ruleset from scanner to css. | |
void | css_parse_properties (struct css_property list *props, struct scanner *scanner) |
This function takes a semicolon separated list of declarations from the given string, parses them to atoms, and chains the newly created struct css_property objects to the specified list. | |
static void | skip_css_block (struct scanner *scanner) |
static int | css_parse_media_types (struct scanner *scanner) |
static void | css_parse_atrule (struct css_stylesheet *css, struct scanner *scanner, struct uri *base_uri) |
Parse an atrule from scanner and update css accordingly. | |
static struct css_selector * | reparent_selector (struct css_selector_set *sels, struct css_selector *selector, struct css_selector **watch) |
Move a CSS selector and its leaves into a new set. | |
static void | css_parse_selector (struct css_stylesheet *css, struct scanner *scanner, struct selector_pkg list *selectors) |
Parse a comma-separated list of CSS selectors from scanner. | |
void | css_parse_stylesheet (struct css_stylesheet *css, struct uri *base_uri, const char *string, const char *end) |
Parses the string and adds any recognized selectors + properties to the given stylesheet css. | |
CSS main parser.
|
static |
Parse an atrule from scanner and update css accordingly.
Atrules grammar:
* atrule: * '@charset' <string> ';' * | '@import' <string> media_types ';' * | '@import' <uri> media_types ';' * | '@media' media_types '{' ruleset* '}' * | '@page' <ident>? [':' <ident>]? '{' properties '}' * | '@font-face' '{' properties '}' *
|
static |
void css_parse_properties | ( | struct css_property list * | props, |
struct scanner * | scanner ) |
This function takes a semicolon separated list of declarations from the given string, parses them to atoms, and chains the newly created struct css_property objects to the specified list.
|
static |
Parse a ruleset from scanner to css.
Ruleset grammar:
* ruleset: * selector [ ',' selector ]* '{' properties '}' *
|
static |
Parse a comma-separated list of CSS selectors from scanner.
Register the selectors in css so that get_css_selector_for_element() will find them, and add them to selectors so that the caller can attach properties to them.
Our selector grammar:
* selector: * element_name? ('#' id)? ('.' class)? (':' pseudo_class)? \ * ((' ' | '>') selector)? *
void css_parse_stylesheet | ( | struct css_stylesheet * | css, |
struct uri * | base_uri, | ||
const char * | string, | ||
const char * | end ) |
Parses the string and adds any recognized selectors + properties to the given stylesheet css.
If the selector is already in the stylesheet it properties are added to the that selector.
|
static |
Move a CSS selector and its leaves into a new set.
If a similar selector already exists in the set, merge them.
sels | The set to which selector should be moved. Must not be NULL. |
selector | The selector that should be moved. Must not be NULL. If it is already in some set, this function removes it from there. |
watch | This function updates *watch if it merges that selector into another one. watch must not be NULL but *watch may be. |
|
static |