]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkcssvalue.c
Minor doc cleanup
[~andy/gtk] / gtk / gtkcssvalue.c
index 5d5d39227fdaff5ff457f8d91c11f180c4d44c9b..6d77cf80c94fe299ddb11897e658de4991fab853 100644 (file)
 
 #include "config.h"
 
+#include "gtkprivate.h"
 #include "gtkcssvalueprivate.h"
 
+#include "gtkcsscomputedvaluesprivate.h"
+#include "gtkstyleproviderprivate.h"
+
 struct _GtkCssValue {
   GTK_CSS_VALUE_BASE
 };
@@ -42,7 +46,7 @@ _gtk_css_value_alloc (const GtkCssValueClass *klass,
 GtkCssValue *
 _gtk_css_value_ref (GtkCssValue *value)
 {
-  g_return_val_if_fail (value != NULL, NULL);
+  gtk_internal_return_val_if_fail (value != NULL, NULL);
 
   g_atomic_int_add (&value->ref_count, 1);
 
@@ -65,7 +69,12 @@ _gtk_css_value_unref (GtkCssValue *value)
  * _gtk_css_value_compute:
  * @value: the value to compute from
  * @property_id: the ID of the property to compute
- * @context: the context to use for resolving
+ * @provider: Style provider for looking up extra information
+ * @values: values to compute for
+ * @parent_values: parent values to use for inherited values
+ * @dependencies: (out) (allow-none): Set to the dependencies of the
+ *     computed values that indicate when this value needs to be
+ *     recomputed and how.
  *
  * Converts the specified @value into the computed value for the CSS
  * property given by @property_id using the information in @context.
@@ -73,25 +82,39 @@ _gtk_css_value_unref (GtkCssValue *value)
  * <ulink url="http://www.w3.org/TR/css3-cascade/#computed>
  * the CSS documentation</ulink>.
  *
- * Returns: the comptued value
+ * Returns: the computed value
  **/
 GtkCssValue *
-_gtk_css_value_compute (GtkCssValue     *value,
-                        guint            property_id,
-                        GtkStyleContext *context)
+_gtk_css_value_compute (GtkCssValue             *value,
+                        guint                    property_id,
+                        GtkStyleProviderPrivate *provider,
+                        GtkCssComputedValues    *values,
+                        GtkCssComputedValues    *parent_values,
+                        GtkCssDependencies      *dependencies)
 {
-  g_return_val_if_fail (value != NULL, NULL);
-  g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
+  GtkCssDependencies fallback;
+
+  gtk_internal_return_val_if_fail (value != NULL, NULL);
+  gtk_internal_return_val_if_fail (GTK_IS_STYLE_PROVIDER_PRIVATE (provider), NULL);
+  gtk_internal_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
+  gtk_internal_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values), NULL);
+
+  if (dependencies == NULL)
+    dependencies = &fallback;
+  *dependencies = 0;
 
-  return value->class->compute (value, property_id, context);
+  return value->class->compute (value, property_id, provider, values, parent_values, dependencies);
 }
 
 gboolean
 _gtk_css_value_equal (const GtkCssValue *value1,
                       const GtkCssValue *value2)
 {
-  g_return_val_if_fail (value1 != NULL, FALSE);
-  g_return_val_if_fail (value2 != NULL, FALSE);
+  gtk_internal_return_val_if_fail (value1 != NULL, FALSE);
+  gtk_internal_return_val_if_fail (value2 != NULL, FALSE);
+
+  if (value1 == value2)
+    return TRUE;
 
   if (value1->class != value2->class)
     return FALSE;
@@ -103,7 +126,8 @@ gboolean
 _gtk_css_value_equal0 (const GtkCssValue *value1,
                        const GtkCssValue *value2)
 {
-  if (value1 == NULL && value2 == NULL)
+  /* Inclues both values being NULL */
+  if (value1 == value2)
     return TRUE;
 
   if (value1 == NULL || value2 == NULL)
@@ -115,15 +139,16 @@ _gtk_css_value_equal0 (const GtkCssValue *value1,
 GtkCssValue *
 _gtk_css_value_transition (GtkCssValue *start,
                            GtkCssValue *end,
+                           guint        property_id,
                            double       progress)
 {
-  g_return_val_if_fail (start != NULL, FALSE);
-  g_return_val_if_fail (end != NULL, FALSE);
+  gtk_internal_return_val_if_fail (start != NULL, FALSE);
+  gtk_internal_return_val_if_fail (end != NULL, FALSE);
 
   if (start->class != end->class)
     return NULL;
 
-  return start->class->transition (start, end, progress);
+  return start->class->transition (start, end, property_id, progress);
 }
 
 char *
@@ -131,7 +156,7 @@ _gtk_css_value_to_string (const GtkCssValue *value)
 {
   GString *string;
 
-  g_return_val_if_fail (value != NULL, NULL);
+  gtk_internal_return_val_if_fail (value != NULL, NULL);
 
   string = g_string_new (NULL);
   _gtk_css_value_print (value, string);
@@ -151,8 +176,8 @@ void
 _gtk_css_value_print (const GtkCssValue *value,
                       GString           *string)
 {
-  g_return_if_fail (value != NULL);
-  g_return_if_fail (string != NULL);
+  gtk_internal_return_if_fail (value != NULL);
+  gtk_internal_return_if_fail (string != NULL);
 
   value->class->print (value, string);
 }