Commit a33df2d1 authored by Benjamin Otte's avatar Benjamin Otte

cssvalue: Split number values into their own class

parent f7c0c767
...@@ -435,6 +435,7 @@ gtk_private_h_sources = \ ...@@ -435,6 +435,7 @@ gtk_private_h_sources = \
gtkcssinitialvalueprivate.h \ gtkcssinitialvalueprivate.h \
gtkcsslookupprivate.h \ gtkcsslookupprivate.h \
gtkcssmatcherprivate.h \ gtkcssmatcherprivate.h \
gtkcssnumbervalueprivate.h \
gtkcssparserprivate.h \ gtkcssparserprivate.h \
gtkcssproviderprivate.h \ gtkcssproviderprivate.h \
gtkcsssectionprivate.h \ gtkcsssectionprivate.h \
...@@ -635,6 +636,7 @@ gtk_base_c_sources = \ ...@@ -635,6 +636,7 @@ gtk_base_c_sources = \
gtkcssinitialvalue.c \ gtkcssinitialvalue.c \
gtkcsslookup.c \ gtkcsslookup.c \
gtkcssmatcher.c \ gtkcssmatcher.c \
gtkcssnumbervalue.c \
gtkcssparser.c \ gtkcssparser.c \
gtkcssprovider.c \ gtkcssprovider.c \
gtkcsssection.c \ gtkcsssection.c \
......
/* GTK - The GIMP Toolkit
* Copyright (C) 2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkstylepropertyprivate.h"
struct _GtkCssValue {
GTK_CSS_VALUE_BASE
GtkCssUnit unit;
double value;
};
static void
gtk_css_value_number_free (GtkCssValue *value)
{
g_slice_free (GtkCssValue, value);
}
static gboolean
gtk_css_value_number_equal (const GtkCssValue *number1,
const GtkCssValue *number2)
{
return number1->unit == number2->unit &&
number1->value == number2->value;
}
static void
gtk_css_value_number_print (const GtkCssValue *number,
GString *string)
{
char buf[G_ASCII_DTOSTR_BUF_SIZE];
const char *names[] = {
/* [GTK_CSS_NUMBER] = */ "",
/* [GTK_CSS_PERCENT] = */ "%",
/* [GTK_CSS_PX] = */ "px",
/* [GTK_CSS_PT] = */ "pt",
/* [GTK_CSS_EM] = */ "em",
/* [GTK_CSS_EX] = */ "ex",
/* [GTK_CSS_PC] = */ "pc",
/* [GTK_CSS_IN] = */ "in",
/* [GTK_CSS_CM] = */ "cm",
/* [GTK_CSS_MM] = */ "mm",
/* [GTK_CSS_RAD] = */ "rad",
/* [GTK_CSS_DEG] = */ "deg",
/* [GTK_CSS_GRAD] = */ "grad",
/* [GTK_CSS_TURN] = */ "turn",
};
g_ascii_dtostr (buf, sizeof (buf), number->value);
g_string_append (string, buf);
if (number->value != 0.0)
g_string_append (string, names[number->unit]);
}
static const GtkCssValueClass GTK_CSS_VALUE_NUMBER = {
gtk_css_value_number_free,
gtk_css_value_number_equal,
gtk_css_value_number_print
};
GtkCssValue *
_gtk_css_number_value_new (double value,
GtkCssUnit unit)
{
static GtkCssValue zero_singleton = { &GTK_CSS_VALUE_NUMBER, 1, GTK_CSS_NUMBER, 0 };
static GtkCssValue px_singletons[] = {
{ &GTK_CSS_VALUE_NUMBER, 1, GTK_CSS_PX, 0 },
{ &GTK_CSS_VALUE_NUMBER, 1, GTK_CSS_PX, 1 },
{ &GTK_CSS_VALUE_NUMBER, 1, GTK_CSS_PX, 2 },
{ &GTK_CSS_VALUE_NUMBER, 1, GTK_CSS_PX, 3 },
{ &GTK_CSS_VALUE_NUMBER, 1, GTK_CSS_PX, 4 },
};
GtkCssValue *result;
if (unit == GTK_CSS_NUMBER && value == 0)
return _gtk_css_value_ref (&zero_singleton);
if (unit == GTK_CSS_PX &&
(value == 0 ||
value == 1 ||
value == 2 ||
value == 3 ||
value == 4))
{
return _gtk_css_value_ref (&px_singletons[(int) value]);
}
result = _gtk_css_value_new (GtkCssValue, &GTK_CSS_VALUE_NUMBER);
result->unit = unit;
result->value = value;
return result;
}
GtkCssValue *
_gtk_css_number_value_parse (GtkCssParser *parser,
GtkCssNumberParseFlags flags)
{
GtkCssNumber number;
g_return_val_if_fail (parser != NULL, NULL);
if (!_gtk_css_parser_read_number (parser, &number, flags))
return NULL;
return _gtk_css_number_value_new (number.value, number.unit);
}
double
_gtk_css_number_value_get (const GtkCssValue *number,
double one_hundred_percent)
{
g_return_val_if_fail (number != NULL, 0.0);
g_return_val_if_fail (number->class == &GTK_CSS_VALUE_NUMBER, 0.0);
if (number->unit == GTK_CSS_PERCENT)
return number->value * one_hundred_percent / 100;
else
return number->value;
}
GtkCssValue *
_gtk_css_number_value_compute (GtkCssValue *number,
GtkStyleContext *context)
{
g_return_val_if_fail (number->class == &GTK_CSS_VALUE_NUMBER, NULL);
switch (number->unit)
{
default:
g_assert_not_reached();
/* fall through */
case GTK_CSS_PERCENT:
case GTK_CSS_NUMBER:
case GTK_CSS_PX:
case GTK_CSS_DEG:
return _gtk_css_value_ref (number);
case GTK_CSS_PT:
return _gtk_css_number_value_new (number->value * 96.0 / 72.0,
GTK_CSS_PX);
case GTK_CSS_PC:
return _gtk_css_number_value_new (number->value * 96.0 / 72.0 * 12.0,
GTK_CSS_PX);
break;
case GTK_CSS_IN:
return _gtk_css_number_value_new (number->value * 96.0,
GTK_CSS_PX);
break;
case GTK_CSS_CM:
return _gtk_css_number_value_new (number->value * 96.0 * 0.39370078740157477,
GTK_CSS_PX);
break;
case GTK_CSS_MM:
return _gtk_css_number_value_new (number->value * 96.0 * 0.039370078740157477,
GTK_CSS_PX);
break;
case GTK_CSS_EM:
return _gtk_css_number_value_new (number->value * _gtk_css_value_get_double (_gtk_style_context_peek_property (context, "font-size")),
GTK_CSS_PX);
break;
case GTK_CSS_EX:
/* for now we pretend ex is half of em */
return _gtk_css_number_value_new (number->value * 0.5 * _gtk_css_value_get_double (_gtk_style_context_peek_property (context, "font-size")),
GTK_CSS_PX);
case GTK_CSS_RAD:
return _gtk_css_number_value_new (number->value * 360.0 / (2 * G_PI),
GTK_CSS_DEG);
case GTK_CSS_GRAD:
return _gtk_css_number_value_new (number->value * 360.0 / 400.0,
GTK_CSS_DEG);
case GTK_CSS_TURN:
return _gtk_css_number_value_new (number->value * 360.0,
GTK_CSS_DEG);
}
}
/*
* Copyright © 2012 Red Hat Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Authors: Alexander Larsson <alexl@gnome.org>
*/
#ifndef __GTK_CSS_NUMBER_VALUE_PRIVATE_H__
#define __GTK_CSS_NUMBER_VALUE_PRIVATE_H__
#include "gtkcssparserprivate.h"
#include "gtkcsstypesprivate.h"
#include "gtkcssvalueprivate.h"
G_BEGIN_DECLS
GtkCssValue * _gtk_css_number_value_new (double value,
GtkCssUnit unit);
GtkCssValue * _gtk_css_number_value_parse (GtkCssParser *parser,
GtkCssNumberParseFlags flags);
double _gtk_css_number_value_get (const GtkCssValue *number,
double one_hundred_percent);
GtkCssValue * _gtk_css_number_value_compute (GtkCssValue *number,
GtkStyleContext *context);
G_END_DECLS
#endif /* __GTK_CSS_NUMBER_VALUE_PRIVATE_H__ */
...@@ -25,13 +25,14 @@ ...@@ -25,13 +25,14 @@
#include <math.h> #include <math.h>
#include "gtkcssimageprivate.h" #include "gtkcssimageprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkcssstylefuncsprivate.h" #include "gtkcssstylefuncsprivate.h"
#include "gtkcsstypesprivate.h" #include "gtkcsstypesprivate.h"
#include "gtkcssvalueprivate.h"
#include "gtkprivatetypebuiltins.h" #include "gtkprivatetypebuiltins.h"
#include "gtkstylepropertiesprivate.h" #include "gtkstylepropertiesprivate.h"
#include "gtksymboliccolorprivate.h" #include "gtksymboliccolorprivate.h"
#include "gtktypebuiltins.h" #include "gtktypebuiltins.h"
#include "gtkcssvalueprivate.h"
/* this is in case round() is not provided by the compiler, /* this is in case round() is not provided by the compiler,
* such as in the case of C89 compilers, like MSVC * such as in the case of C89 compilers, like MSVC
...@@ -54,7 +55,6 @@ parse_four_numbers (GtkCssShorthandProperty *shorthand, ...@@ -54,7 +55,6 @@ parse_four_numbers (GtkCssShorthandProperty *shorthand,
GtkCssParser *parser, GtkCssParser *parser,
GtkCssNumberParseFlags flags) GtkCssNumberParseFlags flags)
{ {
GtkCssNumber numbers[4];
guint i; guint i;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
...@@ -62,9 +62,8 @@ parse_four_numbers (GtkCssShorthandProperty *shorthand, ...@@ -62,9 +62,8 @@ parse_four_numbers (GtkCssShorthandProperty *shorthand,
if (!_gtk_css_parser_has_number (parser)) if (!_gtk_css_parser_has_number (parser))
break; break;
if (!_gtk_css_parser_read_number (parser, values[i] = _gtk_css_number_value_parse (parser, flags);
&numbers[i], if (values[i] == NULL)
flags))
return FALSE; return FALSE;
} }
...@@ -76,12 +75,7 @@ parse_four_numbers (GtkCssShorthandProperty *shorthand, ...@@ -76,12 +75,7 @@ parse_four_numbers (GtkCssShorthandProperty *shorthand,
for (; i < 4; i++) for (; i < 4; i++)
{ {
numbers[i] = numbers[(i - 1) >> 1]; values[i] = _gtk_css_value_ref (values[(i - 1) >> 1]);
}
for (i = 0; i < 4; i++)
{
values[i] = _gtk_css_value_new_from_number (&numbers[i]);
} }
return TRUE; return TRUE;
...@@ -330,15 +324,12 @@ parse_border_side (GtkCssShorthandProperty *shorthand, ...@@ -330,15 +324,12 @@ parse_border_side (GtkCssShorthandProperty *shorthand,
if (values[0] == NULL && if (values[0] == NULL &&
_gtk_css_parser_has_number (parser)) _gtk_css_parser_has_number (parser))
{ {
GtkCssNumber number; values[0] = _gtk_css_number_value_parse (parser,
if (!_gtk_css_parser_read_number (parser, GTK_CSS_POSITIVE_ONLY
&number, | GTK_CSS_NUMBER_AS_PIXELS
GTK_CSS_POSITIVE_ONLY | GTK_CSS_PARSE_LENGTH);
| GTK_CSS_NUMBER_AS_PIXELS if (values[0] == NULL)
| GTK_CSS_PARSE_LENGTH))
return FALSE; return FALSE;
values[0] = _gtk_css_value_new_from_number (&number);
} }
else if (values[1] == NULL && else if (values[1] == NULL &&
_gtk_css_parser_try_enum (parser, GTK_TYPE_BORDER_STYLE, &style)) _gtk_css_parser_try_enum (parser, GTK_TYPE_BORDER_STYLE, &style))
...@@ -381,15 +372,12 @@ parse_border (GtkCssShorthandProperty *shorthand, ...@@ -381,15 +372,12 @@ parse_border (GtkCssShorthandProperty *shorthand,
if (values[0] == NULL && if (values[0] == NULL &&
_gtk_css_parser_has_number (parser)) _gtk_css_parser_has_number (parser))
{ {
GtkCssNumber number; values[0] = _gtk_css_number_value_parse (parser,
if (!_gtk_css_parser_read_number (parser, GTK_CSS_POSITIVE_ONLY
&number, | GTK_CSS_NUMBER_AS_PIXELS
GTK_CSS_POSITIVE_ONLY | GTK_CSS_PARSE_LENGTH);
| GTK_CSS_NUMBER_AS_PIXELS if (values[0] == NULL)
| GTK_CSS_PARSE_LENGTH))
return FALSE; return FALSE;
values[0] = _gtk_css_value_new_from_number (&number);
values[1] = _gtk_css_value_ref (values[0]); values[1] = _gtk_css_value_ref (values[0]);
values[2] = _gtk_css_value_ref (values[0]); values[2] = _gtk_css_value_ref (values[0]);
values[3] = _gtk_css_value_ref (values[0]); values[3] = _gtk_css_value_ref (values[0]);
......
...@@ -935,13 +935,6 @@ border_image_repeat_value_print (const GValue *value, ...@@ -935,13 +935,6 @@ border_image_repeat_value_print (const GValue *value,
} }
} }
static void
css_number_print (const GValue *value,
GString *string)
{
_gtk_css_number_print (g_value_get_boxed (value), string);
}
static gboolean static gboolean
enum_value_parse (GtkCssParser *parser, enum_value_parse (GtkCssParser *parser,
GFile *base, GFile *base,
...@@ -1113,10 +1106,6 @@ gtk_css_style_funcs_init (void) ...@@ -1113,10 +1106,6 @@ gtk_css_style_funcs_init (void)
border_image_repeat_value_parse, border_image_repeat_value_parse,
border_image_repeat_value_print, border_image_repeat_value_print,
NULL); NULL);
register_conversion_function (GTK_TYPE_CSS_NUMBER,
NULL,
css_number_print,
NULL);
register_conversion_function (G_TYPE_ENUM, register_conversion_function (G_TYPE_ENUM,
enum_value_parse, enum_value_parse,
enum_value_print, enum_value_print,
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "gtkcssimagegradientprivate.h" #include "gtkcssimagegradientprivate.h"
#include "gtkcssimageprivate.h" #include "gtkcssimageprivate.h"
#include "gtkcssimageprivate.h" #include "gtkcssimageprivate.h"
#include "gtkcssnumbervalueprivate.h"
#include "gtkgradient.h" #include "gtkgradient.h"
#include "gtkshadowprivate.h" #include "gtkshadowprivate.h"
#include "gtksymboliccolorprivate.h" #include "gtksymboliccolorprivate.h"
...@@ -143,7 +144,7 @@ query_length_as_int (GtkCssStyleProperty *property, ...@@ -143,7 +144,7 @@ query_length_as_int (GtkCssStyleProperty *property,
GValue *value) GValue *value)
{ {
g_value_init (value, G_TYPE_INT); g_value_init (value, G_TYPE_INT);
g_value_set_int (value, round (_gtk_css_number_get (_gtk_css_value_get_number (css_value), 100))); g_value_set_int (value, round (_gtk_css_number_value_get (css_value, 100)));
} }
static GtkCssValue * static GtkCssValue *
...@@ -814,15 +815,9 @@ parse_margin (GtkCssStyleProperty *property, ...@@ -814,15 +815,9 @@ parse_margin (GtkCssStyleProperty *property,
GtkCssParser *parser, GtkCssParser *parser,
GFile *base) GFile *base)
{ {
GtkCssNumber number; return _gtk_css_number_value_parse (parser,
GTK_CSS_NUMBER_AS_PIXELS
if (!_gtk_css_parser_read_number (parser, | GTK_CSS_PARSE_LENGTH);
&number,
GTK_CSS_NUMBER_AS_PIXELS
| GTK_CSS_PARSE_LENGTH))
return NULL;
return _gtk_css_value_new_from_number (&number);
} }
static GtkCssValue * static GtkCssValue *
...@@ -830,15 +825,7 @@ compute_margin (GtkCssStyleProperty *property, ...@@ -830,15 +825,7 @@ compute_margin (GtkCssStyleProperty *property,
GtkStyleContext *context, GtkStyleContext *context,
GtkCssValue *specified) GtkCssValue *specified)
{ {
GtkCssNumber number; return _gtk_css_number_value_compute (specified, context);
if (_gtk_css_number_compute (&number,
_gtk_css_value_get_number (specified),
context))
{
return _gtk_css_value_new_from_number (&number);
}
return _gtk_css_value_ref (specified);
} }
static GtkCssValue * static GtkCssValue *
...@@ -846,16 +833,10 @@ parse_padding (GtkCssStyleProperty *property, ...@@ -846,16 +833,10 @@ parse_padding (GtkCssStyleProperty *property,
GtkCssParser *parser, GtkCssParser *parser,
GFile *base) GFile *base)
{ {
GtkCssNumber number; return _gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
if (!_gtk_css_parser_read_number (parser, | GTK_CSS_NUMBER_AS_PIXELS
&number, | GTK_CSS_PARSE_LENGTH);
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_NUMBER_AS_PIXELS
| GTK_CSS_PARSE_LENGTH))
return NULL;
return _gtk_css_value_new_from_number (&number);
} }
static GtkCssValue * static GtkCssValue *
...@@ -863,13 +844,7 @@ compute_padding (GtkCssStyleProperty *property, ...@@ -863,13 +844,7 @@ compute_padding (GtkCssStyleProperty *property,
GtkStyleContext *context, GtkStyleContext *context,
GtkCssValue *specified) GtkCssValue *specified)
{ {
GtkCssNumber number; return _gtk_css_number_value_compute (specified, context);
if (_gtk_css_number_compute (&number,
_gtk_css_value_get_number (specified),
context))
return _gtk_css_value_new_from_number (&number);
return _gtk_css_value_ref (specified);
} }
static GtkCssValue * static GtkCssValue *
...@@ -877,16 +852,10 @@ parse_border_width (GtkCssStyleProperty *property, ...@@ -877,16 +852,10 @@ parse_border_width (GtkCssStyleProperty *property,
GtkCssParser *parser, GtkCssParser *parser,
GFile *base) GFile *base)
{ {
GtkCssNumber number; return _gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
if (!_gtk_css_parser_read_number (parser, | GTK_CSS_NUMBER_AS_PIXELS
&number, | GTK_CSS_PARSE_LENGTH);
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_NUMBER_AS_PIXELS
| GTK_CSS_PARSE_LENGTH))
return FALSE;
return _gtk_css_value_new_from_number (&number);
} }
static GtkCssValue * static GtkCssValue *
...@@ -896,7 +865,6 @@ compute_border_width (GtkCssStyleProperty *property, ...@@ -896,7 +865,6 @@ compute_border_width (GtkCssStyleProperty *property,
{ {
GtkCssStyleProperty *style; GtkCssStyleProperty *style;
GtkBorderStyle border_style; GtkBorderStyle border_style;
GtkCssNumber number;
/* The -1 is magic that is only true because we register the style /* The -1 is magic that is only true because we register the style
* properties directly after the width properties. * properties directly after the width properties.
...@@ -907,16 +875,9 @@ compute_border_width (GtkCssStyleProperty *property, ...@@ -907,16 +875,9 @@ compute_border_width (GtkCssStyleProperty *property,
if (border_style == GTK_BORDER_STYLE_NONE || if (border_style == GTK_BORDER_STYLE_NONE ||
border_style == GTK_BORDER_STYLE_HIDDEN) border_style == GTK_BORDER_STYLE_HIDDEN)
{ return _gtk_css_number_value_new (0, GTK_CSS_PX);
_gtk_css_number_init (&number, 0, GTK_CSS_PX);
}
else else
{ return _gtk_css_number_value_compute (specified, context);
_gtk_css_number_compute (&number,
_gtk_css_value_get_number (specified),
context);
}
return _gtk_css_value_new_from_number (&number);
} }
static GtkCssValue * static GtkCssValue *
...@@ -1261,7 +1222,6 @@ void ...@@ -1261,7 +1222,6 @@ void
_gtk_css_style_property_init_properties (void) _gtk_css_style_property_init_properties (void)
{ {
char *default_font_family[] = { "Sans", NULL }; char *default_font_family[] = { "Sans", NULL };
GtkCssNumber number;
GtkCssBackgroundSize default_background_size = { GTK_CSS_NUMBER_INIT (0, GTK_CSS_PX), GTK_CSS_NUMBER_INIT (0, GTK_CSS_PX), FALSE, FALSE }; GtkCssBackgroundSize default_background_size = { GTK_CSS_NUMBER_INIT (0, GTK_CSS_PX), GTK_CSS_NUMBER_INIT (0, GTK_CSS_PX), FALSE, FALSE };
GtkCssBackgroundPosition default_background_position = { GTK_CSS_NUMBER_INIT (0, GTK_CSS_PERCENT), GTK_CSS_NUMBER_INIT (0, GTK_CSS_PERCENT)}; GtkCssBackgroundPosition default_background_position = { GTK_CSS_NUMBER_INIT (0, GTK_CSS_PERCENT), GTK_CSS_NUMBER_INIT (0, GTK_CSS_PERCENT)};
GtkCssBorderCornerRadius no_corner_radius = { GTK_CSS_NUMBER_INIT (0, GTK_CSS_PX), GTK_CSS_NUMBER_INIT (0, GTK_CSS_PX) }; GtkCssBorderCornerRadius no_corner_radius = { GTK_CSS_NUMBER_INIT (0, GTK_CSS_PX), GTK_CSS_NUMBER_INIT (0, GTK_CSS_PX) };
...@@ -1376,7 +1336,6 @@ _gtk_css_style_property_init_properties (void) ...@@ -1376,7 +1336,6 @@ _gtk_css_style_property_init_properties (void)
NULL, NULL,
_gtk_css_value_new_take_shadow (NULL)); _gtk_css_value_new_take_shadow (NULL));
_gtk_css_number_init (&number, 0, GTK_CSS_PX);
gtk_css_style_property_register ("margin-top", gtk_css_style_property_register ("margin-top",
G_TYPE_INT, G_TYPE_INT,
0, 0,
...@@ -1385,7 +1344,7 @@ _gtk_css_style_property_init_properties (void) ...@@ -1385,7 +1344,7 @@ _gtk_css_style_property_init_properties (void)
compute_margin, compute_margin,
query_length_as_int, query_length_as_int,
NULL, NULL,
_gtk_css_value_new_from_number (&number)); _gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("margin-left", gtk_css_style_property_register ("margin-left",
G_TYPE_INT, G_TYPE_INT,
0, 0,
...@@ -1394,7 +1353,7 @@ _gtk_css_style_property_init_properties (void) ...@@ -1394,7 +1353,7 @@ _gtk_css_style_property_init_properties (void)
compute_margin, compute_margin,
query_length_as_int, query_length_as_int,
NULL, NULL,
_gtk_css_value_new_from_number (&number)); _gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("margin-bottom", gtk_css_style_property_register ("margin-bottom",
G_TYPE_INT, G_TYPE_INT,
0, 0,
...@@ -1403,7 +1362,7 @@ _gtk_css_style_property_init_properties (void) ...@@ -1403,7 +1362,7 @@ _gtk_css_style_property_init_properties (void)
compute_margin, compute_margin,
query_length_as_int, query_length_as_int,
NULL, NULL,
_gtk_css_value_new_from_number (&number)); _gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("margin-right", gtk_css_style_property_register ("margin-right",
G_TYPE_INT, G_TYPE_INT,
0, 0,
...@@ -1412,7 +1371,7 @@ _gtk_css_style_property_init_properties (void) ...@@ -1412,7 +1371,7 @@ _gtk_css_style_property_init_properties (void)
compute_margin, compute_margin,
query_length_as_int, query_length_as_int,
NULL, NULL,
_gtk_css_value_new_from_number (&number)); _gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("padding-top", gtk_css_style_property_register ("padding-top",
G_TYPE_INT, G_TYPE_INT,
0, 0,
...@@ -1421,7 +1380,7 @@ _gtk_css_style_property_init_properties (void) ...@@ -1421,7 +1380,7 @@ _gtk_css_style_property_init_properties (void)
compute_padding, compute_padding,
query_length_as_int, query_length_as_int,
NULL, NULL,
_gtk_css_value_new_from_number (&number)); _gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("padding-left", gtk_css_style_property_register ("padding-left",
G_TYPE_INT, G_TYPE_INT,
0, 0,
...@@ -1430,7 +1389,7 @@ _gtk_css_style_property_init_properties (void) ...@@ -1430,7 +1389,7 @@ _gtk_css_style_property_init_properties (void)
compute_padding, compute_padding,
query_length_as_int, query_length_as_int,
NULL, NULL,
_gtk_css_value_new_from_number (&number)); _gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("padding-bottom", gtk_css_style_property_register ("padding-bottom",
G_TYPE_INT, G_TYPE_INT,
0, 0,
...@@ -1439,7 +1398,7 @@ _gtk_css_style_property_init_properties (void) ...@@ -1439,7 +1398,7 @@ _gtk_css_style_property_init_properties (void)
compute_padding, compute_padding,
query_length_as_int, query_length_as_int,
NULL, NULL,
_gtk_css_value_new_from_number (&number)); _gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("padding-right", gtk_css_style_property_register ("padding-right",
G_TYPE_INT, G_TYPE_INT,
0, 0,
...@@ -1448,7 +1407,7 @@ _gtk_css_style_property_init_properties (void) ...@@ -1448,7 +1407,7 @@ _gtk_css_style_property_init_properties (void)
compute_padding, compute_padding,
query_length_as_int, query_length_as_int,
NULL, NULL,
_gtk_css_value_new_from_number (&number)); _gtk_css_number_value_new (0.0, GTK_CSS_PX));
/* IMPORTANT: compute_border_width() requires that the border-width /* IMPORTANT: compute_border_width() requires that the border-width
* properties be immeditaly followed by the border-style properties * properties be immeditaly followed by the border-style properties
*/ */
...@@ -1469,7 +1428,7 @@ _gtk_css_style_property_init_properties (void) ...@@ -1469,7 +1428,7 @@ _gtk_css_style_property_init_properties (void)
compute_border_width, compute_border_width,
query_length_as_int, query_length_as_int,
NULL, NULL,
_gtk_css_value_new_from_number (&number)); _gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("border-left-style", gtk_css_style_property_register ("border-left-style",
GTK_TYPE_BORDER_STYLE, GTK_TYPE_BORDER_STYLE,
0, 0,
...@@ -1487,7 +1446,7 @@ _gtk_css_style_property_init_properties (void) ...@@ -1487,7 +1446,7 @@ _gtk_css_style_property_init_properties (void)
compute_border_width, compute_border_width,
query_length_as_int, query_length_as_int,
NULL, NULL,
_gtk_css_value_new_from_number (&number)); _gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("border-bottom-style", gtk_css_style_property_register ("border-bottom-style",