1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
/*
* This file is part of LibCSS.
* Licensed under the MIT License,
* http://www.opensource.org/licenses/mit-license.php
* Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org>
*/
#ifndef libcss_stylesheet_h_
#define libcss_stylesheet_h_
#ifdef __cplusplus
extern "C"
{
#endif
#include <libcss/errors.h>
#include <libcss/types.h>
/**
* Callback to resolve an URL
*
* \param pw Client data
* \param dict String internment context
* \param base Base URI (absolute)
* \param rel URL to resolve, either absolute or relative to base
* \param abs Pointer to location to receive result
* \return CSS_OK on success, appropriate error otherwise.
*/
typedef css_error (*css_url_resolution_fn)(void *pw,
const char *base, lwc_string *rel, lwc_string **abs);
/**
* Callback to be notified of the need for an imported stylesheet
*
* \param pw Client data
* \param parent Stylesheet requesting the import
* \param url URL of the imported sheet
* \param media Applicable media for the imported sheet
* \return CSS_OK on success, appropriate error otherwise
*
* \note This function will be invoked for notification purposes
* only. The client may use this to trigger a parallel fetch
* of the imported stylesheet. The imported sheet must be
* registered with its parent using the post-parse import
* registration API.
*/
typedef css_error (*css_import_notification_fn)(void *pw,
css_stylesheet *parent, lwc_string *url, uint64_t media);
css_error css_stylesheet_create(css_language_level level,
const char *charset, const char *url, const char *title,
bool allow_quirks, bool inline_style,
css_allocator_fn alloc, void *alloc_pw,
css_url_resolution_fn resolve, void *resolve_pw,
css_import_notification_fn, void *import_pw,
css_stylesheet **stylesheet);
css_error css_stylesheet_destroy(css_stylesheet *sheet);
css_error css_stylesheet_append_data(css_stylesheet *sheet,
const uint8_t *data, size_t len);
css_error css_stylesheet_data_done(css_stylesheet *sheet);
css_error css_stylesheet_next_pending_import(css_stylesheet *parent,
lwc_string **url, uint64_t *media);
css_error css_stylesheet_register_import(css_stylesheet *parent,
css_stylesheet *child);
css_error css_stylesheet_get_language_level(css_stylesheet *sheet,
css_language_level *level);
css_error css_stylesheet_get_url(css_stylesheet *sheet, const char **url);
css_error css_stylesheet_get_title(css_stylesheet *sheet, const char **title);
css_error css_stylesheet_quirks_allowed(css_stylesheet *sheet, bool *allowed);
css_error css_stylesheet_used_quirks(css_stylesheet *sheet, bool *quirks);
css_error css_stylesheet_get_disabled(css_stylesheet *sheet, bool *disabled);
css_error css_stylesheet_set_disabled(css_stylesheet *sheet, bool disabled);
css_error css_stylesheet_size(css_stylesheet *sheet, size_t *size);
#ifdef __cplusplus
}
#endif
#endif
|