summaryrefslogtreecommitdiff
path: root/source/html
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-05-04 17:23:51 +0200
committerTor Andersson <tor.andersson@artifex.com>2015-05-04 17:23:51 +0200
commit490ab9416cc95cdcaf248f2d343c21da2df74309 (patch)
tree5714e4aa1db2e5286749cf1104fe31237e9ec820 /source/html
parent5f3e0b1fb53b8988b5cbc53ad747a42ac95e5fee (diff)
downloadmupdf-490ab9416cc95cdcaf248f2d343c21da2df74309.tar.xz
epub: Parse rgb(x,y,z) type colors.
Diffstat (limited to 'source/html')
-rw-r--r--source/html/css-apply.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/html/css-apply.c b/source/html/css-apply.c
index abd045ec..e0e62e3b 100644
--- a/source/html/css-apply.c
+++ b/source/html/css-apply.c
@@ -785,6 +785,7 @@ color_from_value(fz_css_value *value, fz_css_color initial)
{
if (!value)
return initial;
+
if (value->type == CSS_HASH)
{
int r, g, b, n;
@@ -807,6 +808,20 @@ color_from_value(fz_css_value *value, fz_css_color initial)
}
return make_color(r, g, b, 255);
}
+
+ if (value->type == '(' && !strcmp(value->data, "rgb"))
+ {
+ fz_css_value *vr, *vg, *vb;
+ int r, g, b;
+ vr = value->args;
+ vg = vr && vr->next ? vr->next->next : NULL; /* skip the ',' nodes */
+ vb = vg && vg->next ? vg->next->next : NULL; /* skip the ',' nodes */
+ r = fz_from_css_number(number_from_value(vr, 0, N_NUMBER), 255, 255);
+ g = fz_from_css_number(number_from_value(vg, 0, N_NUMBER), 255, 255);
+ b = fz_from_css_number(number_from_value(vb, 0, N_NUMBER), 255, 255);
+ return make_color(r, g, b, 255);
+ }
+
if (value->type == CSS_KEYWORD)
{
if (!strcmp(value->data, "transparent"))