mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Optionally honour "display: none" (default off)
Because ELinks's CSS support is still so incomplete, some documents still render better if "display: none" is not honoured. Therefore, it is now honoured, unless document.css.ignore_display_none = 0, which is the default.
This commit is contained in:
parent
3ee39dae2b
commit
670d13728a
@ -76,6 +76,10 @@ css_apply_display(struct html_context *html_context, struct html_element *elemen
|
||||
* YMMV. */
|
||||
element->linebreak = 2;
|
||||
break;
|
||||
case CSS_DISP_NONE:
|
||||
if (html_context->options->css_ignore_display_none)
|
||||
element->invisible = 1;
|
||||
break;
|
||||
default:
|
||||
INTERNAL("Bad prop->value.display %d", prop->value.display);
|
||||
break;
|
||||
|
@ -35,6 +35,13 @@ struct option_info css_options_info[] = {
|
||||
"enable", 0, 1,
|
||||
N_("Enable adding of CSS style info to documents.")),
|
||||
|
||||
INIT_OPT_BOOL("document.css", N_("Ignore \"display: none\""),
|
||||
"ignore_display_none", 0, 1,
|
||||
N_("When enabled, elements are rendered, even when their display\n"
|
||||
"property has the value \"none\". Because ELinks's CSS support is\n"
|
||||
"still very incomplete, this setting can improve the way that some\n"
|
||||
"documents are rendered.")),
|
||||
|
||||
INIT_OPT_BOOL("document.css", N_("Import external style sheets"),
|
||||
"import", 0, 1,
|
||||
N_("When enabled any external style sheets that are imported from\n"
|
||||
|
@ -47,6 +47,7 @@ struct css_property {
|
||||
enum css_display {
|
||||
CSS_DISP_INLINE,
|
||||
CSS_DISP_BLOCK,
|
||||
CSS_DISP_NONE,
|
||||
} display;
|
||||
struct {
|
||||
enum text_style_format add, rem;
|
||||
|
@ -300,6 +300,8 @@ css_parse_display_value(struct css_property_info *propinfo,
|
||||
value->display = CSS_DISP_INLINE; /* XXX */
|
||||
} else if (scanner_token_contains(token, "block")) {
|
||||
value->display = CSS_DISP_BLOCK;
|
||||
} else if (scanner_token_contains(token, "none")) {
|
||||
value->display = CSS_DISP_NONE;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ init_document_options(struct session *ses, struct document_options *doo)
|
||||
/* Boolean options. */
|
||||
#ifdef CONFIG_CSS
|
||||
doo->css_enable = get_opt_bool("document.css.enable", ses);
|
||||
doo->css_ignore_display_none = get_opt_bool("document.css.ignore_display_none", ses);
|
||||
doo->css_import = get_opt_bool("document.css.import", ses);
|
||||
#endif
|
||||
|
||||
|
@ -71,6 +71,7 @@ struct document_options {
|
||||
* @{ */
|
||||
unsigned int css_enable:1;
|
||||
unsigned int css_import:1;
|
||||
unsigned int css_ignore_display_none:1;
|
||||
/** @} */
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user