gtk-css-engine r123 - in trunk: . libccd/ccd



Author: robsta
Date: Tue Sep 23 11:40:48 2008
New Revision: 123
URL: http://svn.gnome.org/viewvc/gtk-css-engine?rev=123&view=rev

Log:
* libccd/ccd/Makefile.am:
* libccd/ccd/ccd-background.c:
* libccd/ccd/ccd-background.h:
* libccd/ccd/ccd-block.c:
* libccd/ccd/ccd-block.h:
* libccd/ccd/ccd-border.c:
* libccd/ccd/ccd-border.h:
* libccd/ccd/ccd-color.c:
* libccd/ccd/ccd-color.h:
* libccd/ccd/ccd-parser.c:
* libccd/ccd/ccd-selector.c:
* libccd/ccd/ccd-style.c:
* libccd/ccd/ccd-style.h:
* libccd/ccd/ccd.h:
Make `color' a css property of its own.


Added:
   trunk/libccd/ccd/ccd-color.c
   trunk/libccd/ccd/ccd-color.h
Removed:
   trunk/libccd/ccd/ccd-tinge.c
   trunk/libccd/ccd/ccd-tinge.h
Modified:
   trunk/   (props changed)
   trunk/ChangeLog
   trunk/libccd/ccd/Makefile.am
   trunk/libccd/ccd/ccd-background.c
   trunk/libccd/ccd/ccd-background.h
   trunk/libccd/ccd/ccd-block.c
   trunk/libccd/ccd/ccd-block.h
   trunk/libccd/ccd/ccd-border.c
   trunk/libccd/ccd/ccd-border.h
   trunk/libccd/ccd/ccd-parser.c
   trunk/libccd/ccd/ccd-selector.c
   trunk/libccd/ccd/ccd-style.c
   trunk/libccd/ccd/ccd-style.h
   trunk/libccd/ccd/ccd.h

Modified: trunk/libccd/ccd/Makefile.am
==============================================================================
--- trunk/libccd/ccd/Makefile.am	(original)
+++ trunk/libccd/ccd/Makefile.am	Tue Sep 23 11:40:48 2008
@@ -16,7 +16,7 @@
 	ccd-background.h \
 	ccd-block.h \
 	ccd-border.h \
-	ccd-tinge.h \
+	ccd-color.h \
 	ccd-features.h \
 	ccd-function.h \
 	ccd.h \
@@ -43,8 +43,8 @@
 	ccd-block.h \
 	ccd-border.c \
 	ccd-border.h \
-	ccd-tinge.c \
-	ccd-tinge.h \
+	ccd-color.c \
+	ccd-color.h \
 	ccd-features.h \
 	ccd-function.c \
 	ccd-function.h \

Modified: trunk/libccd/ccd/ccd-background.c
==============================================================================
--- trunk/libccd/ccd/ccd-background.c	(original)
+++ trunk/libccd/ccd/ccd-background.c	Tue Sep 23 11:40:48 2008
@@ -79,18 +79,6 @@
 }
 
 static bool
-bg_color_parse (ccd_background_color_t	 *self,
-		CRTerm const		**values)
-{
-	if (!*values) {
-		return false;
-	}
-
-	self->spec = ccd_tinge_parse (&self->color, values);
-	return self->spec == CCD_PROPERTY_SPEC_SET;
-}
-
-static bool
 bg_image_parse (ccd_background_image_t	 *self,
 		CRTerm const		**values)
 {
@@ -235,7 +223,7 @@
 
 		/* TODO: also support `background-size' here, but let's stick
 		 * to CSS2 for now. */
-		ret = bg_color_parse (&self->bg_color, &values);
+		ret = ccd_color_parse (&self->bg_color, &values);
 		if (ret && values == NULL)
 			return true;
 		else if (!ret)
