From cf94c2a1e8cac52074183b31f75b71480dbdcea1 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 12 Oct 2016 12:26:30 +0200 Subject: Bug 696958: parse css hex colors that are missing the '#' prefix. --- source/html/css-apply.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source/html/css-apply.c') diff --git a/source/html/css-apply.c b/source/html/css-apply.c index 43aaa905..d7375752 100644 --- a/source/html/css-apply.c +++ b/source/html/css-apply.c @@ -1022,7 +1022,9 @@ color_from_value(fz_css_value *value, fz_css_color initial) if (value->type == CSS_HASH) { int r, g, b; - size_t n = strlen(value->data); + size_t n; +hex_color: + n = strlen(value->data); if (n == 3) { r = tohex(value->data[0]) * 16 + tohex(value->data[0]); @@ -1093,7 +1095,7 @@ color_from_value(fz_css_value *value, fz_css_color initial) return make_color(0xC0, 0xC0, 0xC0, 255); if (!strcmp(value->data, "gray")) return make_color(0x80, 0x80, 0x80, 255); - return make_color(0, 0, 0, 255); + goto hex_color; /* last ditch attempt: maybe it's a #XXXXXX color without the # */ } return initial; } -- cgit v1.2.3