else
g_value_init (&pcache->value, GDK_TYPE_COLOR);
- if (_gtk_style_context_resolve_color (context, color, &rgba))
+ if (_gtk_style_context_resolve_color (context, color, &rgba, NULL))
{
if (G_PARAM_SPEC_VALUE_TYPE (pspec) == GDK_TYPE_RGBA)
g_value_set_boxed (&pcache->value, &rgba);
}
GtkCssValue *
-_gtk_style_context_resolve_color_value (GtkStyleContext *context,
- GtkCssValue *current,
- GtkCssValue *color)
+_gtk_style_context_resolve_color_value (GtkStyleContext *context,
+ GtkCssValue *current,
+ GtkCssDependencies current_deps,
+ GtkCssValue *color,
+ GtkCssDependencies *dependencies)
{
g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), FALSE);
g_return_val_if_fail (current != NULL, FALSE);
return _gtk_symbolic_color_resolve_full ((GtkSymbolicColor *) color,
current,
+ current_deps,
gtk_style_context_color_lookup_func,
- context);
+ context,
+ dependencies);
}
gboolean
-_gtk_style_context_resolve_color (GtkStyleContext *context,
- GtkSymbolicColor *color,
- GdkRGBA *result)
+_gtk_style_context_resolve_color (GtkStyleContext *context,
+ GtkSymbolicColor *color,
+ GdkRGBA *result,
+ GtkCssDependencies *dependencies)
{
GtkCssValue *val;
val = _gtk_symbolic_color_resolve_full (color,
_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR),
+ GTK_CSS_DEPENDS_ON_COLOR,
gtk_style_context_color_lookup_func,
- context);
+ context,
+ dependencies);
if (val == NULL)
return FALSE;
if (sym_color == NULL)
return FALSE;
- return _gtk_style_context_resolve_color (context, sym_color, color);
+ return _gtk_style_context_resolve_color (context, sym_color, color, NULL);
}
/**
GtkCssChange change);
gboolean _gtk_style_context_check_region_name (const gchar *str);
-gboolean _gtk_style_context_resolve_color (GtkStyleContext *context,
- GtkSymbolicColor *color,
- GdkRGBA *result);
-GtkCssValue * _gtk_style_context_resolve_color_value (GtkStyleContext *context,
- GtkCssValue *current,
- GtkCssValue *color);
-void _gtk_style_context_get_cursor_color (GtkStyleContext *context,
- GdkRGBA *primary_color,
- GdkRGBA *secondary_color);
-
-void _gtk_style_context_stop_animations (GtkStyleContext *context);
+gboolean _gtk_style_context_resolve_color (GtkStyleContext *context,
+ GtkSymbolicColor *color,
+ GdkRGBA *result,
+ GtkCssDependencies *dependencies);
+GtkCssValue * _gtk_style_context_resolve_color_value (GtkStyleContext *context,
+ GtkCssValue *current,
+ GtkCssDependencies current_deps,
+ GtkCssValue *color,
+ GtkCssDependencies *dependencies);
+void _gtk_style_context_get_cursor_color (GtkStyleContext *context,
+ GdkRGBA *primary_color,
+ GdkRGBA *secondary_color);
+
+void _gtk_style_context_stop_animations (GtkStyleContext *context);
G_END_DECLS
GtkCssDependencies *dependencies)
{
GtkCssValue *resolved, *current;
-
- *dependencies = GTK_CSS_DEPENDS_ON_EVERYTHING;
+ GtkCssDependencies current_deps;
/* The computed value of the ‘currentColor’ keyword is the computed
* value of the ‘color’ property. If the ‘currentColor’ keyword is
GtkStyleContext *parent = gtk_style_context_get_parent (context);
if (parent)
- current = _gtk_style_context_peek_property (parent, GTK_CSS_PROPERTY_COLOR);
+ {
+ current = _gtk_style_context_peek_property (parent, GTK_CSS_PROPERTY_COLOR);
+ current_deps = GTK_CSS_EQUALS_PARENT;
+ }
else
- current = _gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (GTK_CSS_PROPERTY_COLOR));
+ {
+ current = _gtk_css_style_property_get_initial_value (_gtk_css_style_property_lookup_by_id (GTK_CSS_PROPERTY_COLOR));
+ current_deps = 0;
+ }
}
else
{
current = _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR);
+ current_deps = GTK_CSS_DEPENDS_ON_COLOR;
}
- resolved = _gtk_style_context_resolve_color_value (context, current, value);
+ resolved = _gtk_style_context_resolve_color_value (context, current, current_deps, value, dependencies);
if (resolved == NULL)
return gtk_css_value_symbolic_get_fallback (property_id, context);
current = _gtk_css_rgba_value_new_from_rgba (&pink);
v =_gtk_symbolic_color_resolve_full (color,
current,
+ 0,
resolve_lookup_color,
- props);
+ props,
+ NULL);
_gtk_css_value_unref (current);
if (v == NULL)
return FALSE;
GtkCssValue *
_gtk_symbolic_color_resolve_full (GtkSymbolicColor *color,
GtkCssValue *current,
+ GtkCssDependencies current_deps,
GtkSymbolicColorLookupFunc func,
- gpointer data)
+ gpointer data,
+ GtkCssDependencies *dependencies)
{
+ GtkCssDependencies unused;
GtkCssValue *value;
g_return_val_if_fail (color != NULL, FALSE);
g_return_val_if_fail (current != NULL, FALSE);
g_return_val_if_fail (func != NULL, FALSE);
+ if (dependencies == NULL)
+ dependencies = &unused;
+ *dependencies = 0;
+
value = NULL;
switch (color->type)
{
if (!named_color)
return NULL;
- return _gtk_symbolic_color_resolve_full (named_color, current, func, data);
+ return _gtk_symbolic_color_resolve_full (named_color, current, current_deps, func, data, dependencies);
}
break;
GtkCssValue *val;
GdkRGBA shade;
- val = _gtk_symbolic_color_resolve_full (color->shade.color, current, func, data);
+ val = _gtk_symbolic_color_resolve_full (color->shade.color, current, current_deps, func, data, dependencies);
if (val == NULL)
return NULL;
+ *dependencies = _gtk_css_dependencies_union (*dependencies, 0);
shade = *_gtk_css_rgba_value_get_rgba (val);
_shade_color (&shade, color->shade.factor);
GtkCssValue *val;
GdkRGBA alpha;
- val = _gtk_symbolic_color_resolve_full (color->alpha.color, current, func, data);
+ val = _gtk_symbolic_color_resolve_full (color->alpha.color, current, current_deps, func, data, dependencies);
if (val == NULL)
return NULL;
+ *dependencies = _gtk_css_dependencies_union (*dependencies, 0);
alpha = *_gtk_css_rgba_value_get_rgba (val);
alpha.alpha = CLAMP (alpha.alpha * color->alpha.factor, 0, 1);
{
GtkCssValue *val;
GdkRGBA color1, color2, res;
+ GtkCssDependencies dep1, dep2;
- val = _gtk_symbolic_color_resolve_full (color->mix.color1, current, func, data);
+ val = _gtk_symbolic_color_resolve_full (color->mix.color1, current, current_deps, func, data, &dep1);
if (val == NULL)
return NULL;
color1 = *_gtk_css_rgba_value_get_rgba (val);
_gtk_css_value_unref (val);
- val = _gtk_symbolic_color_resolve_full (color->mix.color2, current, func, data);
+ val = _gtk_symbolic_color_resolve_full (color->mix.color2, current, current_deps, func, data, &dep2);
if (val == NULL)
return NULL;
color2 = *_gtk_css_rgba_value_get_rgba (val);
_gtk_css_value_unref (val);
-
+ *dependencies = _gtk_css_dependencies_union (dep1, dep2);
res.red = CLAMP (color1.red + ((color2.red - color1.red) * color->mix.factor), 0, 1);
res.green = CLAMP (color1.green + ((color2.green - color1.green) * color->mix.factor), 0, 1);
res.blue = CLAMP (color1.blue + ((color2.blue - color1.blue) * color->mix.factor), 0, 1);
break;
case COLOR_TYPE_CURRENT_COLOR:
if (current)
- return _gtk_css_value_ref (current);
+ {
+ *dependencies = current_deps;
+ return _gtk_css_value_ref (current);
+ }
else
- return NULL;
+ {
+ return NULL;
+ }
break;
default:
g_assert_not_reached ();