[gtk+/wip/cssvalue: 111/164] css: Make outline-offset a number property
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/cssvalue: 111/164] css: Make outline-offset a number property
- Date: Wed, 11 Apr 2012 14:49:14 +0000 (UTC)
commit 16975d1ed9b32f49a78fbd8a42de9dca81d92b71
Author: Benjamin Otte <otte redhat com>
Date: Tue Apr 3 16:57:44 2012 +0200
css: Make outline-offset a number property
gtk/gtkcssstylepropertyimpl.c | 26 ++++++++++++++------------
gtk/gtkthemingengine.c | 3 ++-
2 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 36daef0..5cf9e32 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 631cc35..11f22a9 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]