css: Make outline-offset a number property

This commit is contained in:
Benjamin Otte 2012-04-03 16:57:44 +02:00
parent c366b5b8b7
commit 05f2249d08
2 changed files with 16 additions and 13 deletions

View File

@ -651,15 +651,17 @@ outline_parse (GtkCssStyleProperty *property,
GtkCssParser *parser, GtkCssParser *parser,
GFile *base) GFile *base)
{ {
int i; return _gtk_css_number_value_parse (parser,
GTK_CSS_NUMBER_AS_PIXELS
| GTK_CSS_PARSE_LENGTH);
}
if (!_gtk_css_parser_try_int (parser, &i)) static GtkCssValue *
{ outline_compute (GtkCssStyleProperty *property,
_gtk_css_parser_error (parser, "Expected an integer"); GtkStyleContext *context,
return NULL; GtkCssValue *specified)
} {
return _gtk_css_number_value_compute (specified, context);
return _gtk_css_value_new_from_int (i);
} }
static GtkCssValue * static GtkCssValue *
@ -1616,11 +1618,11 @@ _gtk_css_style_property_init_properties (void)
0, 0,
outline_parse, outline_parse,
NULL, NULL,
outline_compute,
query_length_as_int,
assign_length_from_int,
NULL, NULL,
query_simple, _gtk_css_number_value_new (0.0, GTK_CSS_PX));
assign_simple,
NULL,
_gtk_css_value_new_from_int (0));
gtk_css_style_property_register ("background-clip", gtk_css_style_property_register ("background-clip",
GTK_CSS_PROPERTY_BACKGROUND_CLIP, GTK_CSS_PROPERTY_BACKGROUND_CLIP,

View File

@ -30,6 +30,7 @@
#include "gtkpango.h" #include "gtkpango.h"
#include "gtkcssarrayvalueprivate.h" #include "gtkcssarrayvalueprivate.h"
#include "gtkcssenumvalueprivate.h" #include "gtkcssenumvalueprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcssrgbavalueprivate.h" #include "gtkcssrgbavalueprivate.h"
#include "gtkcssshadowsvalueprivate.h" #include "gtkcssshadowsvalueprivate.h"
#include "gtkcsstypesprivate.h" #include "gtkcsstypesprivate.h"
@ -1831,7 +1832,7 @@ render_frame_internal (GtkThemingEngine *engine,
border.left = border.right = border.bottom = border.top; 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[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]; 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 */ /* reinit box here - outlines don't have a border radius */
_gtk_rounded_box_init_rect (&border_box, x, y, width, height); _gtk_rounded_box_init_rect (&border_box, x, y, width, height);