#include "gtkcssimagegradientprivate.h"
#include "gtkcssprovider.h"
-#include "gtkcssrgbavalueprivate.h"
+#include "gtkcsstypedvalueprivate.h"
#include "gtkcsstypesprivate.h"
#include "gtkgradient.h"
#include "gtkprivatetypebuiltins.h"
-#include "gtkcssshadowvalueprivate.h"
#include "gtkstylecontextprivate.h"
#include "gtksymboliccolorprivate.h"
#include "gtkthemingengine.h"
static GHashTable *compute_funcs = NULL;
typedef gboolean (* GtkStyleParseFunc) (GtkCssParser *parser,
- GFile *base,
GValue *value);
typedef void (* GtkStylePrintFunc) (const GValue *value,
GString *string);
static gboolean
rgba_value_parse (GtkCssParser *parser,
- GFile *base,
GValue *value)
{
GtkSymbolicColor *symbolic;
GtkCssValue *specified)
{
GdkRGBA white = { 1, 1, 1, 1 };
+ const GValue *value;
+
+ value = _gtk_css_typed_value_get (specified);
- if (_gtk_css_value_holds (specified, GTK_TYPE_SYMBOLIC_COLOR))
+ if (G_VALUE_HOLDS (value, GTK_TYPE_SYMBOLIC_COLOR))
{
- GtkSymbolicColor *symbolic = _gtk_css_value_get_boxed (specified);
+ GtkSymbolicColor *symbolic = g_value_get_boxed (value);
+ GValue new_value = G_VALUE_INIT;
GdkRGBA rgba;
if (!_gtk_style_context_resolve_color (context, symbolic, &rgba))
rgba = white;
- return _gtk_css_value_new_from_boxed (GDK_TYPE_RGBA, &rgba);
+ g_value_init (&new_value, GDK_TYPE_RGBA);
+ g_value_set_boxed (&new_value, &rgba);
+ return _gtk_css_typed_value_new_take (&new_value);
}
else
return _gtk_css_value_ref (specified);
static gboolean
color_value_parse (GtkCssParser *parser,
- GFile *base,
GValue *value)
{
GtkSymbolicColor *symbolic;
{
GdkRGBA rgba;
GdkColor color = { 0, 65535, 65535, 65535 };
+ const GValue *value;
- if (_gtk_css_value_holds (specified, GTK_TYPE_SYMBOLIC_COLOR))
+ value = _gtk_css_typed_value_get (specified);
+
+ if (G_VALUE_HOLDS (value, GTK_TYPE_SYMBOLIC_COLOR))
{
+ GValue new_value = G_VALUE_INIT;
+
if (_gtk_style_context_resolve_color (context,
- _gtk_css_value_get_boxed (specified),
+ g_value_get_boxed (value),
&rgba))
{
color.red = rgba.red * 65535. + 0.5;
color.blue = rgba.blue * 65535. + 0.5;
}
- return _gtk_css_value_new_from_color (&color);
+ g_value_init (&new_value, GDK_TYPE_COLOR);
+ g_value_set_boxed (&new_value, &color);
+ return _gtk_css_typed_value_new_take (&new_value);
}
else
return _gtk_css_value_ref (specified);
static gboolean
symbolic_color_value_parse (GtkCssParser *parser,
- GFile *base,
GValue *value)
{
GtkSymbolicColor *symbolic;
static gboolean
font_description_value_parse (GtkCssParser *parser,
- GFile *base,
GValue *value)
{
PangoFontDescription *font_desc;
static gboolean
boolean_value_parse (GtkCssParser *parser,
- GFile *base,
GValue *value)
{
if (_gtk_css_parser_try (parser, "true", TRUE) ||
static gboolean
int_value_parse (GtkCssParser *parser,
- GFile *base,
GValue *value)
{
gint i;
if (_gtk_css_parser_begins_with (parser, '-'))
{
- int res = _gtk_win32_theme_int_parse (parser, base, &i);
+ int res = _gtk_win32_theme_int_parse (parser, &i);
if (res >= 0)
{
g_value_set_int (value, i);
static gboolean
uint_value_parse (GtkCssParser *parser,
- GFile *base,
GValue *value)
{
guint u;
static gboolean
double_value_parse (GtkCssParser *parser,
- GFile *base,
GValue *value)
{
gdouble d;
static gboolean
float_value_parse (GtkCssParser *parser,
- GFile *base,
GValue *value)
{
gdouble d;
static gboolean
string_value_parse (GtkCssParser *parser,
- GFile *base,
GValue *value)
{
char *str = _gtk_css_parser_read_string (parser);
static gboolean
theming_engine_value_parse (GtkCssParser *parser,
- GFile *base,
GValue *value)
{
GtkThemingEngine *engine;
static gboolean
border_value_parse (GtkCssParser *parser,
- GFile *base,
GValue *value)
{
GtkBorder border = { 0, };
{
/* These are strictly speaking signed, but we want to be able to use them
for unsigned types too, as the actual ranges of values make this safe */
- int res = _gtk_win32_theme_int_parse (parser, base, &numbers[i]);
+ int res = _gtk_win32_theme_int_parse (parser, &numbers[i]);
if (res == 0) /* Parse error, report */
return FALSE;
static gboolean
gradient_value_parse (GtkCssParser *parser,
- GFile *base,
GValue *value)
{
GtkGradient *gradient;
static gboolean
pattern_value_parse (GtkCssParser *parser,
- GFile *base,
GValue *value)
{
if (_gtk_css_parser_try (parser, "none", TRUE))
{
g_value_unset (value);
g_value_init (value, GTK_TYPE_GRADIENT);
- return gradient_value_parse (parser, base, value);
+ return gradient_value_parse (parser, value);
}
else
{
cairo_t *cr;
cairo_matrix_t matrix;
- file = _gtk_css_parser_read_url (parser, base);
+ file = _gtk_css_parser_read_url (parser);
if (file == NULL)
return FALSE;
pattern_value_compute (GtkStyleContext *context,
GtkCssValue *specified)
{
- if (_gtk_css_value_holds (specified, GTK_TYPE_GRADIENT))
+ const GValue *value = _gtk_css_typed_value_get (specified);
+
+ if (G_VALUE_HOLDS (value, GTK_TYPE_GRADIENT))
{
+ GValue new_value = G_VALUE_INIT;
cairo_pattern_t *gradient;
- gradient = gtk_gradient_resolve_for_context (_gtk_css_value_get_gradient (specified), context);
+ gradient = gtk_gradient_resolve_for_context (g_value_get_boxed (value), context);
- return _gtk_css_value_new_take_pattern (gradient);
+ g_value_init (&new_value, CAIRO_GOBJECT_TYPE_PATTERN);
+ g_value_take_boxed (&new_value, gradient);
+ return _gtk_css_typed_value_new_take (&new_value);
}
else
return _gtk_css_value_ref (specified);
static gboolean
enum_value_parse (GtkCssParser *parser,
- GFile *base,
GValue *value)
{
int v;
static gboolean
flags_value_parse (GtkCssParser *parser,
- GFile *base,
GValue *value)
{
GFlagsClass *flags_class;
* _gtk_css_style_parse_value:
* @value: the value to parse into. Must be a valid initialized #GValue
* @parser: the parser to parse from
- * @base: the base URL for @parser
*
* This is the generic parsing function used for CSS values. If the
* function fails to parse a value, it will emit an error on @parser,
**/
gboolean
_gtk_css_style_parse_value (GValue *value,
- GtkCssParser *parser,
- GFile *base)
+ GtkCssParser *parser)
{
GtkStyleParseFunc func;
return FALSE;
}
- return (*func) (parser, base, value);
+ return (*func) (parser, value);
}
/**