@@ -273,7 +261,7 @@
 
 	if (0 == strcmp ("background-color", property)) {
 
-		return bg_color_parse (&self->bg_color, &values);
+		return ccd_color_parse (&self->bg_color, &values);
 	}
 
 	if (0 == strcmp ("background-image", property)) {
@@ -422,7 +410,7 @@
  **/
 void
 ccd_background_fill (ccd_background_attachment_t const	*bg_attachment, 
-		     ccd_background_color_t const	*bg_color,
+		     ccd_color_t const			*bg_color,
 		     ccd_background_image_t const	*bg_image,
 		     ccd_background_position_t const	*bg_position,
 		     ccd_background_repeat_t const	*bg_repeat,
@@ -448,9 +436,9 @@
 
 	if (ccd_property_is_set (bg_color->spec)) {
 
-		cairo_set_source_rgb (cr, bg_color->color.red, 
-					  bg_color->color.green, 
-					  bg_color->color.blue);
+		cairo_set_source_rgb (cr, bg_color->red, 
+					  bg_color->green, 
+					  bg_color->blue);
 		cairo_fill_preserve (cr);
 	}
 
@@ -518,18 +506,6 @@
 			break;
 		}
 
-/*
-		dx = (double) width / bg_image->image.width;
-		dy = (double) height / bg_image->image.height;
-		cairo_scale (cr, dx, dy);
-
-		cairo_pattern_set_extend (bg_image->image.pattern,
-					  CAIRO_EXTEND_PAD);
-
-		cairo_set_source (cr, bg_image->image.pattern);
-		cairo_fill_preserve (cr);
-*/
-
 		status = cairo_status (cr);
 		if (status != CAIRO_STATUS_SUCCESS) {
 			g_warning (cairo_status_to_string (status));
@@ -545,7 +521,7 @@
 ccd_background_dump (ccd_background_t const *self)
 {
 	printf (CCD_PROPERTY_DUMP_PREFIX "background-color: ");
-	ccd_background_color_dump (&self->bg_color);
+	ccd_color_dump (&self->bg_color);
 	printf (";\n");
 
 	printf (CCD_PROPERTY_DUMP_PREFIX "background-image: ");
@@ -553,22 +529,7 @@
 	printf (";\n");
 }
 
-void
-ccd_background_color_dump (ccd_background_color_t const *self)
-{
-	switch (self->spec) {
-	case CCD_PROPERTY_SPEC_UNSET:
-	case CCD_PROPERTY_SPEC_NONE:
-		ccd_property_spec_dump (self->spec);
-		break;
-	case CCD_PROPERTY_SPEC_INHERIT:
-		ccd_property_spec_dump (self->spec);
-		/* fall thru */
-	case CCD_PROPERTY_SPEC_SET:
-		ccd_tinge_dump (&self->color);
-		break;
-	}
-}
+// TODO dump functions
 
 void
 ccd_background_image_dump (ccd_background_image_t const *self)

Modified: trunk/libccd/ccd/ccd-background.h
==============================================================================
--- trunk/libccd/ccd/ccd-background.h	(original)
+++ trunk/libccd/ccd/ccd-background.h	Tue Sep 23 11:40:48 2008
@@ -26,10 +26,10 @@
 #include <glib.h>
 #include <libcroco/libcroco.h>
 #include <ccd/ccd-features.h>
+#include <ccd/ccd-color.h>
 #include <ccd/ccd-image.h>
 #include <ccd/ccd-position.h>
 #include <ccd/ccd-property.h>
-#include <ccd/ccd-tinge.h>
 
 G_BEGIN_DECLS
 
@@ -43,11 +43,6 @@
 
 typedef struct {
 	ccd_property_spec_t	spec;
-	ccd_tinge_t		color;
-} ccd_background_color_t;
-
-typedef struct {
-	ccd_property_spec_t	spec;
 	ccd_image_t		image;
 } ccd_background_image_t;
 
@@ -75,7 +70,7 @@
 
 typedef struct {
 	ccd_background_attachment_t	bg_attachment;
-	ccd_background_color_t		bg_color;
+	ccd_color_t			bg_color;
 	ccd_background_image_t		bg_image;
 	ccd_background_position_t	bg_position;
 	ccd_background_repeat_t		bg_repeat;
@@ -89,7 +84,7 @@
 			   CRTerm const *values);
 
 void ccd_background_fill (ccd_background_attachment_t const *bg_attachment, 
-			  ccd_background_color_t const *bg_color,
+			  ccd_color_t const *bg_color,
 			  ccd_background_image_t const *bg_image,
 			  ccd_background_position_t const *bg_position,
 			  ccd_background_repeat_t const *bg_repeat,
@@ -99,7 +94,6 @@
 
 #ifdef CCD_DEBUG
 void ccd_background_dump	(ccd_background_t const *self);
-void ccd_background_color_dump	(ccd_background_color_t const *self);
 void ccd_background_image_dump	(ccd_background_image_t const *self);
 #endif
 

Modified: trunk/libccd/ccd/ccd-block.c
==============================================================================
--- trunk/libccd/ccd/ccd-block.c	(original)
+++ trunk/libccd/ccd/ccd-block.c	Tue Sep 23 11:40:48 2008
@@ -44,6 +44,7 @@
 {
 	ccd_background_dump (&self->background);
 	ccd_border_dump (&self->border);
+	ccd_color_dump (&self->color);
 }
 
 #endif /* CCD_DEBUG */

Modified: trunk/libccd/ccd/ccd-block.h
==============================================================================
--- trunk/libccd/ccd/ccd-block.h	(original)
+++ trunk/libccd/ccd/ccd-block.h	Tue Sep 23 11:40:48 2008
@@ -23,7 +23,7 @@
 #include <glib.h>
 #include <cairo.h>
 #include <ccd/ccd-features.h>
-#include <ccd/ccd-tinge.h>
+#include <ccd/ccd-color.h>
 #include <ccd/ccd-background.h>
 #include <ccd/ccd-border.h>
 #include <ccd/ccd-property.h>
@@ -34,8 +34,7 @@
 	/*< private >*/
 	ccd_background_t	background;
 	ccd_border_t		border;
-	ccd_tinge_t		color;
-	ccd_property_spec_t	color_spec;
+	ccd_color_t		color;
 } ccd_block_t;
 
 ccd_block_t *	ccd_block_new	(void);

Modified: trunk/libccd/ccd/ccd-border.c
==============================================================================
--- trunk/libccd/ccd/ccd-border.c	(original)
+++ trunk/libccd/ccd/ccd-border.c	Tue Sep 23 11:40:48 2008
@@ -95,7 +95,7 @@
 	(border_).flags |= CCD_BORDER_FLAGS_COMMON_COLOR;	       \
 }								       \
 if (spec_ != CCD_PROPERTY_SPEC_UNSET) {				       \
-	(border_).color_spec = spec_;				       \
+	(border_).color.spec = spec_;				       \
 }
 
 #define SET_SPECIFIC_COLOR(spec_, border_, val_)		       \
@@ -106,7 +106,7 @@
 	(border_).flags |= CCD_BORDER_FLAGS_SPECIFIC_COLOR;	       \
 }								       \
 if (spec_ != CCD_PROPERTY_SPEC_UNSET) {				       \
-	(border_).color_spec = spec_;				       \
+	(border_).color.spec = spec_;				       \
 }
 
 #define SET_COMMON_RADIUS(spec_, join_, val_)			       \
@@ -241,21 +241,11 @@
 
 static ccd_property_spec_t
 parse_color (CRTerm const		**value,
-	     ccd_tinge_t		 *color)
+	     ccd_color_t		 *color)
 {
-	ccd_property_spec_t spec;
+	ccd_color_parse (color, value);
 
-	spec = ccd_property_parse_spec (value);
-	color->red = color->green = color->blue = 0;
-	if (CCD_PROPERTY_SPEC_SET == spec &&
-	    *value &&
-	    ccd_tinge_parse (color, value)) {
-
-		/* iter is advanced by ccd_tinge_parse() */
-		spec = CCD_PROPERTY_SPEC_SET;
-	}
-
-	return spec;
+	return color->spec;
 }
 
 static ccd_property_spec_t
@@ -285,7 +275,7 @@
 	ccd_property_spec_t	 spec;
 	double			 width;
 	ccd_border_style_type_t	 style;
