summaryrefslogtreecommitdiff
path: root/gtk/gtkcssnumbervalue.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2016-02-13 02:31:47 +0100
committerBenjamin Otte <otte@redhat.com>2016-02-13 04:49:08 +0100
commit4a9fa1e7505651c3074b1a620047f6bfc5158a5a (patch)
tree72582dcf3e10b9dff940421944ce39d6bf1dbedd /gtk/gtkcssnumbervalue.c
parent65dd9da44a0a9d5ee211e36c6a779a682469e106 (diff)
downloadgtk+-4a9fa1e7505651c3074b1a620047f6bfc5158a5a.tar.gz
css: Add API to handle order when printing calc()
Also, add some tests and update old ones to print calc() statements correctly.
Diffstat (limited to 'gtk/gtkcssnumbervalue.c')
-rw-r--r--gtk/gtkcssnumbervalue.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gtk/gtkcssnumbervalue.c b/gtk/gtkcssnumbervalue.c
index b7892c7603..d685fda902 100644
--- a/gtk/gtkcssnumbervalue.c
+++ b/gtk/gtkcssnumbervalue.c
@@ -78,6 +78,27 @@ gtk_css_number_value_try_add (const GtkCssValue *value1,
return number_value_class->try_add (value1, value2);
}
+/*
+ * gtk_css_number_value_get_calc_term_order:
+ * @value: Value to compute order for
+ *
+ * Determines the position of @value when printed as part of a calc()
+ * expression. Values with lower numbers are printed first. Note that
+ * these numbers are arbitrary, so when adding new types of values to
+ * print, feel free to change them in implementations so that they
+ * match.
+ *
+ * Returns: Magic value determining placement when printing calc()
+ * expression.
+ */
+gint
+gtk_css_number_value_get_calc_term_order (const GtkCssValue *value)
+{
+ GtkCssNumberValueClass *number_value_class = (GtkCssNumberValueClass *) value->class;
+
+ return number_value_class->get_calc_term_order (value);
+}
+
GtkCssValue *
_gtk_css_number_value_new (double value,
GtkCssUnit unit)