]> Pileus Git - ~andy/gtk/commitdiff
css: Make outline-offset a number property
authorBenjamin Otte <otte@redhat.com>
Tue, 3 Apr 2012 14:57:44 +0000 (16:57 +0200)
committerBenjamin Otte <otte@redhat.com>
Tue, 17 Apr 2012 06:59:18 +0000 (08:59 +0200)
gtk/gtkcssstylepropertyimpl.c
gtk/gtkthemingengine.c

index 0fb7127658d2352135ba095920431cb9303fb930..f7dbfd1a1c7da62a55a007fb06ad3d200d227ed9 100644 (file)
@@ -651,15 +651,17 @@ outline_parse (GtkCssStyleProperty *property,
                GtkCssParser        *parser,
                GFile               *base)
 {
-  int i;
-
-  if (!_gtk_css_parser_try_int (parser, &i))
-    {
-      _gtk_css_parser_error (parser, "Expected an integer");
-      return NULL;
-    }
+  return _gtk_css_number_value_parse (parser,
+                                      GTK_CSS_NUMBER_AS_PIXELS
+                                      | GTK_CSS_PARSE_LENGTH);
+}
 
-  return _gtk_css_value_new_from_int (i);
+static GtkCssValue *
+outline_compute (GtkCssStyleProperty *property,
+                 GtkStyleContext     *context,
+                 GtkCssValue         *specified)
+{
+  return _gtk_css_number_value_compute (specified, context);
 }
 
 static GtkCssValue *
@@ -1616,11 +1618,11 @@ _gtk_css_style_property_init_properties (void)
                                           0,
                                           outline_parse,
                                           NULL,
+                                          outline_compute,
+                                          query_length_as_int,
+                                          assign_length_from_int,
                                           NULL,
-                                          query_simple,
-                                          assign_simple,
-                                          NULL,
-                                          _gtk_css_value_new_from_int (0));
+                                          _gtk_css_number_value_new (0.0, GTK_CSS_PX));
 
   gtk_css_style_property_register        ("background-clip",
                                           GTK_CSS_PROPERTY_BACKGROUND_CLIP,
index 631cc35cfe8ea267fb4bd52b2482e7c29ad2f297..11f22a9f1693d768d5f9be049e0aa34154b9aede 100644 (file)
@@ -30,6 +30,7 @@
 #include "gtkpango.h"
 #include "gtkcssarrayvalueprivate.h"
 #include "gtkcssenumvalueprivate.h"
+#include "gtkcssnumbervalueprivate.h"
 #include "gtkcssrgbavalueprivate.h"
 #include "gtkcssshadowsvalueprivate.h"
 #include "gtkcsstypesprivate.h"
@@ -1831,7 +1832,7 @@ render_frame_internal (GtkThemingEngine *engine,
       border.left = border.right = border.bottom = border.top;
       colors[0] = *_gtk_css_rgba_value_get_rgba (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_OUTLINE_COLOR));
       colors[3] = colors[2] = colors[1] = colors[0];
-      offset = _gtk_css_value_get_int (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_OUTLINE_OFFSET));
+      offset = _gtk_css_number_value_get (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_OUTLINE_OFFSET), 100);
       
       /* reinit box here - outlines don't have a border radius */
       _gtk_rounded_box_init_rect (&border_box, x, y, width, height);