-	ccd_tinge_t		 color;
+	ccd_color_t		 color;
 
 	if (0 == strcmp ("width", property)) {
 
@@ -328,10 +318,9 @@
 	double			 radius;
 	double			 width;
 	ccd_border_style_type_t	 style;
-	ccd_tinge_t		 color;
+	ccd_color_t		 color;
 	ccd_property_spec_t	 radius_spec;
 	ccd_property_spec_t	 width_spec;
-	ccd_property_spec_t	 color_spec;
 	ccd_property_spec_t	 style_spec;
 
 	/* Radius */
@@ -433,10 +422,9 @@
 	width_spec = parse_width (&iter, &width);
 	if (CCD_PROPERTY_SPEC_NONE == width_spec && !iter) {
 		style_spec = CCD_PROPERTY_SPEC_NONE;
-		color_spec = CCD_PROPERTY_SPEC_NONE;
 	} else {
 		style_spec = parse_style (&iter, &style);
-		color_spec = parse_color (&iter, &color);
+		parse_color (&iter, &color);
 	}
 
 	if (0 == strcmp ("border", property)) {
@@ -451,34 +439,34 @@
 		SET_COMMON_STYLE (style_spec, self->right, style);
 		SET_COMMON_STYLE (style_spec, self->bottom, style);
 		
-		SET_COMMON_COLOR (color_spec, self->left, color);
-		SET_COMMON_COLOR (color_spec, self->top, color);
-		SET_COMMON_COLOR (color_spec, self->right, color);
-		SET_COMMON_COLOR (color_spec, self->bottom, color);
+		SET_COMMON_COLOR (color.spec, self->left, color);
+		SET_COMMON_COLOR (color.spec, self->top, color);
+		SET_COMMON_COLOR (color.spec, self->right, color);
+		SET_COMMON_COLOR (color.spec, self->bottom, color);
 
 	} else if (0 == strcmp ("border-left", property)) {
 
 		SET_SPECIFIC_WIDTH (width_spec, self->left, width);
 		SET_SPECIFIC_STYLE (style_spec, self->left, style);
-		SET_SPECIFIC_COLOR (color_spec, self->left, color);
+		SET_SPECIFIC_COLOR (color.spec, self->left, color);
 
 	} else if (0 == strcmp ("border-top", property)) {
 
 		SET_SPECIFIC_WIDTH (width_spec, self->top, width);
 		SET_SPECIFIC_STYLE (style_spec, self->top, style);
-		SET_SPECIFIC_COLOR (color_spec, self->top, color);
+		SET_SPECIFIC_COLOR (color.spec, self->top, color);
 
 	} else if (0 == strcmp ("border-right", property)) {
 
 		SET_SPECIFIC_WIDTH (width_spec, self->right, width);
 		SET_SPECIFIC_STYLE (style_spec, self->right, style);
-		SET_SPECIFIC_COLOR (color_spec, self->right, color);
+		SET_SPECIFIC_COLOR (color.spec, self->right, color);
 
 	} else if (0 == strcmp ("border-bottom", property)) {
 
 		SET_SPECIFIC_WIDTH (width_spec, self->bottom, width);
 		SET_SPECIFIC_STYLE (style_spec, self->bottom, style);
-		SET_SPECIFIC_COLOR (color_spec, self->bottom, color);
+		SET_SPECIFIC_COLOR (color.spec, self->bottom, color);
 
 	} else {
 		return false;
@@ -954,9 +942,7 @@
 		printf ("%s ", lookup_name (self->style));
 	}
 
-	if (self->color_spec != CCD_PROPERTY_SPEC_UNSET) {
-		ccd_tinge_dump (&self->color);
-	}
+	ccd_color_dump (&self->color);
 
 	printf (";\n");
 }

Modified: trunk/libccd/ccd/ccd-border.h
==============================================================================
--- trunk/libccd/ccd/ccd-border.h	(original)
+++ trunk/libccd/ccd/ccd-border.h	Tue Sep 23 11:40:48 2008
@@ -25,7 +25,7 @@
 #include <cairo.h>
 #include <glib.h>
 #include <ccd/ccd-features.h>
-#include <ccd/ccd-tinge.h>
+#include <ccd/ccd-color.h>
 #include <ccd/ccd-property.h>
 
 G_BEGIN_DECLS
@@ -59,7 +59,7 @@
 #define CCD_BORDER_STROKE_IS_SET(stroke_) 			\
 	((stroke_).width_spec != CCD_PROPERTY_SPEC_UNSET &&	\
 	 (stroke_).style_spec != CCD_PROPERTY_SPEC_UNSET &&	\
-	 (stroke_).color_spec != CCD_PROPERTY_SPEC_UNSET)
+	 (stroke_).color.spec != CCD_PROPERTY_SPEC_UNSET)
 
 #define CCD_BORDER_STROKE_ASSIGN(lhs_, rhs_) {			\
 	(lhs_).width		= (rhs_).width;			\
@@ -67,7 +67,6 @@
 	(lhs_).style		= (rhs_).style;			\
 	(lhs_).style_spec	= (rhs_).style_spec;		\
 	(lhs_).color		= (rhs_).color;			\
-	(lhs_).color_spec	= (rhs_).color_spec;		\
 	(lhs_).flags		= (rhs_).flags;			\
 }
 
@@ -76,8 +75,7 @@
 	ccd_property_spec_t	width_spec;
 	ccd_border_style_type_t	style;
 	ccd_property_spec_t	style_spec;
-	ccd_tinge_t		color;
-	ccd_property_spec_t	color_spec;
+	ccd_color_t		color;
 	unsigned int		flags;
 } ccd_border_stroke_t; 
 

