[gtk/wip/baedert/css-values: 2/5] cssdimensionvalue: Allow transitioning between different units...



commit 9d3704c62a663bd3b5c60bf845bd21b0e2ddd131
Author: Timm Bäder <mail baedert org>
Date:   Mon Jan 13 08:18:26 2020 +0100

    cssdimensionvalue: Allow transitioning between different units...
    
    ... as long as one of the two values is 0.

 gtk/gtkcssdimensionvalue.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkcssdimensionvalue.c b/gtk/gtkcssdimensionvalue.c
index e540a7316c..b50d377e84 100644
--- a/gtk/gtkcssdimensionvalue.c
+++ b/gtk/gtkcssdimensionvalue.c
@@ -204,15 +204,15 @@ static GtkCssValue *
 gtk_css_value_dimension_try_add (GtkCssValue *value1,
                                  GtkCssValue *value2)
 {
-  if (value1->unit != value2->unit)
-    return NULL;
-
   if (value1->value == 0)
     return _gtk_css_value_ref (value2);
 
   if (value2->value == 0)
     return _gtk_css_value_ref (value1);
 
+  if (value1->unit != value2->unit)
+    return NULL;
+
   return gtk_css_dimension_value_new (value1->value + value2->value, value1->unit);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]