summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@gnome.org>2004-03-07 12:31:24 +0000
committerDodji Seketeli <dodji@src.gnome.org>2004-03-07 12:31:24 +0000
commit9e1a6d35382841cbbaaca9779fe21c3123cc367f (patch)
treef9db85bea65fb982b21fc1f7fee537f2cf640164
parent0d19a60f90378964a7e034dabe62f99cf0d306bd (diff)
downloadlibcroco-9e1a6d35382841cbbaaca9779fe21c3123cc367f.tar.gz
applied a patch from Benjamin Dauvergne to support the "color" property.
2004-03-07 Dodji Seketeli <dodji@gnome.org> * src/cr-style.c: applied a patch from Benjamin Dauvergne to support the "color" property.
-rw-r--r--ChangeLog5
-rw-r--r--src/cr-style.c29
2 files changed, 26 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index ab88143..57e2767 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2004-03-07 Dodji Seketeli <dodji@gnome.org>
+ * src/cr-style.c: applied a patch from
+ Benjamin Dauvergne to support the "color" property.
+
+2004-03-07 Dodji Seketeli <dodji@gnome.org>
+
* src/cr-rgb.[ch]:
(cr_rgb_compute_from_percentage): added this new convenience
function.
diff --git a/src/cr-style.c b/src/cr-style.c
index 760dfa4..ca06c22 100644
--- a/src/cr-style.c
+++ b/src/cr-style.c
@@ -279,7 +279,7 @@ static enum CRStatus
set_prop_width (CRStyle *a_style, CRTerm *a_value) ;
static enum CRStatus
-set_prop_color_rgb (CRStyle *a_style, CRTerm *a_value) ;
+set_prop_color (CRStyle *a_style, CRTerm *a_value) ;
static enum CRStatus
set_prop_background_color (CRStyle *a_style, CRTerm *a_value) ;
@@ -1158,23 +1158,36 @@ set_prop_width (CRStyle *a_style, CRTerm *a_value)
}
static enum CRStatus
-set_prop_color_rgb (CRStyle *a_style, CRTerm *a_value)
+set_prop_color (CRStyle *a_style, CRTerm *a_value)
{
+ enum CRStatus status = CR_OK ;
g_return_val_if_fail (a_style && a_value,
CR_BAD_PARAM_ERROR) ;
- if (a_value->type == TERM_RGB)
- {
+ switch(a_value->type) {
+ case TERM_RGB:
if (a_value->content.rgb)
{
cr_rgb_set_from_rgb
(&a_style->rgb_props[RGB_PROP_COLOR].sv,
a_value->content.rgb) ;
}
+ break ;
+ case TERM_IDENT:
+ status = cr_rgb_set_from_name
+ (&a_style->rgb_props[RGB_PROP_COLOR].sv,
+ a_value->content.str->str) ;
+ break ;
+ case TERM_HASH:
+ status = cr_rgb_set_from_hex_str
+ (&a_style->rgb_props[RGB_PROP_COLOR].sv,
+ a_value->content.str->str) ;
+ break ;
+ default:
+ status = CR_UNKNOWN_TYPE_ERROR ;
+ }
- }
-
- return CR_OK ;
+ return status ;
}
static enum CRStatus
@@ -2214,7 +2227,7 @@ cr_style_set_style_from_decl (CRStyle *a_this, CRDeclaration *a_decl)
break ;
case PROP_ID_COLOR:
- status = set_prop_color_rgb (a_this, value) ;
+ status = set_prop_color (a_this, value) ;
break ;
case PROP_ID_BACKGROUND_COLOR: