]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkcsscornervalue.c
label: Fix memleak
[~andy/gtk] / gtk / gtkcsscornervalue.c
index 5cf497481f8f9001f3126bb3a3470239dcb1877e..394675c71a08812a1f763bbfc10a01762cb8e214 100644 (file)
@@ -36,6 +36,30 @@ gtk_css_value_corner_free (GtkCssValue *value)
   g_slice_free (GtkCssValue, value);
 }
 
+static GtkCssValue *
+gtk_css_value_corner_compute (GtkCssValue             *corner,
+                              guint                    property_id,
+                              GtkStyleProviderPrivate *provider,
+                              GtkCssComputedValues    *values,
+                              GtkCssComputedValues    *parent_values,
+                              GtkCssDependencies      *dependencies)
+{
+  GtkCssValue *x, *y;
+  GtkCssDependencies x_deps, y_deps;
+
+  x = _gtk_css_value_compute (corner->x, property_id, provider, values, parent_values, &x_deps);
+  y = _gtk_css_value_compute (corner->y, property_id, provider, values, parent_values, &y_deps);
+  *dependencies = _gtk_css_dependencies_union (x_deps, y_deps);
+  if (x == corner->x && y == corner->y)
+    {
+      _gtk_css_value_unref (x);
+      _gtk_css_value_unref (y);
+      return _gtk_css_value_ref (corner);
+    }
+
+  return _gtk_css_corner_value_new (x, y);
+}
+
 static gboolean
 gtk_css_value_corner_equal (const GtkCssValue *corner1,
                             const GtkCssValue *corner2)
@@ -46,15 +70,16 @@ gtk_css_value_corner_equal (const GtkCssValue *corner1,
 
 static GtkCssValue *
 gtk_css_value_corner_transition (GtkCssValue *start,
-                                GtkCssValue *end,
-                                double       progress)
+                                 GtkCssValue *end,
+                                 guint        property_id,
+                                 double       progress)
 {
   GtkCssValue *x, *y;
 
-  x = _gtk_css_value_transition (start->x, end->x, progress);
+  x = _gtk_css_value_transition (start->x, end->x, property_id, progress);
   if (x == NULL)
     return NULL;
-  y = _gtk_css_value_transition (start->y, end->y, progress);
+  y = _gtk_css_value_transition (start->y, end->y, property_id, progress);
   if (y == NULL)
     {
       _gtk_css_value_unref (x);
@@ -78,6 +103,7 @@ gtk_css_value_corner_print (const GtkCssValue *corner,
 
 static const GtkCssValueClass GTK_CSS_VALUE_CORNER = {
   gtk_css_value_corner_free,
+  gtk_css_value_corner_compute,
   gtk_css_value_corner_equal,
   gtk_css_value_corner_transition,
   gtk_css_value_corner_print
@@ -148,23 +174,3 @@ _gtk_css_corner_value_get_y (const GtkCssValue *corner,
   return _gtk_css_number_value_get (corner->y, one_hundred_percent);
 }
 
-GtkCssValue *
-_gtk_css_corner_value_compute (GtkCssValue     *corner,
-                               GtkStyleContext *context)
-{
-  GtkCssValue *x, *y;
-
-  g_return_val_if_fail (corner->class == &GTK_CSS_VALUE_CORNER, NULL);
-
-  x = _gtk_css_number_value_compute (corner->x, context);
-  y = _gtk_css_number_value_compute (corner->y, context);
-  if (x == corner->x && y == corner->y)
-    {
-      _gtk_css_value_unref (x);
-      _gtk_css_value_unref (y);
-      return _gtk_css_value_ref (corner);
-    }
-
-  return _gtk_css_corner_value_new (x, y);
-}
-