Commit 86a387f5 authored by Benjamin Otte's avatar Benjamin Otte

stylepropertyimpl: Add color parsing function

This is in preparation for removing the specified type and computed type
properties from GtkCssStyleProperty, which is in preparation for really
using GtkCssValue classes and not GTypes.
parent b5fc484c
......@@ -127,6 +127,27 @@ string_append_string (GString *str,
/*** IMPLEMENTATIONS ***/
static GtkCssValue *
color_parse (GtkCssStyleProperty *property,
GtkCssParser *parser,
GFile *base)
{
GtkSymbolicColor *symbolic;
if (_gtk_css_parser_try (parser, "currentcolor", TRUE))
{
symbolic = gtk_symbolic_color_ref (_gtk_symbolic_color_get_current_color ());
}
else
{
symbolic = _gtk_css_parser_read_symbolic_color (parser);
if (symbolic == NULL)
return NULL;
}
return _gtk_css_value_new_take_symbolic_color (symbolic);
}
static GtkCssValue *
color_compute (GtkCssStyleProperty *property,
GtkStyleContext *context,
......@@ -866,7 +887,7 @@ _gtk_css_style_property_init_properties (void)
GDK_TYPE_RGBA,
GDK_TYPE_RGBA,
GTK_STYLE_PROPERTY_INHERIT,
NULL,
color_parse,
NULL,
color_compute,
NULL,
......@@ -890,7 +911,7 @@ _gtk_css_style_property_init_properties (void)
GDK_TYPE_RGBA,
GDK_TYPE_RGBA,
0,
NULL,
color_parse,
NULL,
color_compute,
NULL,
......@@ -1258,7 +1279,7 @@ _gtk_css_style_property_init_properties (void)
GDK_TYPE_RGBA,
GDK_TYPE_RGBA,
0,
NULL,
color_parse,
NULL,
color_compute,
NULL,
......@@ -1270,7 +1291,7 @@ _gtk_css_style_property_init_properties (void)
GDK_TYPE_RGBA,
GDK_TYPE_RGBA,
0,
NULL,
color_parse,
NULL,
color_compute,
NULL,
......@@ -1282,7 +1303,7 @@ _gtk_css_style_property_init_properties (void)
GDK_TYPE_RGBA,
GDK_TYPE_RGBA,
0,
NULL,
color_parse,
NULL,
color_compute,
NULL,
......@@ -1294,7 +1315,7 @@ _gtk_css_style_property_init_properties (void)
GDK_TYPE_RGBA,
GDK_TYPE_RGBA,
0,
NULL,
color_parse,
NULL,
color_compute,
NULL,
......@@ -1306,7 +1327,7 @@ _gtk_css_style_property_init_properties (void)
GDK_TYPE_RGBA,
GDK_TYPE_RGBA,
0,
NULL,
color_parse,
NULL,
color_compute,
NULL,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment