summaryrefslogtreecommitdiff
path: root/gtk/gtkcssarrayvalue.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2012-03-27 01:43:12 +0200
committerBenjamin Otte <otte@redhat.com>2012-04-17 08:59:12 +0200
commitffe50c3b674fe23596fd0af855ee8c1a678c3283 (patch)
treec4c19807a51ff484bab3365439d70fb28cc197ac /gtk/gtkcssarrayvalue.c
parent3e601691d969e9194251ead18687d05eb7e49241 (diff)
downloadgtk+-ffe50c3b674fe23596fd0af855ee8c1a678c3283.tar.gz
cssvalue: Add _gtk_css_value_equal()
For now, we return FALSE for all default css values, so this is not very useful. I also think of this as an optimization equal, not a guaranteed equal, because we don't even have a notion of what "equal" means. For example, for background-repeat, "repeat, repeat" and "repeat" are functionally equivalent. But the cssvalue has no idea that it's used for background-repeat. As a more complicated example, "repeat, no-repeat" and "repeat" are equal to what one sees as long as there's only one image listed background-image-source. But once you start transition'ing to an image with 2 sources, it's different...
Diffstat (limited to 'gtk/gtkcssarrayvalue.c')
-rw-r--r--gtk/gtkcssarrayvalue.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gtk/gtkcssarrayvalue.c b/gtk/gtkcssarrayvalue.c
index ba919da45e..922fdfdeda 100644
--- a/gtk/gtkcssarrayvalue.c
+++ b/gtk/gtkcssarrayvalue.c
@@ -40,6 +40,25 @@ gtk_css_value_array_free (GtkCssValue *value)
g_slice_free1 (sizeof (GtkCssValue) + sizeof (GtkCssValue *) * (value->n_values - 1), value);
}
+static gboolean
+gtk_css_value_array_equal (const GtkCssValue *value1,
+ const GtkCssValue *value2)
+{
+ guint i;
+
+ if (value1->n_values != value2->n_values)
+ return FALSE;
+
+ for (i = 0; i < value1->n_values; i++)
+ {
+ if (!_gtk_css_value_equal (value1->values[i],
+ value2->values[i]))
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static void
gtk_css_value_array_print (const GtkCssValue *value,
GString *string)
@@ -62,6 +81,7 @@ gtk_css_value_array_print (const GtkCssValue *value,
static const GtkCssValueClass GTK_CSS_VALUE_ARRAY = {
gtk_css_value_array_free,
+ gtk_css_value_array_equal,
gtk_css_value_array_print
};