From 081217a321fd6cee427ac4d3f012b2a5d959cf13 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 23 Dec 2011 19:48:09 +0000 Subject: Add core options to disable fetch of foreground & background images. Remove broken background image option from RISC OS front end. svn path=/trunk/netsurf/; revision=13332 --- desktop/options.c | 6 ++++++ desktop/options.h | 2 ++ render/box_construct.c | 12 +++++++++--- riscos/options.h | 3 --- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/desktop/options.c b/desktop/options.c index 131ac8917..0fbf40b32 100644 --- a/desktop/options.c +++ b/desktop/options.c @@ -97,6 +97,10 @@ bool option_block_ads = false; int option_minimum_gif_delay = 10; /** Whether to send the referer HTTP header */ bool option_send_referer = true; +/** Whether to fetch foreground images */ +bool option_foreground_images = true; +/** Whether to fetch background images */ +bool option_background_images = true; /** Whether to animate images */ bool option_animate_images = true; /** How many days to retain URL data for */ @@ -262,6 +266,8 @@ struct option_entry_s option_table[] = { { "block_advertisements", OPTION_BOOL, &option_block_ads }, { "minimum_gif_delay", OPTION_INTEGER, &option_minimum_gif_delay }, { "send_referer", OPTION_BOOL, &option_send_referer }, + { "foreground_images", OPTION_BOOL, &option_foreground_images }, + { "background_images", OPTION_BOOL, &option_background_images }, { "animate_images", OPTION_BOOL, &option_animate_images }, { "expire_url", OPTION_INTEGER, &option_expire_url }, { "font_default", OPTION_INTEGER, &option_font_default }, diff --git a/desktop/options.h b/desktop/options.h index cfc585c28..42375f9ef 100644 --- a/desktop/options.h +++ b/desktop/options.h @@ -58,6 +58,8 @@ extern int option_disc_cache_age; extern bool option_block_ads; extern int option_minimum_gif_delay; extern bool option_send_referer; +extern bool option_foreground_images; +extern bool option_background_images; extern bool option_animate_images; extern int option_expire_url; extern int option_font_default; /* a css_font_family */ diff --git a/render/box_construct.c b/render/box_construct.c index 2aa9ff091..4b280fbe9 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -405,7 +405,8 @@ static bool box_construct_marker(struct box *box, const char *title, } if (css_computed_list_style_image(box->style, &image_uri) == - CSS_LIST_STYLE_IMAGE_URI && image_uri != NULL) { + CSS_LIST_STYLE_IMAGE_URI && image_uri != NULL && + option_foreground_images == true) { nsurl *url; nserror error; @@ -710,7 +711,8 @@ bool box_construct_element(struct box_construct_ctx *ctx, /* Kick off fetch for any background image */ if (css_computed_background_image(box->style, &bgimage_uri) == - CSS_BACKGROUND_IMAGE_IMAGE && bgimage_uri != NULL) { + CSS_BACKGROUND_IMAGE_IMAGE && bgimage_uri != NULL && + option_background_images == true) { nsurl *url; nserror error; @@ -1378,6 +1380,9 @@ bool box_image(BOX_SPECIAL_PARAMS) box->length = strlen(box->text); } + if (option_foreground_images == false) + return true; + /* imagemap associated with this image */ if (!box_get_attribute(n, "usemap", content, &box->usemap)) return false; @@ -2035,7 +2040,8 @@ bool box_input(BOX_SPECIAL_PARAMS) gadget->type = GADGET_IMAGE; if (box->style && css_computed_display(box->style, - n->parent == NULL) != CSS_DISPLAY_NONE) { + n->parent == NULL) != CSS_DISPLAY_NONE && + option_foreground_images == true) { if ((s = (char *) xmlGetProp(n, (const xmlChar*) "src"))) { error = nsurl_join(content->base_url, s, &url); diff --git a/riscos/options.h b/riscos/options.h index 463a6fa56..6aa6a8b20 100644 --- a/riscos/options.h +++ b/riscos/options.h @@ -44,7 +44,6 @@ extern char *option_toolbar_history; extern char *option_toolbar_cookies; extern bool option_window_stagger; extern bool option_window_size_clone; -extern bool option_background_images; extern bool option_buffer_animations; extern bool option_buffer_everything; extern bool option_open_browser_at_startup; @@ -84,7 +83,6 @@ char *option_toolbar_history = 0; \ char *option_toolbar_cookies = 0; \ bool option_window_stagger = true; \ bool option_window_size_clone = true; \ -bool option_background_images = true; \ bool option_buffer_animations = true; \ bool option_buffer_everything = true; \ bool option_open_browser_at_startup = false; \ @@ -124,7 +122,6 @@ char *option_external_hotlist_app = 0; { "toolbar_cookies", OPTION_STRING, &option_toolbar_cookies }, \ { "window_stagger", OPTION_BOOL, &option_window_stagger }, \ { "window_size_clone", OPTION_BOOL, &option_window_size_clone }, \ -{ "background_images", OPTION_BOOL, &option_background_images }, \ { "buffer_animations", OPTION_BOOL, &option_buffer_animations }, \ { "buffer_everything", OPTION_BOOL, &option_buffer_everything }, \ { "open_browser_at_startup",OPTION_BOOL, &option_open_browser_at_startup }, \ -- cgit v1.2.3