diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2011-01-29 14:45:05 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2011-01-29 14:45:05 +0000 |
commit | 9838246d69a3d48a8d0d286ecbfcd1faa199ae91 (patch) | |
tree | ae1fcbdbd02cfe4ed95702a517133ceb9e249f50 /src/parse/properties/utils.c | |
parent | 9a026637586cc90ce3418e945210c90313434306 (diff) | |
download | libcss-9838246d69a3d48a8d0d286ecbfcd1faa199ae91.tar.gz libcss-9838246d69a3d48a8d0d286ecbfcd1faa199ae91.tar.bz2 |
Provide hook for system colour name -> RGB conversion
svn path=/trunk/libcss/; revision=11522
Diffstat (limited to 'src/parse/properties/utils.c')
-rw-r--r-- | src/parse/properties/utils.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/parse/properties/utils.c b/src/parse/properties/utils.c index 85c0e2d..860712d 100644 --- a/src/parse/properties/utils.c +++ b/src/parse/properties/utils.c @@ -628,7 +628,6 @@ css_error css__parse_colour_specifier(css_language *c, goto invalid; /* have a valid HSV entry, convert to RGB */ - HSL_to_RGB(hue, sat, lit, &r, &g, &b); /* apply alpha */ @@ -821,17 +820,23 @@ css_error css__parse_named_colour(css_language *c, lwc_string *data, bool match; for (i = FIRST_COLOUR; i <= LAST_COLOUR; i++) { - if (lwc_string_caseless_isequal(data, c->strings[i], - &match) == lwc_error_ok && - match) + if (lwc_string_caseless_isequal(data, c->strings[i], + &match) == lwc_error_ok && match) break; } - if (i == LAST_COLOUR + 1) - return CSS_INVALID; - *result = colourmap[i - FIRST_COLOUR]; + if (i <= LAST_COLOUR) { + /* Known named colour */ + *result = colourmap[i - FIRST_COLOUR]; + return CSS_OK; + } + + /* We don't know this colour name; ask the client */ + if (c->sheet->color != NULL) + return c->sheet->color(c->sheet->color_pw, data, result); - return CSS_OK; + /* Invalid colour name */ + return CSS_INVALID; } /** |