csscolorvalue: Don't resolve literal color values

This commit is contained in:
Timm Bäder 2020-01-09 10:22:53 +01:00
parent c21280e455
commit 06dbde22a0

View File

@ -136,7 +136,7 @@ gtk_css_value_color_compute (GtkCssValue *value,
GtkCssStyle *style, GtkCssStyle *style,
GtkCssStyle *parent_style) GtkCssStyle *parent_style)
{ {
GtkCssValue *resolved, *current; GtkCssValue *resolved;
/* The computed value of the currentColor keyword is the computed /* The computed value of the currentColor keyword is the computed
* value of the color property. If the currentColor keyword is * value of the color property. If the currentColor keyword is
@ -144,20 +144,31 @@ gtk_css_value_color_compute (GtkCssValue *value,
*/ */
if (property_id == GTK_CSS_PROPERTY_COLOR) if (property_id == GTK_CSS_PROPERTY_COLOR)
{ {
GtkCssValue *current;
if (parent_style) if (parent_style)
current = gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_COLOR); current = gtk_css_style_get_value (parent_style, GTK_CSS_PROPERTY_COLOR);
else else
current = NULL; current = NULL;
resolved = _gtk_css_color_value_resolve (value,
provider,
current,
NULL);
}
else if (value->type == COLOR_TYPE_LITERAL)
{
resolved = _gtk_css_value_ref (value->last_value);
} }
else else
{ {
current = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR); GtkCssValue *current = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_COLOR);
resolved = _gtk_css_color_value_resolve (value,
provider,
current,
NULL);
} }
resolved = _gtk_css_color_value_resolve (value,
provider,
current,
NULL);
if (resolved == NULL) if (resolved == NULL)
return gtk_css_value_color_get_fallback (property_id, provider, style, parent_style); return gtk_css_value_color_get_fallback (property_id, provider, style, parent_style);