[project @ 2004-12-07 02:25:14 by jmb]
Support SVG 1.0 named colours (plus feldspar, lightslateblue and violetred). svn path=/import/netsurf/; revision=1386
This commit is contained in:
parent
dfc28d0ccb
commit
2b91efdc1e
175
css/ruleset.c
175
css/ruleset.c
|
@ -266,31 +266,164 @@ static const struct css_property_entry css_property_table[] = {
|
|||
|
||||
/** An entry in css_colour_table. */
|
||||
struct css_colour_entry {
|
||||
const char name[12];
|
||||
const char name[21];
|
||||
colour col;
|
||||
};
|
||||
|
||||
/* Table of standard colour names. MUST be sorted by colour name.
|
||||
* Note: colour is 0xbbggrr. */
|
||||
static const struct css_colour_entry css_colour_table[] = {
|
||||
{ "aqua", 0xffff00 },
|
||||
{ "black", 0x000000 },
|
||||
{ "blue", 0xff0000 },
|
||||
{ "fuchsia", 0xff00ff },
|
||||
{ "gray", 0x808080 },
|
||||
{ "green", 0x008000 },
|
||||
{ "lime", 0x00ff00 },
|
||||
{ "maroon", 0x000080 },
|
||||
{ "navy", 0x800000 },
|
||||
{ "olive", 0x008080 },
|
||||
{ "orange", 0x00a5ff },
|
||||
{ "purple", 0x800080 },
|
||||
{ "red", 0x0000ff },
|
||||
{ "silver", 0xc0c0c0 },
|
||||
{ "teal", 0x808000 },
|
||||
{ "transparent", TRANSPARENT },
|
||||
{ "white", 0xffffff },
|
||||
{ "yellow", 0x00ffff },
|
||||
{ "aliceblue", 0xfff8f0 },
|
||||
{ "antiquewhite", 0xd7ebfa },
|
||||
{ "aqua", 0xffff00 },
|
||||
{ "aquamarine", 0xd4ff7f },
|
||||
{ "azure", 0xfffff0 },
|
||||
{ "beige", 0xdcf5f5 },
|
||||
{ "bisque", 0xc4e4ff },
|
||||
{ "black", 0x000000 },
|
||||
{ "blanchedalmond", 0xcdebff },
|
||||
{ "blue", 0xff0000 },
|
||||
{ "blueviolet", 0xe22b8a },
|
||||
{ "brown", 0x2a2aa5 },
|
||||
{ "burlywood", 0x87b8de },
|
||||
{ "cadetblue", 0xa09e5f },
|
||||
{ "chartreuse", 0x00ff7f },
|
||||
{ "chocolate", 0x1e69d2 },
|
||||
{ "coral", 0x507fff },
|
||||
{ "cornflowerblue", 0xed9564 },
|
||||
{ "cornsilk", 0xdcf8ff },
|
||||
{ "crimson", 0x3c14dc },
|
||||
{ "cyan", 0xffff00 },
|
||||
{ "darkblue", 0x8b0000 },
|
||||
{ "darkcyan", 0x8b8b00 },
|
||||
{ "darkgoldenrod", 0x0b86b8 },
|
||||
{ "darkgray", 0xa9a9a9 },
|
||||
{ "darkgreen", 0x006400 },
|
||||
{ "darkgrey", 0xa9a9a9 },
|
||||
{ "darkkhaki", 0x6bb7bd },
|
||||
{ "darkmagenta", 0x8b008b },
|
||||
{ "darkolivegreen", 0x2f6b55 },
|
||||
{ "darkorange", 0x008cff },
|
||||
{ "darkorchid", 0xcc3299 },
|
||||
{ "darkred", 0x00008b },
|
||||
{ "darksalmon", 0x7a96e9 },
|
||||
{ "darkseagreen", 0x8fbc8f },
|
||||
{ "darkslateblue", 0x8b3d48 },
|
||||
{ "darkslategray", 0x4f4f2f },
|
||||
{ "darkslategrey", 0x4f4f2f },
|
||||
{ "darkturquoise", 0xd1ce00 },
|
||||
{ "darkviolet", 0xd30094 },
|
||||
{ "deeppink", 0x9314ff },
|
||||
{ "deepskyblue", 0xffbf00 },
|
||||
{ "dimgray", 0x696969 },
|
||||
{ "dimgrey", 0x696969 },
|
||||
{ "dodgerblue", 0xff901e },
|
||||
{ "feldspar", 0x7592d1 }, /* not SVG-1.0 */
|
||||
{ "firebrick", 0x2222b2 },
|
||||
{ "floralwhite", 0xf0faff },
|
||||
{ "forestgreen", 0x228b22 },
|
||||
{ "fuchsia", 0xff00ff },
|
||||
{ "gainsboro", 0xdcdcdc },
|
||||
{ "ghostwhite", 0xfff8f8 },
|
||||
{ "gold", 0x00d7ff },
|
||||
{ "goldenrod", 0x20a5da },
|
||||
{ "gray", 0x808080 },
|
||||
{ "green", 0x008000 },
|
||||
{ "greenyellow", 0x2fffad },
|
||||
{ "grey", 0x808080 },
|
||||
{ "honeydew", 0xf0fff0 },
|
||||
{ "hotpink", 0xb469ff },
|
||||
{ "indianred", 0x5c5ccd },
|
||||
{ "indigo", 0x82004b },
|
||||
{ "ivory", 0xf0ffff },
|
||||
{ "khaki", 0x8ce6f0 },
|
||||
{ "lavender", 0xfae6e6 },
|
||||
{ "lavenderblush", 0xf5f0ff },
|
||||
{ "lawngreen", 0x00fc7c },
|
||||
{ "lemonchiffon", 0xcdfaff },
|
||||
{ "lightblue", 0xe6d8ad },
|
||||
{ "lightcoral", 0x8080f0 },
|
||||
{ "lightcyan", 0xffffe0 },
|
||||
{ "lightgoldenrodyellow", 0xd2fafa },
|
||||
{ "lightgray", 0xd3d3d3 },
|
||||
{ "lightgreen", 0x90ee90 },
|
||||
{ "lightgrey", 0xd3d3d3 },
|
||||
{ "lightpink", 0xc1b6ff },
|
||||
{ "lightsalmon", 0x7aa0ff },
|
||||
{ "lightseagreen", 0xaab220 },
|
||||
{ "lightskyblue", 0xface87 },
|
||||
{ "lightslateblue", 0xff7084 }, /* not SVG-1.0*/
|
||||
{ "lightslategray", 0x998877 },
|
||||
{ "lightslategrey", 0x998877 },
|
||||
{ "lightsteelblue", 0xdec4b0 },
|
||||
{ "lightyellow", 0xe0ffff },
|
||||
{ "lime", 0x00ff00 },
|
||||
{ "limegreen", 0x32cd32 },
|
||||
{ "linen", 0xe6f0fa },
|
||||
{ "magenta", 0xff00ff },
|
||||
{ "maroon", 0x000080 },
|
||||
{ "mediumaquamarine", 0xaacd66 },
|
||||
{ "mediumblue", 0xcd0000 },
|
||||
{ "mediumorchid", 0xd355ba },
|
||||
{ "mediumpurple", 0xdb7093 },
|
||||
{ "mediumseagreen", 0x71b33c },
|
||||
{ "mediumslateblue", 0xee687b },
|
||||
{ "mediumspringgreen", 0x9afa00 },
|
||||
{ "mediumturquoise", 0xccd148 },
|
||||
{ "mediumvioletred", 0x8515c7 },
|
||||
{ "midnightblue", 0x701919 },
|
||||
{ "mintcream", 0xfafff5 },
|
||||
{ "mistyrose", 0xe1e4ff },
|
||||
{ "moccasin", 0xb5e4ff },
|
||||
{ "navajowhite", 0xadedff },
|
||||
{ "navy", 0x800000 },
|
||||
{ "oldlace", 0xe6f5fd },
|
||||
{ "olive", 0x008080 },
|
||||
{ "olivedrab", 0x238e6b },
|
||||
{ "orange", 0x00a5ff },
|
||||
{ "orangered", 0x0045ff },
|
||||
{ "orchid", 0xd670da },
|
||||
{ "palegoldenrod", 0xaae8ee },
|
||||
{ "palegreen", 0x98fb98 },
|
||||
{ "paleturquoise", 0xeeeeaf },
|
||||
{ "palevioletred", 0x9370db },
|
||||
{ "papayawhip", 0xd5efff },
|
||||
{ "peachpuff", 0xb9daff },
|
||||
{ "peru", 0x3f85cd },
|
||||
{ "pink", 0xcbc0ff },
|
||||
{ "plum", 0xdda0dd },
|
||||
{ "powderblue", 0xe6e0b0 },
|
||||
{ "purple", 0x800080 },
|
||||
{ "red", 0x0000ff },
|
||||
{ "rosybrown", 0x8f8fbc },
|
||||
{ "royalblue", 0xe16941 },
|
||||
{ "saddlebrown", 0x13458b },
|
||||
{ "salmon", 0x7280fa },
|
||||
{ "sandybrown", 0x60a4f4 },
|
||||
{ "seagreen", 0x578b2e },
|
||||
{ "seashell", 0xeef5ff },
|
||||
{ "sienna", 0x2d52a0 },
|
||||
{ "silver", 0xc0c0c0 },
|
||||
{ "skyblue", 0xebce87 },
|
||||
{ "slateblue", 0xcd5a6a },
|
||||
{ "slategray", 0x908070 },
|
||||
{ "slategrey", 0x908070 },
|
||||
{ "snow", 0xfafaff },
|
||||
{ "springgreen", 0x7fff00 },
|
||||
{ "steelblue", 0xb48246 },
|
||||
{ "tan", 0x8cb4d2 },
|
||||
{ "teal", 0x808000 },
|
||||
{ "thistle", 0xd8bfd8 },
|
||||
{ "tomato", 0x4763ff },
|
||||
{ "transparent", TRANSPARENT },
|
||||
{ "turquoise", 0xd0e040 },
|
||||
{ "violet", 0xee82ee },
|
||||
{ "violetred", 0x9020d0 }, /* not SVG-1.0*/
|
||||
{ "wheat", 0xb3def5 },
|
||||
{ "white", 0xffffff },
|
||||
{ "whitesmoke", 0xf5f5f5 },
|
||||
{ "yellow", 0x00ffff },
|
||||
{ "yellowgreen", 0x32cd9a },
|
||||
};
|
||||
|
||||
|
||||
|
@ -523,7 +656,7 @@ colour parse_colour(const struct css_node * const v)
|
|||
colour c = CSS_COLOR_NONE;
|
||||
unsigned int r, g, b;
|
||||
struct css_colour_entry *col;
|
||||
char colour_name[12];
|
||||
char colour_name[21];
|
||||
|
||||
switch (v->type) {
|
||||
case CSS_NODE_HASH:
|
||||
|
@ -543,7 +676,7 @@ colour parse_colour(const struct css_node * const v)
|
|||
break;
|
||||
|
||||
case CSS_NODE_IDENT:
|
||||
if (11 < v->data_length)
|
||||
if (20 < v->data_length)
|
||||
break;
|
||||
strncpy(colour_name, v->data, v->data_length);
|
||||
colour_name[v->data_length] = 0;
|
||||
|
|
Loading…
Reference in New Issue