1
0
Fork 0

[html] struct document * instead of struct document_options * in init_html_parser

I want have access to document in renderer and parser functions.
This commit is contained in:
Witold Filipczyk 2023-02-15 18:56:15 +01:00
parent 5fa2a3371c
commit 967e5d5f09
4 changed files with 8 additions and 3 deletions

View File

@ -10,6 +10,7 @@
extern "C" {
#endif
struct document;
struct document_options;
struct uri;
@ -43,6 +44,7 @@ enum html_whitespace_state {
struct html_context {
#ifdef CONFIG_CSS
#ifdef CONFIG_LIBCSS
struct document *document;
#else
/* The default stylesheet is initially merged into it. When parsing CSS
* from <style>-tags and external stylesheets if enabled is merged

View File

@ -758,7 +758,7 @@ done_html_parser_state(struct html_context *html_context,
* The title of the document. This is in the document charset,
* and entities have not been decoded. */
struct html_context *
init_html_parser(struct uri *uri, struct document_options *options,
init_html_parser(struct uri *uri, struct document *document,
char *start, char *end,
struct string *head, struct string *title,
void (*put_chars)(struct html_context *, const char *, int),
@ -767,6 +767,7 @@ init_html_parser(struct uri *uri, struct document_options *options,
{
struct html_context *html_context;
struct html_element *e;
struct document_options *options = &document->options;
assert(uri && options);
if_assert_failed return NULL;
@ -776,6 +777,7 @@ init_html_parser(struct uri *uri, struct document_options *options,
#ifdef CONFIG_CSS
#ifdef CONFIG_LIBCSS
html_context->document = document;
#else
html_context->css_styles.import = import_css_stylesheet;
init_css_selector_set(&html_context->css_styles.selectors);

View File

@ -14,6 +14,7 @@
extern "C" {
#endif
struct document;
struct document_options;
struct el_form_control;
struct frameset_desc;
@ -181,7 +182,7 @@ struct html_element {
/* Interface for the renderer */
struct html_context *
init_html_parser(struct uri *uri, struct document_options *options,
init_html_parser(struct uri *uri, struct document *document,
char *start, char *end,
struct string *head, struct string *title,
void (*put_chars)(struct html_context *, const char *, int),

View File

@ -2597,7 +2597,7 @@ render_html_document(struct cache_entry *cached, struct document *document,
start = buffer->source;
end = buffer->source + buffer->length;
html_context = init_html_parser(cached->uri, &document->options,
html_context = init_html_parser(cached->uri, document,
start, end, &head, &title,
put_chars_conv, line_break,
html_special);