From: Benjamin Otte Date: Tue, 3 Apr 2012 14:57:44 +0000 (+0200) Subject: css: Make outline-offset a number property X-Git-Url: http://pileus.org/git/?a=commitdiff_plain;h=05f2249d08384d27ceea1e44ee4034a973fabb0c;p=~andy%2Fgtk css: Make outline-offset a number property --- diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c index 0fb712765..f7dbfd1a1 100644 --- a/gtk/gtkcssstylepropertyimpl.c +++ b/gtk/gtkcssstylepropertyimpl.c @@ -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, diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c index 631cc35cf..11f22a9f1 100644 --- a/gtk/gtkthemingengine.c +++ b/gtk/gtkthemingengine.c @@ -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);