ELinks 0.18.0
css.c File Reference

CSS module management. More...

#include <stdlib.h>
#include "elinks.h"
#include "cache/cache.h"
#include "config/home.h"
#include "config/options.h"
#include "document/css/css.h"
#include "document/css/parser.h"
#include "document/css/stylesheet.h"
#include "encoding/encoding.h"
#include "intl/libintl.h"
#include "main/module.h"
#include "network/connection.h"
#include "protocol/uri.h"
#include "session/session.h"
#include "util/error.h"
#include "util/memory.h"
#include "viewer/text/draw.h"
Include dependency graph for css.c:

Functions

int supports_css_media_type (const char *optstr, const char *token, size_t token_length)
 Check whether ELinks claims to support a specific CSS media type.
void import_css (struct css_stylesheet *css, struct uri *uri)
 This function will try to import the given url from the cache.
static void import_css_file (struct css_stylesheet *css, struct uri *base_uri, const char *url, int urllen)
static void import_default_css (void)
static int change_hook_css (struct session *ses, struct option *current, struct option *changed)
static void init_css (struct module *module)
void done_css (struct module *module)

Variables

union option_info css_options_info []
struct css_stylesheet default_stylesheet = INIT_CSS_STYLESHEET(default_stylesheet, import_css_file)
struct module css_module

Detailed Description

CSS module management.

Function Documentation

◆ change_hook_css()

int change_hook_css ( struct session * ses,
struct option * current,
struct option * changed )
static
Todo
TODO: We need to update all entries in format cache. –jonas

◆ done_css()

void done_css ( struct module * module)

◆ import_css()

void import_css ( struct css_stylesheet * css,
struct uri * uri )

This function will try to import the given url from the cache.

◆ import_css_file()

void import_css_file ( struct css_stylesheet * css,
struct uri * base_uri,
const char * url,
int urllen )
static

◆ import_default_css()

void import_default_css ( void )
static

◆ init_css()

void init_css ( struct module * module)
static

◆ supports_css_media_type()

int supports_css_media_type ( const char * optstr,
const char * token,
size_t token_length )

Check whether ELinks claims to support a specific CSS media type.

Parameters
optstrNull-terminated value of the document.css.media option.
tokenA name parsed from a CSS file or from an HTML media attribute. Need not be null-terminated.
token_lengthLength of token, in bytes.

Both strings should be in the ASCII charset.

Returns
nonzero if the media type is supported, 0 if not.

Variable Documentation

◆ css_module

struct module css_module
Initial value:
N_("Cascading Style Sheets"),
)
static void init_css(struct module *module)
Definition css.c:226
void done_css(struct module *module)
Definition css.c:238
union option_info css_options_info[]
Definition css.c:29
#define NULL
Definition explodename.c:35
#define N_(msg)
Definition libintl.h:25
#define struct_module(name, options, hooks, submods, data, init, done, getname)
Definition module.h:47

◆ css_options_info

union option_info css_options_info[]

◆ default_stylesheet

struct css_stylesheet default_stylesheet = INIT_CSS_STYLESHEET(default_stylesheet, import_css_file)
Todo
TODO: Basicly we need two default stylesheets. One that ELinks controls (which is defined by the defaults of every property, they could however also be loadable at startup time, e.g. when/if we will have a very generalised renderer it would be possible to bypass the HTML renderer but would simply use an HTML stylesheet like the one in CSS2 Appendix A. "A sample style sheet for HTML 4.0") and one that the user controls. They should be remerged when ever the user reloads the user stylesheet but else they should be pretty static. Together they defines the basic layouting should be done when rendering the document.