1
0
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:
Miciah Dashiel Butler Masters 2007-12-22 03:20:55 +00:00
parent 3ee39dae2b
commit 670d13728a
6 changed files with 16 additions and 0 deletions

View File

@ -76,6 +76,10 @@ css_apply_display(struct html_context *html_context, struct html_element *elemen
* YMMV. */ * YMMV. */
element->linebreak = 2; element->linebreak = 2;
break; break;
case CSS_DISP_NONE:
if (html_context->options->css_ignore_display_none)
element->invisible = 1;
break;
default: default:
INTERNAL("Bad prop->value.display %d", prop->value.display); INTERNAL("Bad prop->value.display %d", prop->value.display);
break; break;

View File

@ -35,6 +35,13 @@ struct option_info css_options_info[] = {
"enable", 0, 1, "enable", 0, 1,
N_("Enable adding of CSS style info to documents.")), 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"), INIT_OPT_BOOL("document.css", N_("Import external style sheets"),
"import", 0, 1, "import", 0, 1,
N_("When enabled any external style sheets that are imported from\n" N_("When enabled any external style sheets that are imported from\n"

View File

@ -47,6 +47,7 @@ struct css_property {
enum css_display { enum css_display {
CSS_DISP_INLINE, CSS_DISP_INLINE,
CSS_DISP_BLOCK, CSS_DISP_BLOCK,
CSS_DISP_NONE,
} display; } display;
struct { struct {
enum text_style_format add, rem; enum text_style_format add, rem;

View File

@ -300,6 +300,8 @@ css_parse_display_value(struct css_property_info *propinfo,
value->display = CSS_DISP_INLINE; /* XXX */ value->display = CSS_DISP_INLINE; /* XXX */
} else if (scanner_token_contains(token, "block")) { } else if (scanner_token_contains(token, "block")) {
value->display = CSS_DISP_BLOCK; value->display = CSS_DISP_BLOCK;
} else if (scanner_token_contains(token, "none")) {
value->display = CSS_DISP_NONE;
} else { } else {
return 0; return 0;
} }

View File

@ -58,6 +58,7 @@ init_document_options(struct session *ses, struct document_options *doo)
/* Boolean options. */ /* Boolean options. */
#ifdef CONFIG_CSS #ifdef CONFIG_CSS
doo->css_enable = get_opt_bool("document.css.enable", ses); 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); doo->css_import = get_opt_bool("document.css.import", ses);
#endif #endif

View File

@ -71,6 +71,7 @@ struct document_options {
* @{ */ * @{ */
unsigned int css_enable:1; unsigned int css_enable:1;
unsigned int css_import:1; unsigned int css_import:1;
unsigned int css_ignore_display_none:1;
/** @} */ /** @} */
#endif #endif