Added: trunk/libccd/ccd/ccd-color.c
==============================================================================
--- (empty file)
+++ trunk/libccd/ccd/ccd-color.c	Tue Sep 23 11:40:48 2008
@@ -0,0 +1,341 @@
+/* The Cairo CSS Drawing Library.
+ * Copyright (C) 2008 Robert Staudinger
+ *
+ * Functions parse_hex() and  hex() were derived from pango-1.21.3,
+ * Copyright (C) 2000  Red Hat Software, License:  LGPL 2 or later.
+ *
+ * This  library is free  software; you can  redistribute it and/or
+ * modify it  under  the terms  of the  GNU Lesser  General  Public
+ * License  as published  by the Free  Software  Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed  in the hope that it will be useful,
+ * but  WITHOUT ANY WARRANTY; without even  the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License  along  with  this library;  if not,  write to  the Free
+ * Software Foundation, Inc., 51  Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+#include "ccd-color.h"
+
+static const struct {
+	char const		*name;
+	const ccd_color_t	color;
+} _color_map[] = {
+  { "aliceblue",		{ CCD_PROPERTY_SPEC_SET, 0xf0/255., 0xf8/255., 0xff/255. } },
+  { "antiquewhite",		{ CCD_PROPERTY_SPEC_SET, 0xfa/255., 0xeb/255., 0xd7/255. } },
+  { "aqua",			{ CCD_PROPERTY_SPEC_SET, 0x00/255., 0xff/255., 0xff/255. } },
+  { "aquamarine",		{ CCD_PROPERTY_SPEC_SET, 0x7f/255., 0xff/255., 0xd4/255. } },
+  { "azure",			{ CCD_PROPERTY_SPEC_SET, 0xf0/255., 0xff/255., 0xff/255. } },
+  { "beige",			{ CCD_PROPERTY_SPEC_SET, 0xf5/255., 0xf5/255., 0xdc/255. } },
+  { "bisque",			{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xe4/255., 0xc4/255. } },
+  { "black",			{ CCD_PROPERTY_SPEC_SET, 0x00/255., 0x00/255., 0x00/255. } },
+  { "blanchedalmond",		{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xeb/255., 0xcd/255. } },
+  { "blue",			{ CCD_PROPERTY_SPEC_SET, 0x00/255., 0x00/255., 0xff/255. } },
+  { "blueviolet",		{ CCD_PROPERTY_SPEC_SET, 0x8a/255., 0x2b/255., 0xe2/255. } },
+  { "brown",			{ CCD_PROPERTY_SPEC_SET, 0xa5/255., 0x2a/255., 0x2a/255. } },
+  { "burlywood",		{ CCD_PROPERTY_SPEC_SET, 0xde/255., 0xb8/255., 0x87/255. } },
+  { "cadetblue",		{ CCD_PROPERTY_SPEC_SET, 0x5f/255., 0x9e/255., 0xa0/255. } },
+  { "chartreuse",		{ CCD_PROPERTY_SPEC_SET, 0x7f/255., 0xff/255., 0x00/255. } },
+  { "chocolate",		{ CCD_PROPERTY_SPEC_SET, 0xd2/255., 0x69/255., 0x1e/255. } },
+  { "coral",			{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0x7f/255., 0x50/255. } },
+  { "cornflowerblue",		{ CCD_PROPERTY_SPEC_SET, 0x64/255., 0x95/255., 0xed/255. } },
+  { "cornsilk",			{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xf8/255., 0xdc/255. } },
+  { "crimson",			{ CCD_PROPERTY_SPEC_SET, 0xdc/255., 0x14/255., 0x3c/255. } },
+  { "cyan",			{ CCD_PROPERTY_SPEC_SET, 0x00/255., 0xff/255., 0xff/255. } },
+  { "darkblue",			{ CCD_PROPERTY_SPEC_SET, 0x00/255., 0x00/255., 0x8b/255. } },
+  { "darkcyan",			{ CCD_PROPERTY_SPEC_SET, 0x00/255., 0x8b/255., 0x8b/255. } },
+  { "darkgoldenrod",		{ CCD_PROPERTY_SPEC_SET, 0xb8/255., 0x86/255., 0x0b/255. } },
+  { "darkgray",			{ CCD_PROPERTY_SPEC_SET, 0xa9/255., 0xa9/255., 0xa9/255. } },
+  { "darkgrey",			{ CCD_PROPERTY_SPEC_SET, 0xa9/255., 0xa9/255., 0xa9/255. } },
+  { "darkgreen",		{ CCD_PROPERTY_SPEC_SET, 0x00/255., 0x64/255., 0x00/255. } },
+  { "darkkhaki",		{ CCD_PROPERTY_SPEC_SET, 0xbd/255., 0xb7/255., 0x6b/255. } },
+  { "darkmagenta",		{ CCD_PROPERTY_SPEC_SET, 0x8b/255., 0x00/255., 0x8b/255. } },
+  { "darkolivegreen",		{ CCD_PROPERTY_SPEC_SET, 0x55/255., 0x6b/255., 0x2f/255. } },
+  { "darkorange",		{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0x8c/255., 0x00/255. } },
+  { "darkorchid",		{ CCD_PROPERTY_SPEC_SET, 0x99/255., 0x32/255., 0xcc/255. } },
+  { "darkred",			{ CCD_PROPERTY_SPEC_SET, 0x8b/255., 0x00/255., 0x00/255. } },
+  { "darksalmon",		{ CCD_PROPERTY_SPEC_SET, 0xe9/255., 0x96/255., 0x7a/255. } },
+  { "darkseagreen",		{ CCD_PROPERTY_SPEC_SET, 0x8f/255., 0xbc/255., 0x8f/255. } },
+  { "darkslateblue",		{ CCD_PROPERTY_SPEC_SET, 0x48/255., 0x3d/255., 0x8b/255. } },
+  { "darkslategray",		{ CCD_PROPERTY_SPEC_SET, 0x2f/255., 0x4f/255., 0x4f/255. } },
+  { "darkslategrey",		{ CCD_PROPERTY_SPEC_SET, 0x2f/255., 0x4f/255., 0x4f/255. } },
+  { "darkturquoise",		{ CCD_PROPERTY_SPEC_SET, 0x00/255., 0xce/255., 0xd1/255. } },
+  { "darkviolet",		{ CCD_PROPERTY_SPEC_SET, 0x94/255., 0x00/255., 0xd3/255. } },
+  { "deeppink",			{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0x14/255., 0x93/255. } },
+  { "deepskyblue",		{ CCD_PROPERTY_SPEC_SET, 0x00/255., 0xbf/255., 0xff/255. } },
+  { "dimgray",			{ CCD_PROPERTY_SPEC_SET, 0x69/255., 0x69/255., 0x69/255. } },
+  { "dimgrey",			{ CCD_PROPERTY_SPEC_SET, 0x69/255., 0x69/255., 0x69/255. } },
+  { "dodgerblue",		{ CCD_PROPERTY_SPEC_SET, 0x1e/255., 0x90/255., 0xff/255. } },
+  { "firebrick",		{ CCD_PROPERTY_SPEC_SET, 0xb2/255., 0x22/255., 0x22/255. } },
+  { "floralwhite",		{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xfa/255., 0xf0/255. } },
+  { "forestgreen",		{ CCD_PROPERTY_SPEC_SET, 0x22/255., 0x8b/255., 0x22/255. } },
+  { "fuchsia",			{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0x00/255., 0xff/255. } },
+  { "gainsboro",		{ CCD_PROPERTY_SPEC_SET, 0xdc/255., 0xdc/255., 0xdc/255. } },
+  { "ghostwhite",		{ CCD_PROPERTY_SPEC_SET, 0xf8/255., 0xf8/255., 0xff/255. } },
+  { "gold",			{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xd7/255., 0x00/255. } },
+  { "goldenrod",		{ CCD_PROPERTY_SPEC_SET, 0xda/255., 0xa5/255., 0x20/255. } },
+  { "gray",			{ CCD_PROPERTY_SPEC_SET, 0x80/255., 0x80/255., 0x80/255. } },
+  { "grey",			{ CCD_PROPERTY_SPEC_SET, 0x80/255., 0x80/255., 0x80/255. } },
+  { "green",			{ CCD_PROPERTY_SPEC_SET, 0x00/255., 0x80/255., 0x00/255. } },
+  { "greenyellow",		{ CCD_PROPERTY_SPEC_SET, 0xad/255., 0xff/255., 0x2f/255. } },
+  { "honeydew",			{ CCD_PROPERTY_SPEC_SET, 0xf0/255., 0xff/255., 0xf0/255. } },
+  { "hotpink",			{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0x69/255., 0xb4/255. } },
+  { "indianred",		{ CCD_PROPERTY_SPEC_SET, 0xcd/255., 0x5c/255., 0x5c/255. } },
+  { "indigo",			{ CCD_PROPERTY_SPEC_SET, 0x4b/255., 0x00/255., 0x82/255. } },
+  { "ivory",			{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xff/255., 0xf0/255. } },
+  { "khaki",			{ CCD_PROPERTY_SPEC_SET, 0xf0/255., 0xe6/255., 0x8c/255. } },
+  { "lavender",			{ CCD_PROPERTY_SPEC_SET, 0xe6/255., 0xe6/255., 0xfa/255. } },
+  { "lavenderblush",		{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xf0/255., 0xf5/255. } },
+  { "lawngreen",		{ CCD_PROPERTY_SPEC_SET, 0x7c/255., 0xfc/255., 0x00/255. } },
+  { "lemonchiffon",		{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xfa/255., 0xcd/255. } },
+  { "lightblue",		{ CCD_PROPERTY_SPEC_SET, 0xad/255., 0xd8/255., 0xe6/255. } },
+  { "lightcoral",		{ CCD_PROPERTY_SPEC_SET, 0xf0/255., 0x80/255., 0x80/255. } },
+  { "lightcyan",		{ CCD_PROPERTY_SPEC_SET, 0xe0/255., 0xff/255., 0xff/255. } },
+  { "lightgoldenrodyellow",	{ CCD_PROPERTY_SPEC_SET, 0xfa/255., 0xfa/255., 0xd2/255. } },
+  { "lightgray",		{ CCD_PROPERTY_SPEC_SET, 0xd3/255., 0xd3/255., 0xd3/255. } },
+  { "lightgrey",		{ CCD_PROPERTY_SPEC_SET, 0xd3/255., 0xd3/255., 0xd3/255. } },
+  { "lightgreen",		{ CCD_PROPERTY_SPEC_SET, 0x90/255., 0xee/255., 0x90/255. } },
+  { "lightpink",		{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xb6/255., 0xc1/255. } },
+  { "lightsalmon",		{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xa0/255., 0x7a/255. } },
+  { "lightseagreen",		{ CCD_PROPERTY_SPEC_SET, 0x20/255., 0xb2/255., 0xaa/255. } },
+  { "lightskyblue",		{ CCD_PROPERTY_SPEC_SET, 0x87/255., 0xce/255., 0xfa/255. } },
+  { "lightslategray",		{ CCD_PROPERTY_SPEC_SET, 0x77/255., 0x88/255., 0x99/255. } },
+  { "lightslategrey",		{ CCD_PROPERTY_SPEC_SET, 0x77/255., 0x88/255., 0x99/255. } },
+  { "lightsteelblue",		{ CCD_PROPERTY_SPEC_SET, 0xb0/255., 0xc4/255., 0xde/255. } },
+  { "lightyellow",		{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xff/255., 0xe0/255. } },
+  { "lime",			{ CCD_PROPERTY_SPEC_SET, 0x00/255., 0xff/255., 0x00/255. } },
+  { "limegreen",		{ CCD_PROPERTY_SPEC_SET, 0x32/255., 0xcd/255., 0x32/255. } },
+  { "linen",			{ CCD_PROPERTY_SPEC_SET, 0xfa/255., 0xf0/255., 0xe6/255. } },
+  { "magenta",			{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0x00/255., 0xff/255. } },
+  { "maroon",			{ CCD_PROPERTY_SPEC_SET, 0x80/255., 0x00/255., 0x00/255. } },
+  { "mediumaquamarine",		{ CCD_PROPERTY_SPEC_SET, 0x66/255., 0xcd/255., 0xaa/255. } },
+  { "mediumblue",		{ CCD_PROPERTY_SPEC_SET, 0x00/255., 0x00/255., 0xcd/255. } },
+  { "mediumorchid",		{ CCD_PROPERTY_SPEC_SET, 0xba/255., 0x55/255., 0xd3/255. } },
+  { "mediumpurple",		{ CCD_PROPERTY_SPEC_SET, 0x93/255., 0x70/255., 0xd8/255. } },
+  { "mediumseagreen",		{ CCD_PROPERTY_SPEC_SET, 0x3c/255., 0xb3/255., 0x71/255. } },
+  { "mediumslateblue",		{ CCD_PROPERTY_SPEC_SET, 0x7b/255., 0x68/255., 0xee/255. } },
+  { "mediumspringgreen",	{ CCD_PROPERTY_SPEC_SET, 0x00/255., 0xfa/255., 0x9a/255. } },
+  { "mediumturquoise",		{ CCD_PROPERTY_SPEC_SET, 0x48/255., 0xd1/255., 0xcc/255. } },
+  { "mediumvioletred",		{ CCD_PROPERTY_SPEC_SET, 0xc7/255., 0x15/255., 0x85/255. } },
+  { "midnightblue",		{ CCD_PROPERTY_SPEC_SET, 0x19/255., 0x19/255., 0x70/255. } },
+  { "mintcream",		{ CCD_PROPERTY_SPEC_SET, 0xf5/255., 0xff/255., 0xfa/255. } },
+  { "mistyrose",		{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xe4/255., 0xe1/255. } },
+  { "moccasin",			{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xe4/255., 0xb5/255. } },
+  { "navajowhite",		{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xde/255., 0xad/255. } },
+  { "navy",			{ CCD_PROPERTY_SPEC_SET, 0x00/255., 0x00/255., 0x80/255. } },
+  { "oldlace",			{ CCD_PROPERTY_SPEC_SET, 0xfd/255., 0xf5/255., 0xe6/255. } },
+  { "olive",			{ CCD_PROPERTY_SPEC_SET, 0x80/255., 0x80/255., 0x00/255. } },
+  { "olivedrab",		{ CCD_PROPERTY_SPEC_SET, 0x6b/255., 0x8e/255., 0x23/255. } },
+  { "orange",			{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xa5/255., 0x00/255. } },
+  { "orangered",		{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0x45/255., 0x00/255. } },
+  { "orchid",			{ CCD_PROPERTY_SPEC_SET, 0xda/255., 0x70/255., 0xd6/255. } },
+  { "palegoldenrod",		{ CCD_PROPERTY_SPEC_SET, 0xee/255., 0xe8/255., 0xaa/255. } },
+  { "palegreen",		{ CCD_PROPERTY_SPEC_SET, 0x98/255., 0xfb/255., 0x98/255. } },
+  { "paleturquoise",		{ CCD_PROPERTY_SPEC_SET, 0xaf/255., 0xee/255., 0xee/255. } },
+  { "palevioletred",		{ CCD_PROPERTY_SPEC_SET, 0xd8/255., 0x70/255., 0x93/255. } },
+  { "papayawhip",		{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xef/255., 0xd5/255. } },
+  { "peachpuff",		{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xda/255., 0xb9/255. } },
+  { "peru",			{ CCD_PROPERTY_SPEC_SET, 0xcd/255., 0x85/255., 0x3f/255. } },
+  { "pink",			{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xc0/255., 0xcb/255. } },
+  { "plum",			{ CCD_PROPERTY_SPEC_SET, 0xdd/255., 0xa0/255., 0xdd/255. } },
+  { "powderblue",		{ CCD_PROPERTY_SPEC_SET, 0xb0/255., 0xe0/255., 0xe6/255. } },
+  { "purple",			{ CCD_PROPERTY_SPEC_SET, 0x80/255., 0x00/255., 0x80/255. } },
+  { "red",			{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0x00/255., 0x00/255. } },
+  { "rosybrown",		{ CCD_PROPERTY_SPEC_SET, 0xbc/255., 0x8f/255., 0x8f/255. } },
+  { "royalblue",		{ CCD_PROPERTY_SPEC_SET, 0x41/255., 0x69/255., 0xe1/255. } },
+  { "saddlebrown",		{ CCD_PROPERTY_SPEC_SET, 0x8b/255., 0x45/255., 0x13/255. } },
+  { "salmon",			{ CCD_PROPERTY_SPEC_SET, 0xfa/255., 0x80/255., 0x72/255. } },
+  { "sandybrown",		{ CCD_PROPERTY_SPEC_SET, 0xf4/255., 0xa4/255., 0x60/255. } },
+  { "seagreen",			{ CCD_PROPERTY_SPEC_SET, 0x2e/255., 0x8b/255., 0x57/255. } },
+  { "seashell",			{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xf5/255., 0xee/255. } },
+  { "sienna",			{ CCD_PROPERTY_SPEC_SET, 0xa0/255., 0x52/255., 0x2d/255. } },
+  { "silver",			{ CCD_PROPERTY_SPEC_SET, 0xc0/255., 0xc0/255., 0xc0/255. } },
+  { "skyblue",			{ CCD_PROPERTY_SPEC_SET, 0x87/255., 0xce/255., 0xeb/255. } },
+  { "slateblue",		{ CCD_PROPERTY_SPEC_SET, 0x6a/255., 0x5a/255., 0xcd/255. } },
+  { "slategray",		{ CCD_PROPERTY_SPEC_SET, 0x70/255., 0x80/255., 0x90/255. } },
+  { "slategrey",		{ CCD_PROPERTY_SPEC_SET, 0x70/255., 0x80/255., 0x90/255. } },
+  { "snow",			{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xfa/255., 0xfa/255. } },
+  { "springgreen",		{ CCD_PROPERTY_SPEC_SET, 0x00/255., 0xff/255., 0x7f/255. } },
+  { "steelblue",		{ CCD_PROPERTY_SPEC_SET, 0x46/255., 0x82/255., 0xb4/255. } },
+  { "tan",			{ CCD_PROPERTY_SPEC_SET, 0xd2/255., 0xb4/255., 0x8c/255. } },
+  { "teal",			{ CCD_PROPERTY_SPEC_SET, 0x00/255., 0x80/255., 0x80/255. } },
+  { "thistle",			{ CCD_PROPERTY_SPEC_SET, 0xd8/255., 0xbf/255., 0xd8/255. } },
+  { "tomato",			{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0x63/255., 0x47/255. } },
+  { "turquoise",		{ CCD_PROPERTY_SPEC_SET, 0x40/255., 0xe0/255., 0xd0/255. } },
+  { "violet",			{ CCD_PROPERTY_SPEC_SET, 0xee/255., 0x82/255., 0xee/255. } },
+  { "wheat",			{ CCD_PROPERTY_SPEC_SET, 0xf5/255., 0xde/255., 0xb3/255. } },
+  { "white",			{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xff/255., 0xff/255. } },
+  { "whitesmoke",		{ CCD_PROPERTY_SPEC_SET, 0xf5/255., 0xf5/255., 0xf5/255. } },
+  { "yellow",			{ CCD_PROPERTY_SPEC_SET, 0xff/255., 0xff/255., 0x00/255. } },
+  { "yellowgreen",		{ CCD_PROPERTY_SPEC_SET, 0x9a/255., 0xcd/255., 0x32/255. } },
+};
+
+static bool
+parse_name (ccd_color_t	*self,
+	    char const	*css_color_name)
+{
+	g_return_val_if_fail (css_color_name && self, false);
+
+	for (unsigned int i = 0; i < G_N_ELEMENTS (_color_map); i++) {
+		if (0 == g_ascii_strcasecmp (_color_map[i].name, css_color_name)) {
+			self->red = _color_map[i].color.red;
+			self->green = _color_map[i].color.green;
+			self->blue = _color_map[i].color.blue;
+			return true;
+		}
+	}
+
+	return false;
+}
+
+static gboolean
+hex (char const		*color,
+     int		 len,
+     unsigned int	*c)
+{
+	const char *end;
+
+	*c = 0;
+	for (end = color + len; color != end; color++) {
+		if (g_ascii_isxdigit (*color)) {
+			*c = (*c << 4) | g_ascii_xdigit_value (*color);
+		} else {
+			return false;
+		}
+	}
+
+	return true;
+}
+
+static bool
+parse_hex (ccd_color_t	*self,
+	   char const	*color)
+{
+	size_t		len;
+	unsigned int	r, g, b;
+
+	g_return_val_if_fail (color, false);
+
+	len = strlen (color);
+	if (len % 3 || len < 3 || len > 12)
+		return false;
+
+	len /= 3;
+
+	if (!hex (color, len, &r) ||
+	    !hex (color + len, len, &g) ||
+	    !hex (color + len * 2, len, &b))
+		return false;
+
+	if (self) {
+		int bits = len * 4;
+		r <<= 16 - bits;
+		g <<= 16 - bits;
+		b <<= 16 - bits;
+		while (bits < 16) {
+			r |= (r >> bits);
+			g |= (g >> bits);
+			b |= (b >> bits);
+			bits *= 2;
+		}
+		self->red   = r / 65535.;
+		self->green = g / 65535.;
+		self->blue  = b / 65535.;
+	}
+
+	return true;
+}
+
+static ccd_property_spec_t
+parse (ccd_color_t	 *self,
+       CRTerm	const	**value)
+{
+	ccd_property_spec_t	 type;
+	char const		*str;
+	bool			 ret;
+
+	g_return_val_if_fail (self, CCD_PROPERTY_SPEC_UNSET);
+
+	if (!*value) {
+		return CCD_PROPERTY_SPEC_UNSET;
+	}
+
+	switch ((*value)->type) {
+	case TERM_IDENT:
+		type = ccd_property_parse_spec (value);
+		if (type != CCD_PROPERTY_SPEC_SET) {
+			/* Value already advanced. */
+			return type;
+		}
+		str = cr_string_peek_raw_str ((*value)->content.str);
+		ret = parse_name (self, str);
+		if (ret) {
+			*value = (*value)->next;
+			return CCD_PROPERTY_SPEC_SET;
+		}
+		return CCD_PROPERTY_SPEC_UNSET;
+	case TERM_HASH:
+		str = cr_string_peek_raw_str ((*value)->content.str);
+		ret = parse_hex (self, str);
+		if (ret) {
+			*value = (*value)->next;
+			return CCD_PROPERTY_SPEC_SET;
+		}
+		return CCD_PROPERTY_SPEC_UNSET;
+	case TERM_RGB:
+		self->red = (*value)->content.rgb->red;
+		self->green = (*value)->content.rgb->green;
+		self->blue = (*value)->content.rgb->blue;
+		*value = (*value)->next;
+		return CCD_PROPERTY_SPEC_SET;
+	/* fall thru for all other enum values to prevent compiler warnings */
+	case TERM_NO_TYPE:
+	case TERM_NUMBER:
+	case TERM_FUNCTION:
+	case TERM_STRING:
+	case TERM_URI:
+	case TERM_UNICODERANGE:
+	default:
+		return CCD_PROPERTY_SPEC_UNSET;
+	}
+}
+
+bool
+ccd_color_parse (ccd_color_t	 *self,
+		 CRTerm const	**values)
+{
+	if (!*values) {
+		return false;
+	}
+
+	self->spec = parse (self, values);
+	return self->spec != CCD_PROPERTY_SPEC_UNSET;
+}
+
+#ifdef CCD_DEBUG
+
+void
+ccd_color_dump (ccd_color_t const *self)
+{
+	switch (self->spec) {
+	case CCD_PROPERTY_SPEC_UNSET:
+	case CCD_PROPERTY_SPEC_NONE:
+	case CCD_PROPERTY_SPEC_INHERIT:
+		ccd_property_spec_dump (self->spec);
+		break;
+	case CCD_PROPERTY_SPEC_SET:
+		printf ("rgb(%.3f,%.3f,%.3f)",
+			self->red, self->green, self->blue);
+	}
+}
+
+#endif /* CCD_DEBUG */
+

