mirror of
https://github.com/rkd77/elinks.git
synced 2025-02-02 15:09:23 -05:00
[css] Do not execute css code when CONFIG_LIBCSS was set
This commit is contained in:
parent
cd238bf820
commit
5fa2a3371c
@ -234,6 +234,9 @@ examine_element(struct html_context *html_context, struct css_selector *base,
|
||||
process_found_selector(selector, CST_PSEUDO, base);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CSS
|
||||
#ifdef CONFIG_LIBCSS
|
||||
#else
|
||||
if (element->attr.class_ && seltype <= CST_CLASS) {
|
||||
const char *class_ = element->attr.class_;
|
||||
|
||||
@ -255,6 +258,8 @@ examine_element(struct html_context *html_context, struct css_selector *base,
|
||||
selector = find_css_selector(selectors, CST_ID, rel, element->attr.id, -1);
|
||||
process_found_selector(selector, CST_ID, base);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#undef process_found_selector
|
||||
#undef dbginfo
|
||||
|
@ -42,10 +42,13 @@ enum html_whitespace_state {
|
||||
|
||||
struct html_context {
|
||||
#ifdef CONFIG_CSS
|
||||
#ifdef CONFIG_LIBCSS
|
||||
#else
|
||||
/* The default stylesheet is initially merged into it. When parsing CSS
|
||||
* from <style>-tags and external stylesheets if enabled is merged
|
||||
* added to it. */
|
||||
struct css_stylesheet css_styles;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* These are global per-document base values, alterable by the <base>
|
||||
|
@ -775,8 +775,11 @@ init_html_parser(struct uri *uri, struct document_options *options,
|
||||
if (!html_context) return NULL;
|
||||
|
||||
#ifdef CONFIG_CSS
|
||||
#ifdef CONFIG_LIBCSS
|
||||
#else
|
||||
html_context->css_styles.import = import_css_stylesheet;
|
||||
init_css_selector_set(&html_context->css_styles.selectors);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
init_list(html_context->stack);
|
||||
@ -841,11 +844,14 @@ init_html_parser(struct uri *uri, struct document_options *options,
|
||||
html_context->table_level = 0;
|
||||
|
||||
#ifdef CONFIG_CSS
|
||||
#ifdef CONFIG_LIBCSS
|
||||
#else
|
||||
html_context->css_styles.import_data = html_context;
|
||||
|
||||
if (options->css_enable)
|
||||
mirror_css_stylesheet(&default_stylesheet,
|
||||
&html_context->css_styles);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return html_context;
|
||||
@ -855,8 +861,11 @@ void
|
||||
done_html_parser(struct html_context *html_context)
|
||||
{
|
||||
#ifdef CONFIG_CSS
|
||||
#ifdef CONFIG_LIBCSS
|
||||
#else
|
||||
if (html_context->options->css_enable)
|
||||
done_css_stylesheet(&html_context->css_styles);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
mem_free(html_context->base_target);
|
||||
|
@ -53,6 +53,8 @@ struct text_attrib {
|
||||
struct text_attrib_color color;
|
||||
|
||||
#ifdef CONFIG_CSS
|
||||
#ifdef CONFIG_LIBCSS
|
||||
#else
|
||||
/* Bug 766: CSS speedup. 56% of CPU time was going to
|
||||
* get_attr_value(). Of those calls, 97% were asking for "id"
|
||||
* or "class". So cache the results. start_element() sets up
|
||||
@ -60,6 +62,7 @@ struct text_attrib {
|
||||
* otherwise they remain NULL. */
|
||||
char *id;
|
||||
char *class_;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
char *select;
|
||||
|
@ -186,11 +186,14 @@ void
|
||||
html_apply_canvas_bgcolor(struct html_context *html_context)
|
||||
{
|
||||
#ifdef CONFIG_CSS
|
||||
#ifdef CONFIG_LIBCSS
|
||||
#else
|
||||
/* If there are any CSS twaks regarding bgcolor, make sure we will get
|
||||
* it _and_ prefer it over bgcolor attribute. */
|
||||
if (html_context->options->css_enable)
|
||||
css_apply(html_context, html_top, &html_context->css_styles,
|
||||
&html_context->stack);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (par_elformat.color.background != elformat.style.color.background) {
|
||||
|
@ -923,6 +923,8 @@ html_link(struct html_context *html_context, char *a,
|
||||
if (!link.href) goto free_and_return;
|
||||
|
||||
#ifdef CONFIG_CSS
|
||||
#ifdef CONFIG_LIBCSS
|
||||
#else
|
||||
if (link.type == LT_STYLESHEET
|
||||
&& supports_html_media_attr(link.media)) {
|
||||
int len = strlen(link.href);
|
||||
@ -932,6 +934,7 @@ html_link(struct html_context *html_context, char *a,
|
||||
}
|
||||
|
||||
if (!link_display) goto free_and_return;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Ignore few annoying links.. */
|
||||
|
@ -857,7 +857,10 @@ start_element(struct element_info *ei,
|
||||
struct par_attrib old_format;
|
||||
int restore_format;
|
||||
#ifdef CONFIG_CSS
|
||||
#ifdef CONFIG_LIBCSS
|
||||
#else
|
||||
struct css_selector *selector = NULL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* If the currently top element on the stack cannot contain other
|
||||
@ -896,6 +899,8 @@ start_element(struct element_info *ei,
|
||||
|
||||
/* If this is a style tag, parse it. */
|
||||
#ifdef CONFIG_CSS
|
||||
#ifdef CONFIG_LIBCSS
|
||||
#else
|
||||
if (ei->open == html_style && html_context->options->css_enable) {
|
||||
char *media
|
||||
= get_attr_val(attr, "media", html_context->doc_cp);
|
||||
@ -907,6 +912,7 @@ start_element(struct element_info *ei,
|
||||
html_context->base_href,
|
||||
html, eof);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* If this element is inline, non-nestable, and not <li>, and the next
|
||||
@ -977,6 +983,8 @@ start_element(struct element_info *ei,
|
||||
|
||||
/* Apply CSS styles. */
|
||||
#ifdef CONFIG_CSS
|
||||
#ifdef CONFIG_LIBCSS
|
||||
#else
|
||||
if (html_top->options && html_context->options->css_enable) {
|
||||
/* XXX: We should apply CSS otherwise as well, but that'll need
|
||||
* some deeper changes in order to have options filled etc.
|
||||
@ -1002,6 +1010,7 @@ start_element(struct element_info *ei,
|
||||
done_css_selector(selector);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* 1. Put any linebreaks that the element calls for, and 2. register
|
||||
@ -1019,6 +1028,8 @@ start_element(struct element_info *ei,
|
||||
|
||||
/* Apply CSS styles again. */
|
||||
#ifdef CONFIG_CSS
|
||||
#ifdef CONFIG_LIBCSS
|
||||
#else
|
||||
if (selector && html_top->options) {
|
||||
/* Call it now to override default colors of the elements. */
|
||||
selector = get_css_selector_for_element(html_context, html_top,
|
||||
@ -1030,6 +1041,7 @@ start_element(struct element_info *ei,
|
||||
done_css_selector(selector);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* If this element was not <br>, clear the was_br flag. */
|
||||
|
@ -122,8 +122,11 @@ kill_html_stack_item(struct html_context *html_context, struct html_element *e)
|
||||
mem_free_if(e->attr.select);
|
||||
|
||||
#ifdef CONFIG_CSS
|
||||
#ifdef CONFIG_LIBCSS
|
||||
#else
|
||||
mem_free_if(e->attr.id);
|
||||
mem_free_if(e->attr.class_);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
mem_free_if(e->attr.onclick);
|
||||
@ -168,7 +171,10 @@ html_stack_dup(struct html_context *html_context, enum html_element_mortality_ty
|
||||
if (ep->attr.select) e->attr.select = stracpy(ep->attr.select);
|
||||
|
||||
#ifdef CONFIG_CSS
|
||||
#ifdef CONFIG_LIBCSS
|
||||
#else
|
||||
e->attr.id = e->attr.class_ = NULL;
|
||||
#endif
|
||||
#endif
|
||||
/* We don't want to propagate these. */
|
||||
/* XXX: For sure? --pasky */
|
||||
|
@ -1,4 +1,4 @@
|
||||
if conf_data.get('CONFIG_CSS')
|
||||
if conf_data.get('CONFIG_CSS') and conf_data.get('CONFIG_DOM')
|
||||
subdir('css')
|
||||
endif
|
||||
if conf_data.get('CONFIG_DOM')
|
||||
|
Loading…
x
Reference in New Issue
Block a user