From f04cedef1c7742f38b0b561efcd77e0476fcbf60 Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Sat, 20 Jan 2018 13:29:36 +0000 Subject: Debian(ish): use libssl1.0-dev if it exists --- docs/env.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/env.sh b/docs/env.sh index bb2cbabea..f1c89a84f 100644 --- a/docs/env.sh +++ b/docs/env.sh @@ -25,7 +25,7 @@ ############################################################################### # deb packages for dpkg based systems -NS_DEV_DEB="build-essential pkg-config git gperf libcurl3-dev libssl-dev libpng-dev libjpeg-dev" +NS_DEV_DEB="build-essential pkg-config git gperf libcurl3-dev libpng-dev libjpeg-dev" NS_TOOL_DEB="flex bison libhtml-parser-perl" if [ "x${NETSURF_GTK_MAJOR}" = "x3" ]; then NS_GTK_DEB="libgtk-3-dev librsvg2-dev" @@ -36,6 +36,11 @@ fi # apt get commandline to install necessary dev packages ns-apt-get-install() { + if /usr/bin/apt-cache show libssl1.0-dev >/dev/null 2>&1; then + NS_DEV_DEB="${NS_DEV_DEB} libssl1.0-dev" + else + NS_DEV_DEB="${NS_DEV_DEB} libssl-dev" + fi sudo apt-get install $(echo ${NS_DEV_DEB} ${NS_TOOL_DEB} ${NS_GTK_DEB}) } -- cgit v1.2.3 From 328a29d22f81b838a0a6b2f1d3d5fc4dbfe5e6e7 Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Sat, 20 Jan 2018 15:33:05 +0000 Subject: RSVG: fix colour conversion --- content/handlers/image/rsvg.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/content/handlers/image/rsvg.c b/content/handlers/image/rsvg.c index ca2d81eeb..2ba1b49f5 100644 --- a/content/handlers/image/rsvg.c +++ b/content/handlers/image/rsvg.c @@ -39,6 +39,8 @@ #include #endif +#include + #include "utils/log.h" #include "utils/utils.h" #include "utils/messages.h" @@ -139,15 +141,21 @@ static inline void rsvg_argb_to_abgr(uint8_t *pixels, int width, int height, size_t rowstride) { uint8_t *p = pixels; + int boff = 0, roff = 2; + + if (endian_host_is_le() == false) { + boff = 1; + roff = 3; + } for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { /* Swap R and B */ - const uint8_t r = p[x+3]; + const uint8_t r = p[4*x+roff]; - p[x+3] = p[x]; + p[4*x+roff] = p[4*x+boff]; - p[x] = r; + p[4*x+boff] = r; } p += rowstride; -- cgit v1.2.3 From 17ae38771df50a81f49eebead84ff8914fb947e4 Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Sat, 20 Jan 2018 16:18:51 +0000 Subject: Backing store: clean up resources properly. Patch from Felix S. Fixes #2579. --- content/fs_backing_store.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/content/fs_backing_store.c b/content/fs_backing_store.c index 1b59ea150..3736cc551 100644 --- a/content/fs_backing_store.c +++ b/content/fs_backing_store.c @@ -1565,6 +1565,7 @@ initialise(const struct llcache_store_parameters *parameters) ret = build_entrymap(newstate); if (ret != NSERROR_OK) { /* that obviously went well */ + free(newstate->entries); free(newstate->path); free(newstate); return ret; @@ -1573,6 +1574,8 @@ initialise(const struct llcache_store_parameters *parameters) ret = read_blocks(newstate); if (ret != NSERROR_OK) { /* oh dear */ + free(newstate->addrmap); + free(newstate->entries); free(newstate->path); free(newstate); return ret; @@ -1640,6 +1643,8 @@ finalise(void) 0); } + free(storestate->addrmap); + free(storestate->entries); free(storestate->path); free(storestate); storestate = NULL; -- cgit v1.2.3 From fe45bc1dbea417c2258a22797ace09926b33a481 Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Sat, 20 Jan 2018 17:57:52 +0000 Subject: JPEG: handle CMYK/YCCK images No real colourspace conversion here, so expect oversaturated images Fixes #2570. --- content/handlers/image/jpeg.c | 55 +++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/content/handlers/image/jpeg.c b/content/handlers/image/jpeg.c index 44b1c5271..123a0bf70 100644 --- a/content/handlers/image/jpeg.c +++ b/content/handlers/image/jpeg.c @@ -214,7 +214,12 @@ jpeg_cache_convert(struct content *c) jpeg_read_header(&cinfo, TRUE); /* set output processing parameters */ - cinfo.out_color_space = JCS_RGB; + if (cinfo.jpeg_color_space == JCS_CMYK || + cinfo.jpeg_color_space == JCS_YCCK) { + cinfo.out_color_space = JCS_CMYK; + } else { + cinfo.out_color_space = JCS_RGB; + } cinfo.dct_method = JDCT_ISLOW; /* commence the decompression, output parameters now valid */ @@ -248,22 +253,42 @@ jpeg_cache_convert(struct content *c) rowstride * cinfo.output_scanline); jpeg_read_scanlines(&cinfo, scanlines, 1); + if (cinfo.out_color_space == JCS_CMYK) { + int i; + for (i = width - 1; 0 <= i; i--) { + /* Trivial inverse CMYK -> RGBA */ + const int c = scanlines[0][i * 4 + 0]; + const int m = scanlines[0][i * 4 + 1]; + const int y = scanlines[0][i * 4 + 2]; + const int k = scanlines[0][i * 4 + 3]; + + const int ck = c * k; + const int mk = m * k; + const int yk = y * k; + +#define DIV255(x) ((x) + 1 + ((x) >> 8)) >> 8 + scanlines[0][i * 4 + 0] = DIV255(ck); + scanlines[0][i * 4 + 1] = DIV255(mk); + scanlines[0][i * 4 + 2] = DIV255(yk); + scanlines[0][i * 4 + 3] = 0xff; +#undef DIV255 + } + } else { #if RGB_RED != 0 || RGB_GREEN != 1 || RGB_BLUE != 2 || RGB_PIXELSIZE != 4 -{ - /* Missmatch between configured libjpeg pixel format and - * NetSurf pixel format. Convert to RGBA */ - int i; - for (i = width - 1; 0 <= i; i--) { - int r = scanlines[0][i * RGB_PIXELSIZE + RGB_RED]; - int g = scanlines[0][i * RGB_PIXELSIZE + RGB_GREEN]; - int b = scanlines[0][i * RGB_PIXELSIZE + RGB_BLUE]; - scanlines[0][i * 4 + 0] = r; - scanlines[0][i * 4 + 1] = g; - scanlines[0][i * 4 + 2] = b; - scanlines[0][i * 4 + 3] = 0xff; - } -} + /* Missmatch between configured libjpeg pixel format and + * NetSurf pixel format. Convert to RGBA */ + int i; + for (i = width - 1; 0 <= i; i--) { + int r = scanlines[0][i * RGB_PIXELSIZE + RGB_RED]; + int g = scanlines[0][i * RGB_PIXELSIZE + RGB_GREEN]; + int b = scanlines[0][i * RGB_PIXELSIZE + RGB_BLUE]; + scanlines[0][i * 4 + 0] = r; + scanlines[0][i * 4 + 1] = g; + scanlines[0][i * 4 + 2] = b; + scanlines[0][i * 4 + 3] = 0xff; + } #endif + } } while (cinfo.output_scanline != cinfo.output_height); guit->bitmap->modified(bitmap); -- cgit v1.2.3 From 7a75ec1576fc2a4f3d445b33b1d9f00e0007643d Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Sat, 20 Jan 2018 18:47:26 +0000 Subject: History: don't update if there's no content. Fixes #2566. --- desktop/browser_history.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/desktop/browser_history.c b/desktop/browser_history.c index 640302773..d9db0eb18 100644 --- a/desktop/browser_history.c +++ b/desktop/browser_history.c @@ -601,7 +601,9 @@ nserror browser_window_history_go(struct browser_window *bw, url, NULL, bw, NULL); history->current = current; } else { - browser_window_history_update(bw, bw->current_content); + if (bw->current_content != NULL) { + browser_window_history_update(bw, bw->current_content); + } history->current = entry; error = browser_window_navigate(bw, url, NULL, BW_NAVIGATE_NO_TERMINAL_HISTORY_UPDATE, -- cgit v1.2.3 From 110cc9fb3e098100a7ed91340a82e351a220bce1 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 20 Jan 2018 18:52:13 +0000 Subject: RISC OS: Update to ChkSprites from `Sprow`. Fixes bug #2534. --- !NetSurf/ChkSprites,ffb | Bin 1531 -> 2029 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/!NetSurf/ChkSprites,ffb b/!NetSurf/ChkSprites,ffb index 4e7d325fb..4e38dfba5 100644 Binary files a/!NetSurf/ChkSprites,ffb and b/!NetSurf/ChkSprites,ffb differ -- cgit v1.2.3 From 790d30b7888d5818a4e2521aabe2f31f04d59341 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 21 Jan 2018 12:32:10 +0000 Subject: HTML handler: Normalise box type on replacment. We currently only do TABLE --> BLOCK normalisation. --- render/html_object.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/render/html_object.c b/render/html_object.c index fb9e7b090..74e4bf0f3 100644 --- a/render/html_object.c +++ b/render/html_object.c @@ -97,6 +97,16 @@ html_object_done(struct box *box, box->object = object; + /* Normalise the box type, now it has been replaced. */ + switch (box->type) { + case BOX_TABLE: + box->type = BOX_BLOCK; + break; + default: + /* TODO: Any other box types need mapping? */ + break; + } + if (!(box->flags & REPLACE_DIM)) { /* invalidate parent min, max widths */ for (b = box; b; b = b->parent) -- cgit v1.2.3 From 08c275ed2c843441aad23d38646083de7a130753 Mon Sep 17 00:00:00 2001 From: John-Mark Bell Date: Sun, 21 Jan 2018 14:27:10 +0000 Subject: RISC OS: translate resource paths. Fixes #2266. --- frontends/riscos/gui.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/frontends/riscos/gui.c b/frontends/riscos/gui.c index cfc513f72..be1bc8d9a 100644 --- a/frontends/riscos/gui.c +++ b/frontends/riscos/gui.c @@ -195,6 +195,7 @@ static struct static nsurl *gui_get_resource_url(const char *path) { static const char base_url[] = "file:///NetSurf:/Resources/"; + const char *lang; size_t path_len, length; char *raw; nsurl *url = NULL; @@ -220,8 +221,12 @@ static nsurl *gui_get_resource_url(const char *path) path_len = strlen(path); + lang = ro_gui_default_language(); + /* Find max URL length */ - length = SLEN(base_url) + SLEN("xx/") + path_len + 1; + length = SLEN(base_url) + + strlen(lang) + 1 + /* + / */ + path_len + 1; /* + NUL */ raw = malloc(length); if (raw != NULL) { @@ -230,13 +235,11 @@ static nsurl *gui_get_resource_url(const char *path) ptr += SLEN(base_url); /* Add language directory to URL, for translated files */ - /* TODO: handle non-en langauages - * handle non-html translated files */ + /* TODO: handle non-html translated files */ if (path_len > SLEN(".html") && strncmp(path + path_len - SLEN(".html"), ".html", SLEN(".html")) == 0) { - memcpy(ptr, "en/", SLEN("en/")); - ptr += SLEN("en/"); + ptr += sprintf(ptr, "%s/", lang); } /* Add filename to URL */ -- cgit v1.2.3 From 29e36cdf1a6f4404f804e5c2b46d38dad929416d Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 21 Jan 2018 14:22:23 +0000 Subject: Framebuffer: Tweak comment to avoid fallthrough warning. --- frontends/framebuffer/gui.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontends/framebuffer/gui.c b/frontends/framebuffer/gui.c index e252f25f3..8bbaedc22 100644 --- a/frontends/framebuffer/gui.c +++ b/frontends/framebuffer/gui.c @@ -951,8 +951,7 @@ fb_browser_window_input(fbtk_widget_t *widget, fbtk_callback_info *cbi) browser_window_key_press(gw->bw, NS_KEY_REDO); break; } - /* Z or Y pressed but not undo or redo; - * Fall through to default handling */ + /* Z or Y pressed but not undo or redo; Fall through */ default: ucs4 = fbtk_keycode_to_ucs4(cbi->event->value.keycode, -- cgit v1.2.3 From 89baae16b47fad0dcb50402e9a2ba887b05242c0 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 21 Jan 2018 14:27:59 +0000 Subject: Framebuffer: Squash fallthrough warnings in internal font handling. --- frontends/framebuffer/font_internal.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontends/framebuffer/font_internal.c b/frontends/framebuffer/font_internal.c index 3b8a1c43f..ff3471d1d 100644 --- a/frontends/framebuffer/font_internal.c +++ b/frontends/framebuffer/font_internal.c @@ -270,6 +270,7 @@ fb_get_glyph(uint32_t ucs4, enum fb_font_style style, int scale) break; } } + /* Fall through. */ case FB_BOLD: section = fb_bold_section_table[ucs4 / 256]; if (section != 0 || ucs4 / 256 == 0) { @@ -280,6 +281,7 @@ fb_get_glyph(uint32_t ucs4, enum fb_font_style style, int scale) break; } } + /* Fall through. */ case FB_ITALIC: section = fb_italic_section_table[ucs4 / 256]; if (section != 0 || ucs4 / 256 == 0) { @@ -290,6 +292,7 @@ fb_get_glyph(uint32_t ucs4, enum fb_font_style style, int scale) break; } } + /* Fall through. */ case FB_REGULAR: section = fb_regular_section_table[ucs4 / 256]; if (section != 0 || ucs4 / 256 == 0) { @@ -300,6 +303,7 @@ fb_get_glyph(uint32_t ucs4, enum fb_font_style style, int scale) break; } } + /* Fall through. */ default: glyph_data = get_codepoint(ucs4, style & FB_ITALIC); break; -- cgit v1.2.3 From 470dce645bc9cfca1d438f62a8ffe7a6db80a278 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Thu, 1 Feb 2018 20:59:39 +0000 Subject: Avoid potential division by zero --- frontends/amiga/theme.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontends/amiga/theme.c b/frontends/amiga/theme.c index 5e4be0710..63982c879 100644 --- a/frontends/amiga/theme.c +++ b/frontends/amiga/theme.c @@ -54,7 +54,8 @@ static struct BitMap *throbber = NULL; static struct bitmap *throbber_nsbm = NULL; -static int throbber_frames, throbber_update_interval; +static int throbber_frames = 1; +static int throbber_update_interval; static Object *mouseptrobj[AMI_LASTPOINTER+1]; static struct BitMap *mouseptrbm[AMI_LASTPOINTER+1]; @@ -176,6 +177,7 @@ void ami_theme_throbber_setup(void) ami_get_theme_filename(throbberfile,"theme_throbber",false); throbber_frames=atoi(messages_get("theme_throbber_frames")); + if(throbber_frames == 0) throbber_frames = 1; throbber_update_interval = atoi(messages_get("theme_throbber_delay")); if(throbber_update_interval == 0) throbber_update_interval = 250; -- cgit v1.2.3