Added: trunk/libccd/ccd/ccd-color.h
==============================================================================
--- (empty file)
+++ trunk/libccd/ccd/ccd-color.h	Tue Sep 23 11:40:48 2008
@@ -0,0 +1,53 @@
+/* The Cairo CSS Drawing Library.
+ * Copyright (C) 2008 Robert Staudinger
+ *
+ * This  library is free  software; you can  redistribute it and/or
+ * modify it  under  the terms  of the  GNU Lesser  General  Public
+ * License  as published  by the Free  Software  Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed  in the hope that it will be useful,
+ * but  WITHOUT ANY WARRANTY; without even  the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License  along  with  this library;  if not,  write to  the Free
+ * Software Foundation, Inc., 51  Franklin St, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+#ifndef CCD_COLOR_H
+#define CCD_COLOR_H
+
+#include <stdbool.h>
+#include <glib.h>
+#include <libcroco/libcroco.h>
+#include <ccd/ccd-property.h>
+
+G_BEGIN_DECLS
+
+#define CCD_COLOR_ASSIGN(lhs_, rhs_) {		\
+	(lhs_).spec = (rhs_).spec;		\
+	(lhs_).red = (rhs_).red;		\
+	(lhs_).green = (rhs_).green;		\
+	(lhs_).blue = (rhs_).blue;		\
+}
+
+typedef struct {
+	ccd_property_spec_t	spec;
+	double			red;
+	double			green;
+	double			blue;
+} ccd_color_t;
+
+bool ccd_color_parse (ccd_color_t *self, CRTerm const **values);
+
+#ifdef CCD_DEBUG
+void ccd_color_dump (ccd_color_t const *self);
+#endif
+
+G_END_DECLS
+
+#endif /* CCD_COLOR_H */
+

