1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[iframes] added document.html.display_iframes option

This commit is contained in:
Witold Filipczyk 2021-07-31 17:11:53 +02:00
parent 83a359005b
commit 0ef0470191
4 changed files with 24 additions and 16 deletions

View File

@ -796,6 +796,10 @@ static union option_info config_options_info[] = {
"display_frames", 0, 1,
N_("Display frames.")),
INIT_OPT_BOOL("document.html", N_("Display iframes"),
"display_iframes", 0, 1,
N_("Display iframes.")),
INIT_OPT_BOOL("document.html", N_("Display tables"),
"display_tables", 0, 1,
N_("Display tables.")),

View File

@ -468,9 +468,8 @@ html_iframe_do(char *a, char *object_src,
struct html_context *html_context)
{
char *name, *url = NULL;
char *hstr, *wstr;
int height;
int width;
int height = 0;
int width = 0;
url = null_or_stracpy(object_src);
if (!url) url = get_url_val(a, "src", html_context->doc_cp);
@ -483,23 +482,26 @@ html_iframe_do(char *a, char *object_src,
mem_free(url);
return;
}
hstr = get_attr_val(a, "height", html_context->doc_cp);
wstr = get_attr_val(a, "width", html_context->doc_cp);
html_focusable(html_context, a);
if (!hstr) {
height = (150 + HTML_CHAR_HEIGHT - 1) / HTML_CHAR_HEIGHT;
} else {
height = (atoi(hstr) + HTML_CHAR_HEIGHT - 1) / HTML_CHAR_HEIGHT;
mem_free(hstr);
}
if (html_context->options->iframes) {
char *hstr = get_attr_val(a, "height", html_context->doc_cp);
char *wstr = get_attr_val(a, "width", html_context->doc_cp);
if (!wstr) {
width = (300 + HTML_CHAR_WIDTH - 1) / HTML_CHAR_WIDTH;
} else {
width = (atoi(wstr) + HTML_CHAR_WIDTH - 1) / HTML_CHAR_WIDTH;
mem_free(wstr);
if (!hstr) {
height = (150 + HTML_CHAR_HEIGHT - 1) / HTML_CHAR_HEIGHT;
} else {
height = (atoi(hstr) + HTML_CHAR_HEIGHT - 1) / HTML_CHAR_HEIGHT;
mem_free(hstr);
}
if (!wstr) {
width = (300 + HTML_CHAR_WIDTH - 1) / HTML_CHAR_WIDTH;
} else {
width = (atoi(wstr) + HTML_CHAR_WIDTH - 1) / HTML_CHAR_WIDTH;
mem_free(wstr);
}
}
if (height > 0) {

View File

@ -95,6 +95,7 @@ init_document_options(struct session *ses, struct document_options *doo)
doo->table_order = get_opt_bool("document.browse.table_move_order", ses);
doo->tables = get_opt_bool("document.html.display_tables", ses);
doo->frames = get_opt_bool("document.html.display_frames", ses);
doo->iframes = get_opt_bool("document.html.display_iframes", ses);
doo->images = get_opt_bool("document.browse.images.show_as_links", ses);
doo->display_subs = get_opt_bool("document.html.display_subs", ses);
doo->display_sups = get_opt_bool("document.html.display_sups", ses);

View File

@ -90,6 +90,7 @@ struct document_options {
unsigned int table_order:1;
unsigned int frames:1;
unsigned int images:1;
unsigned int iframes:1;
unsigned int display_subs:1;
unsigned int display_sups:1;