Modified: trunk/libccd/ccd/ccd-parser.c
==============================================================================
--- trunk/libccd/ccd/ccd-parser.c	(original)
+++ trunk/libccd/ccd/ccd-parser.c	Tue Sep 23 11:40:48 2008
@@ -21,11 +21,11 @@
 #include <string.h>
 #include <libcroco/libcroco.h>
 #include "ccd-block.h"
+#include "ccd-color.h"
 #include "ccd-parser.h"
 #include "ccd-property.h"
 #include "ccd-selector.h"
 #include "ccd-selector-group-priv.h"
-#include "ccd-tinge.h"
 
 typedef struct {
 	GSList		*blocks;
@@ -181,8 +181,8 @@
 		   0 == strncmp ("border-", property, sizeof ("border-") - 1)) {
 		ccd_border_parse (&info->block->border, property, values);
 	} else if (0 == strcmp ("color", property)) {
-		info->block->color_spec = ccd_tinge_parse (&info->block->color, 
-							   (CRTerm const **) &values);
+		ccd_color_parse (&info->block->color,
+				 (CRTerm const **) &values);
 	}
 }
 

Modified: trunk/libccd/ccd/ccd-selector.c
==============================================================================
--- trunk/libccd/ccd/ccd-selector.c	(original)
+++ trunk/libccd/ccd/ccd-selector.c	Tue Sep 23 11:40:48 2008
@@ -1014,14 +1014,13 @@
 	if (CCD_BORDER_JOIN_IS_SET (self->block->border.bottom_left))
 		CCD_BORDER_JOIN_ASSIGN (style->bottom_left, self->block->border.bottom_left);
 
-	switch (self->block->color_spec) {
+	switch (self->block->color.spec) {
 	case CCD_PROPERTY_SPEC_UNSET:
 		/* do nothing */
 		break;
 	case CCD_PROPERTY_SPEC_NONE:
 		/* reset */
 		style->color = NULL;
-		style->color_spec = self->block->color_spec;
 		break;
 	case CCD_PROPERTY_SPEC_INHERIT:
 		/* not implemented */
@@ -1030,28 +1029,27 @@
 	case CCD_PROPERTY_SPEC_SET:
 		/* use */
 		style->color = &self->block->color;
-		style->color_spec = self->block->color_spec;
 		break;
 	}
 
 	/* fixup */
 
 	if (style->color) {
-		if (CCD_PROPERTY_SPEC_UNSET == style->left.color_spec) {
+		if (CCD_PROPERTY_SPEC_UNSET == style->left.color.spec) {
 			CCD_COLOR_ASSIGN (style->left.color, *style->color);
-			style->left.color_spec = style->color_spec;
+			style->left.color.spec = style->color->spec;
 		}
-		if (CCD_PROPERTY_SPEC_UNSET == style->top.color_spec) {
+		if (CCD_PROPERTY_SPEC_UNSET == style->top.color.spec) {
 			CCD_COLOR_ASSIGN (style->top.color, *style->color);
-			style->top.color_spec = style->color_spec;
+			style->top.color.spec = style->color->spec;
 		}
-		if (CCD_PROPERTY_SPEC_UNSET == style->right.color_spec) {
+		if (CCD_PROPERTY_SPEC_UNSET == style->right.color.spec) {
 			CCD_COLOR_ASSIGN (style->right.color, *style->color);
-			style->right.color_spec = style->color_spec;
+			style->right.color.spec = style->color->spec;
 		}
-		if (CCD_PROPERTY_SPEC_UNSET == style->bottom.color_spec) {
+		if (CCD_PROPERTY_SPEC_UNSET == style->bottom.color.spec) {
 			CCD_COLOR_ASSIGN (style->bottom.color, *style->color);
-			style->bottom.color_spec = style->color_spec;
+			style->bottom.color.spec = style->color->spec;
 		}
 	}
 

Modified: trunk/libccd/ccd/ccd-style.c
==============================================================================
--- trunk/libccd/ccd/ccd-style.c	(original)
+++ trunk/libccd/ccd/ccd-style.c	Tue Sep 23 11:40:48 2008
@@ -25,9 +25,11 @@
 	.attachment = CCD_BACKGROUND_SCROLL
 };
 
-static const ccd_background_color_t const _bg_color = {
+static const ccd_color_t const _bg_color = {
 	.spec = CCD_PROPERTY_SPEC_SET,
-	.color = { 1., 1., 1. }
+	.red = 1.,
+	.green = 1.,
+	.blue = 1.
 };
 
 static const ccd_background_image_t const _bg_image = {
@@ -51,8 +53,11 @@
 	.height = { CCD_POSITION_AUTO, 0 }
 };
 
-static const ccd_tinge_t const _color = {
-	0., 0., 0.
+static const ccd_color_t const _color = {
+	.spec = CCD_PROPERTY_SPEC_SET,
+	.red = 0.,
+	.green = 0.,
+	.blue = 0.
 };
 
 static const ccd_style_t const _default_style = {
@@ -67,8 +72,7 @@
 		.width_spec = CCD_PROPERTY_SPEC_SET,
 		.style = CCD_BORDER_STYLE_SOLID,
 		.style_spec = CCD_PROPERTY_SPEC_SET,
-		.color = { 0, 0, 0 },
-		.color_spec = CCD_PROPERTY_SPEC_SET },
+		.color = { CCD_PROPERTY_SPEC_SET, 0, 0, 0 } },
 	.left_top = {
 		.radius = 0,
 		.spec = CCD_PROPERTY_SPEC_SET
@@ -78,8 +82,7 @@
 		.width_spec = CCD_PROPERTY_SPEC_SET,
 		.style = CCD_BORDER_STYLE_SOLID,
 		.style_spec = CCD_PROPERTY_SPEC_SET,
-		.color = { 0, 0, 0 },
-		.color_spec = CCD_PROPERTY_SPEC_SET },
+		.color = { CCD_PROPERTY_SPEC_SET, 0, 0, 0 } },
 	.top_right = {
 		.radius = 0,
 		.spec = CCD_PROPERTY_SPEC_SET
@@ -89,8 +92,7 @@
 		.width_spec = CCD_PROPERTY_SPEC_SET,
 		.style = CCD_BORDER_STYLE_SOLID,
 		.style_spec = CCD_PROPERTY_SPEC_SET,
-		.color = { 0, 0, 0 },
-		.color_spec = CCD_PROPERTY_SPEC_SET },
+		.color = { CCD_PROPERTY_SPEC_SET, 0, 0, 0 } },
 	.right_bottom = {
 		.radius = 0,
 		.spec = CCD_PROPERTY_SPEC_SET
@@ -100,14 +102,12 @@
 		.width_spec = CCD_PROPERTY_SPEC_SET,
 		.style = CCD_BORDER_STYLE_SOLID,
 		.style_spec = CCD_PROPERTY_SPEC_SET,
-		.color = { 0, 0, 0 },
-		.color_spec = CCD_PROPERTY_SPEC_SET },
+		.color = { CCD_PROPERTY_SPEC_SET, 0, 0, 0 } },
 	.bottom_left = {
 		.radius = 0,
 		.spec = CCD_PROPERTY_SPEC_SET
 	},
-	.color = &_color,
-	.color_spec = CCD_PROPERTY_SPEC_SET
+	.color = &_color
 };
 
 /**
@@ -255,7 +255,7 @@
 ccd_style_dump (ccd_style_t const *self)
 {
 	if (self->bg_color)
-		ccd_background_color_dump (self->bg_color);
+		ccd_color_dump (self->bg_color);
 	if (self->bg_image)
 		ccd_background_image_dump (self->bg_image);
 	ccd_border_stroke_dump (&self->left);

Modified: trunk/libccd/ccd/ccd-style.h
==============================================================================
--- trunk/libccd/ccd/ccd-style.h	(original)
+++ trunk/libccd/ccd/ccd-style.h	Tue Sep 23 11:40:48 2008
@@ -26,7 +26,7 @@
 #include <ccd/ccd-features.h>
 #include <ccd/ccd-background.h>
 #include <ccd/ccd-border.h>
-#include <ccd/ccd-tinge.h>
+#include <ccd/ccd-color.h>
 #include <ccd/ccd-property.h>
 
 G_BEGIN_DECLS
@@ -42,7 +42,7 @@
 typedef struct {
 	/*< private >*/
 	ccd_background_attachment_t const	*bg_attachment;
-	ccd_background_color_t const		*bg_color;
+	ccd_color_t const			*bg_color;
 	ccd_background_image_t const		*bg_image;
 	ccd_background_position_t const		*bg_position;
 	ccd_background_repeat_t const		*bg_repeat;
@@ -55,8 +55,7 @@
 	ccd_border_join_t			 right_bottom;
 	ccd_border_stroke_t			 bottom;
 	ccd_border_join_t			 bottom_left;
-	ccd_tinge_t const			*color;
-	ccd_property_spec_t			 color_spec;
+	ccd_color_t const			*color;
 } ccd_style_t;
 
 void ccd_style_init (ccd_style_t *self);

Modified: trunk/libccd/ccd/ccd.h
==============================================================================
--- trunk/libccd/ccd/ccd.h	(original)
+++ trunk/libccd/ccd/ccd.h	Tue Sep 23 11:40:48 2008
@@ -28,7 +28,7 @@
 #include <ccd/ccd-function.h>
 #include <ccd/ccd-background.h>
 #include <ccd/ccd-border.h>
-#include <ccd/ccd-tinge.h>
+#include <ccd/ccd-color.h>
 #include <ccd/ccd-function.h>
 #include <ccd/ccd-node.h>
 #include <ccd/ccd-style.h>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]