Merge branch 'ccs-math' into 'main'

css: Implement math functions

See merge request GNOME/gtk!7249
This commit is contained in:
Matthias Clasen 2024-05-20 14:40:48 +00:00
commit 2aeb80f490
49 changed files with 2295 additions and 640 deletions

View File

@ -253,7 +253,7 @@ gtk_cell_renderer_spinner_update_size (GtkCellRendererSpinner *cell,
node = gtk_style_context_get_node (context);
gtk_icon_size_set_style_classes (node, priv->icon_size);
style = gtk_css_node_get_style (node);
priv->size = _gtk_css_number_value_get (style->icon->icon_size, 100);
priv->size = gtk_css_number_value_get (style->icon->icon_size, 100);
gtk_style_context_restore (context);
}

View File

@ -370,7 +370,7 @@ static int
calc_indicator_size (GtkStyleContext *context)
{
GtkCssStyle *style = gtk_style_context_lookup_style (context);
return _gtk_css_number_value_get (style->icon->icon_size, 100);
return gtk_css_number_value_get (style->icon->icon_size, 100);
}
static void

View File

@ -860,10 +860,10 @@ gtk_style_context_get_border (GtkStyleContext *context,
style = gtk_style_context_lookup_style (context);
border->top = round (_gtk_css_number_value_get (style->border->border_top_width, 100));
border->right = round (_gtk_css_number_value_get (style->border->border_right_width, 100));
border->bottom = round (_gtk_css_number_value_get (style->border->border_bottom_width, 100));
border->left = round (_gtk_css_number_value_get (style->border->border_left_width, 100));
border->top = round (gtk_css_number_value_get (style->border->border_top_width, 100));
border->right = round (gtk_css_number_value_get (style->border->border_right_width, 100));
border->bottom = round (gtk_css_number_value_get (style->border->border_bottom_width, 100));
border->left = round (gtk_css_number_value_get (style->border->border_left_width, 100));
}
/**
@ -886,10 +886,10 @@ gtk_style_context_get_padding (GtkStyleContext *context,
style = gtk_style_context_lookup_style (context);
padding->top = round (_gtk_css_number_value_get (style->size->padding_top, 100));
padding->right = round (_gtk_css_number_value_get (style->size->padding_right, 100));
padding->bottom = round (_gtk_css_number_value_get (style->size->padding_bottom, 100));
padding->left = round (_gtk_css_number_value_get (style->size->padding_left, 100));
padding->top = round (gtk_css_number_value_get (style->size->padding_top, 100));
padding->right = round (gtk_css_number_value_get (style->size->padding_right, 100));
padding->bottom = round (gtk_css_number_value_get (style->size->padding_bottom, 100));
padding->left = round (gtk_css_number_value_get (style->size->padding_left, 100));
}
/**
@ -912,10 +912,10 @@ gtk_style_context_get_margin (GtkStyleContext *context,
style = gtk_style_context_lookup_style (context);
margin->top = round (_gtk_css_number_value_get (style->size->margin_top, 100));
margin->right = round (_gtk_css_number_value_get (style->size->margin_right, 100));
margin->bottom = round (_gtk_css_number_value_get (style->size->margin_bottom, 100));
margin->left = round (_gtk_css_number_value_get (style->size->margin_left, 100));
margin->top = round (gtk_css_number_value_get (style->size->margin_top, 100));
margin->right = round (gtk_css_number_value_get (style->size->margin_right, 100));
margin->bottom = round (gtk_css_number_value_get (style->size->margin_bottom, 100));
margin->left = round (gtk_css_number_value_get (style->size->margin_left, 100));
}
void

View File

@ -2691,8 +2691,8 @@ gtk_tree_view_get_expander_size (GtkTreeView *tree_view)
gtk_style_context_add_class (context, "expander");
style = gtk_style_context_lookup_style (context);
min_width = _gtk_css_number_value_get (style->size->min_width, 100);
min_height = _gtk_css_number_value_get (style->size->min_height, 100);
min_width = gtk_css_number_value_get (style->size->min_width, 100);
min_height = gtk_css_number_value_get (style->size->min_height, 100);
gtk_style_context_restore (context);
@ -5521,7 +5521,7 @@ get_separator_height (GtkTreeView *tree_view)
gtk_style_context_add_class (context, "separator");
style = gtk_style_context_lookup_style (context);
d = _gtk_css_number_value_get (style->size->min_height, 100);
d = gtk_css_number_value_get (style->size->min_height, 100);
if (d < 1)
min_size = ceil (d);

View File

@ -84,7 +84,7 @@ gtk_builtin_icon_measure (GtkWidget *widget,
style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
*minimum = *natural = _gtk_css_number_value_get (style->icon->icon_size, 100);
*minimum = *natural = gtk_css_number_value_get (style->icon->icon_size, 100);
}
static void

View File

@ -848,8 +848,8 @@ gtk_css_animated_style_create_css_transitions (GPtrArray *animations,
if (_gtk_css_array_value_get_n_values (durations) == 1 &&
_gtk_css_array_value_get_n_values (delays) == 1 &&
_gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, 0), 100) +
_gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, 0), 100) == 0)
gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, 0), 100) +
gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, 0), 100) == 0)
return animations;
transition_infos_set (transitions, base_style->transition->transition_property);
@ -864,8 +864,8 @@ gtk_css_animated_style_create_css_transitions (GPtrArray *animations,
if (!transitions[i].pending)
continue;
duration = _gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, transitions[i].index), 100);
delay = _gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, transitions[i].index), 100);
duration = gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, transitions[i].index), 100);
delay = gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, transitions[i].index), 100);
if (duration + delay == 0.0)
continue;
@ -997,13 +997,13 @@ gtk_css_animated_style_create_css_animations (GPtrArray *animations,
animation = _gtk_css_animation_new (name,
keyframes,
timestamp,
_gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, i), 100) * G_USEC_PER_SEC,
_gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, i), 100) * G_USEC_PER_SEC,
gtk_css_number_value_get (_gtk_css_array_value_get_nth (delays, i), 100) * G_USEC_PER_SEC,
gtk_css_number_value_get (_gtk_css_array_value_get_nth (durations, i), 100) * G_USEC_PER_SEC,
_gtk_css_array_value_get_nth (timing_functions, i),
_gtk_css_direction_value_get (_gtk_css_array_value_get_nth (directions, i)),
_gtk_css_play_state_value_get (_gtk_css_array_value_get_nth (play_states, i)),
_gtk_css_fill_mode_value_get (_gtk_css_array_value_get_nth (fill_modes, i)),
_gtk_css_number_value_get (_gtk_css_array_value_get_nth (iteration_counts, i), 100));
gtk_css_number_value_get (_gtk_css_array_value_get_nth (iteration_counts, i), 100));
}
if (!animations)

View File

@ -197,10 +197,10 @@ _gtk_css_bg_size_value_parse (GtkCssParser *parser)
x = NULL;
else
{
x = _gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
x = gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
if (x == NULL)
return NULL;
}
@ -211,10 +211,10 @@ _gtk_css_bg_size_value_parse (GtkCssParser *parser)
y = NULL;
else
{
y = _gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
y = gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
if (y == NULL)
{
gtk_css_value_unref (x);
@ -280,8 +280,8 @@ _gtk_css_bg_size_value_compute_size (const GtkCssValue *value,
double x, y;
/* note: 0 does the right thing later for 'auto' */
x = value->x ? _gtk_css_number_value_get (value->x, area_width) : 0;
y = value->y ? _gtk_css_number_value_get (value->y, area_height) : 0;
x = value->x ? gtk_css_number_value_get (value->x, area_width) : 0;
y = value->y ? gtk_css_number_value_get (value->y, area_height) : 0;
if ((x <= 0 && value->x) ||
(y <= 0 && value->y))

View File

@ -191,7 +191,7 @@ _gtk_css_border_value_parse (GtkCssParser *parser,
if (!gtk_css_number_value_can_parse (parser))
break;
result->values[i] = _gtk_css_number_value_parse (parser, flags);
result->values[i] = gtk_css_number_value_parse (parser, flags);
if (result->values[i] == NULL)
{
gtk_css_value_unref (result);

View File

@ -84,17 +84,17 @@ gtk_css_boxes_rect_grow (GskRoundedRect *dest,
if (gtk_css_dimension_value_is_zero (right))
dest->bounds.size.width = src->bounds.size.width;
else
dest->bounds.size.width = src->bounds.size.width + _gtk_css_number_value_get (right, 100);
dest->bounds.size.width = src->bounds.size.width + gtk_css_number_value_get (right, 100);
}
else
{
const double left_value = _gtk_css_number_value_get (left, 100);
const double left_value = gtk_css_number_value_get (left, 100);
dest->bounds.origin.x = src->bounds.origin.x - left_value;
if (gtk_css_dimension_value_is_zero (right))
dest->bounds.size.width = src->bounds.size.width + left_value;
else
dest->bounds.size.width = src->bounds.size.width + left_value + _gtk_css_number_value_get (right, 100);
dest->bounds.size.width = src->bounds.size.width + left_value + gtk_css_number_value_get (right, 100);
}
@ -105,17 +105,17 @@ gtk_css_boxes_rect_grow (GskRoundedRect *dest,
if (gtk_css_dimension_value_is_zero (bottom))
dest->bounds.size.height = src->bounds.size.height;
else
dest->bounds.size.height = src->bounds.size.height + _gtk_css_number_value_get (bottom, 100);
dest->bounds.size.height = src->bounds.size.height + gtk_css_number_value_get (bottom, 100);
}
else
{
const double top_value = _gtk_css_number_value_get (top, 100);
const double top_value = gtk_css_number_value_get (top, 100);
dest->bounds.origin.y = src->bounds.origin.y - top_value;
if (gtk_css_dimension_value_is_zero (bottom))
dest->bounds.size.height = src->bounds.size.height + top_value;
else
dest->bounds.size.height = src->bounds.size.height + top_value + _gtk_css_number_value_get (bottom, 100);
dest->bounds.size.height = src->bounds.size.height + top_value + gtk_css_number_value_get (bottom, 100);
}
}
@ -127,10 +127,10 @@ gtk_css_boxes_rect_shrink (GskRoundedRect *dest,
GtkCssValue *bottom_value,
GtkCssValue *left_value)
{
double top = _gtk_css_number_value_get (top_value, 100);
double right = _gtk_css_number_value_get (right_value, 100);
double bottom = _gtk_css_number_value_get (bottom_value, 100);
double left = _gtk_css_number_value_get (left_value, 100);
double top = gtk_css_number_value_get (top_value, 100);
double right = gtk_css_number_value_get (right_value, 100);
double bottom = gtk_css_number_value_get (bottom_value, 100);
double left = gtk_css_number_value_get (left_value, 100);
/* FIXME: Do we need underflow checks here? */
dest->bounds.origin.x = src->bounds.origin.x + left;
@ -255,8 +255,8 @@ gtk_css_boxes_compute_outline_rect (GtkCssBoxes *boxes)
dest = &boxes->box[GTK_CSS_AREA_OUTLINE_BOX].bounds;
src = &boxes->box[GTK_CSS_AREA_BORDER_BOX].bounds;
d = _gtk_css_number_value_get (boxes->style->outline->outline_offset, 100) +
_gtk_css_number_value_get (boxes->style->outline->outline_width, 100);
d = gtk_css_number_value_get (boxes->style->outline->outline_offset, 100) +
gtk_css_number_value_get (boxes->style->outline->outline_width, 100);
dest->origin.x = src->origin.x - d;
dest->origin.y = src->origin.y - d;
@ -483,8 +483,8 @@ gtk_css_boxes_compute_outline_box (GtkCssBoxes *boxes)
src = &boxes->box[GTK_CSS_AREA_BORDER_BOX];
dest = &boxes->box[GTK_CSS_AREA_OUTLINE_BOX];
d = _gtk_css_number_value_get (boxes->style->outline->outline_offset, 100) +
_gtk_css_number_value_get (boxes->style->outline->outline_width, 100);
d = gtk_css_number_value_get (boxes->style->outline->outline_offset, 100) +
gtk_css_number_value_get (boxes->style->outline->outline_width, 100);
/* Grow border rect into outline rect */
dest->bounds.origin.x = src->bounds.origin.x - d;

View File

@ -60,7 +60,7 @@ gtk_css_calc_value_parse_value (GtkCssParser *parser,
return result;
}
return _gtk_css_number_value_parse (parser, flags);
return gtk_css_number_value_parse (parser, flags);
}
static gboolean
@ -96,9 +96,9 @@ gtk_css_calc_value_parse_product (GtkCssParser *parser,
if (value == NULL)
goto fail;
if (is_number (value))
temp = gtk_css_number_value_multiply (result, _gtk_css_number_value_get (value, 100));
temp = gtk_css_number_value_multiply (result, gtk_css_number_value_get (value, 100));
else
temp = gtk_css_number_value_multiply (value, _gtk_css_number_value_get (result, 100));
temp = gtk_css_number_value_multiply (value, gtk_css_number_value_get (result, 100));
gtk_css_value_unref (value);
gtk_css_value_unref (result);
result = temp;
@ -108,7 +108,7 @@ gtk_css_calc_value_parse_product (GtkCssParser *parser,
value = gtk_css_calc_value_parse_product (parser, GTK_CSS_PARSE_NUMBER);
if (value == NULL)
goto fail;
temp = gtk_css_number_value_multiply (result, 1.0 / _gtk_css_number_value_get (value, 100));
temp = gtk_css_number_value_multiply (result, 1.0 / gtk_css_number_value_get (value, 100));
gtk_css_value_unref (value);
gtk_css_value_unref (result);
result = temp;
@ -232,3 +232,307 @@ gtk_css_calc_value_parse (GtkCssParser *parser,
return data.value;
}
typedef struct
{
GtkCssNumberParseFlags flags;
GPtrArray *values;
} ParseArgnData;
static guint
gtk_css_argn_value_parse_arg (GtkCssParser *parser,
guint arg,
gpointer data_)
{
ParseArgnData *data = data_;
GtkCssValue *value;
value = gtk_css_calc_value_parse_sum (parser, data->flags);
if (value == NULL)
return 0;
g_ptr_array_add (data->values, value);
return 1;
}
typedef struct
{
GtkCssNumberParseFlags flags;
GtkCssValue *values[3];
} ParseClampData;
static guint
gtk_css_clamp_value_parse_arg (GtkCssParser *parser,
guint arg,
gpointer data_)
{
ParseClampData *data = data_;
if ((arg == 0 || arg == 2))
{
if (gtk_css_parser_try_ident (parser, "none"))
{
data->values[arg] = NULL;
return 1;
}
}
data->values[arg] = gtk_css_calc_value_parse_sum (parser, data->flags);
if (data->values[arg] == NULL)
return 0;
return 1;
}
GtkCssValue *
gtk_css_clamp_value_parse (GtkCssParser *parser,
GtkCssNumberParseFlags flags,
guint type)
{
ParseClampData data;
GtkCssValue *result = NULL;
if (!gtk_css_parser_has_function (parser, "clamp"))
{
gtk_css_parser_error_syntax (parser, "Expected 'clamp('");
return NULL;
}
/* This can only be handled at compute time, we allow '-' after all */
data.flags = flags & ~GTK_CSS_POSITIVE_ONLY;
data.values[0] = NULL;
data.values[1] = NULL;
data.values[2] = NULL;
if (gtk_css_parser_consume_function (parser, 3, 3, gtk_css_clamp_value_parse_arg, &data))
{
GtkCssDimension dim = gtk_css_number_value_get_dimension (data.values[1]);
if ((data.values[0] && gtk_css_number_value_get_dimension (data.values[0]) != dim) ||
(data.values[2] && gtk_css_number_value_get_dimension (data.values[2]) != dim))
gtk_css_parser_error_syntax (parser, "Inconsistent types in 'clamp('");
else
result = gtk_css_math_value_new (type, 0, data.values, 3);
}
if (result == NULL)
{
g_clear_pointer (&data.values[0], gtk_css_value_unref);
g_clear_pointer (&data.values[1], gtk_css_value_unref);
g_clear_pointer (&data.values[2], gtk_css_value_unref);
}
return result;
}
typedef struct {
GtkCssNumberParseFlags flags;
guint mode;
gboolean has_mode;
GtkCssValue *values[2];
} ParseRoundData;
static guint
gtk_css_round_value_parse_arg (GtkCssParser *parser,
guint arg,
gpointer data_)
{
ParseRoundData *data = data_;
if (arg == 0)
{
const char *modes[] = { "nearest", "up", "down", "to-zero" };
for (guint i = 0; i < G_N_ELEMENTS (modes); i++)
{
if (gtk_css_parser_try_ident (parser, modes[i]))
{
data->mode = i;
data->has_mode = TRUE;
return 1;
}
}
data->values[0] = gtk_css_calc_value_parse_sum (parser, data->flags);
if (data->values[0] == NULL)
return 0;
}
else if (arg == 1)
{
GtkCssValue *value = gtk_css_calc_value_parse_sum (parser, data->flags);
if (value == NULL)
return 0;
if (data->has_mode)
data->values[0] = value;
else
data->values[1] = value;
}
else
{
if (!data->has_mode)
{
gtk_css_parser_error_syntax (parser, "Too many argument for 'round'");
return 0;
}
data->values[1] = gtk_css_calc_value_parse_sum (parser, data->flags);
if (data->values[1] == NULL)
return 0;
}
return 1;
}
GtkCssValue *
gtk_css_round_value_parse (GtkCssParser *parser,
GtkCssNumberParseFlags flags,
guint type)
{
ParseRoundData data;
GtkCssValue *result = NULL;
if (!gtk_css_parser_has_function (parser, "round"))
{
gtk_css_parser_error_syntax (parser, "Expected 'round('");
return NULL;
}
data.flags = flags & ~GTK_CSS_POSITIVE_ONLY;
data.mode = ROUND_NEAREST;
data.has_mode = FALSE;
data.values[0] = NULL;
data.values[1] = NULL;
if (gtk_css_parser_consume_function (parser, 1, 3, gtk_css_round_value_parse_arg, &data) &&
data.values[0] != NULL)
{
if (data.values[1] != NULL &&
gtk_css_number_value_get_dimension (data.values[0]) !=
gtk_css_number_value_get_dimension (data.values[1]))
gtk_css_parser_error_syntax (parser, "Inconsistent types in 'round('");
else if (data.values[1] == NULL &&
gtk_css_number_value_get_dimension (data.values[0]) != GTK_CSS_DIMENSION_NUMBER)
gtk_css_parser_error_syntax (parser, "Can't omit second argument to 'round(' here");
else
result = gtk_css_math_value_new (type, data.mode, data.values, data.values[1] != NULL ? 2 : 1);
}
if (result == NULL)
{
g_clear_pointer (&data.values[0], gtk_css_value_unref);
g_clear_pointer (&data.values[1], gtk_css_value_unref);
}
return result;
}
typedef struct {
GtkCssNumberParseFlags flags;
GtkCssValue *values[2];
} ParseArg2Data;
static guint
gtk_css_arg2_value_parse_arg (GtkCssParser *parser,
guint arg,
gpointer data_)
{
ParseArg2Data *data = data_;
data->values[arg] = gtk_css_calc_value_parse_sum (parser, data->flags);
if (data->values[arg] == NULL)
return 0;
return 1;
}
GtkCssValue *
gtk_css_arg2_value_parse (GtkCssParser *parser,
GtkCssNumberParseFlags flags,
guint min_args,
guint max_args,
const char *function,
guint type)
{
ParseArg2Data data;
GtkCssValue *result = NULL;
g_assert (1 <= min_args && min_args <= max_args && max_args <= 2);
if (!gtk_css_parser_has_function (parser, function))
{
gtk_css_parser_error_syntax (parser, "Expected '%s('", function);
return NULL;
}
data.flags = flags & ~GTK_CSS_POSITIVE_ONLY;
data.values[0] = NULL;
data.values[1] = NULL;
if (gtk_css_parser_consume_function (parser, min_args, max_args, gtk_css_arg2_value_parse_arg, &data))
{
if (data.values[1] != NULL &&
gtk_css_number_value_get_dimension (data.values[0]) !=
gtk_css_number_value_get_dimension (data.values[1]))
gtk_css_parser_error_syntax (parser, "Inconsistent types in '%s('", function);
else
result = gtk_css_math_value_new (type, 0, data.values, data.values[1] != NULL ? 2 : 1);
}
if (result == NULL)
{
g_clear_pointer (&data.values[0], gtk_css_value_unref);
g_clear_pointer (&data.values[1], gtk_css_value_unref);
}
return result;
}
GtkCssValue *
gtk_css_argn_value_parse (GtkCssParser *parser,
GtkCssNumberParseFlags flags,
const char *function,
guint type)
{
ParseArgnData data;
GtkCssValue *result = NULL;
if (!gtk_css_parser_has_function (parser, function))
{
gtk_css_parser_error_syntax (parser, "Expected '%s('", function);
return NULL;
}
/* This can only be handled at compute time, we allow '-' after all */
data.flags = flags & ~GTK_CSS_POSITIVE_ONLY;
data.values = g_ptr_array_new ();
if (gtk_css_parser_consume_function (parser, 1, G_MAXUINT, gtk_css_argn_value_parse_arg, &data))
{
GtkCssValue *val = (GtkCssValue *) g_ptr_array_index (data.values, 0);
GtkCssDimension dim = gtk_css_number_value_get_dimension (val);
guint i;
for (i = 1; i < data.values->len; i++)
{
val = (GtkCssValue *) g_ptr_array_index (data.values, i);
if (gtk_css_number_value_get_dimension (val) != dim)
break;
}
if (i < data.values->len)
gtk_css_parser_error_syntax (parser, "Inconsistent types in '%s('", function);
else
result = gtk_css_math_value_new (type, 0, (GtkCssValue **)data.values->pdata, data.values->len);
}
if (result == NULL)
{
for (guint i = 0; i < data.values->len; i++)
gtk_css_value_unref ((GtkCssValue *)g_ptr_array_index (data.values, i));
}
g_ptr_array_unref (data.values);
return result;
}

View File

@ -23,6 +23,21 @@ G_BEGIN_DECLS
GtkCssValue * gtk_css_calc_value_parse (GtkCssParser *parser,
GtkCssNumberParseFlags flags);
GtkCssValue * gtk_css_clamp_value_parse (GtkCssParser *parser,
GtkCssNumberParseFlags flags,
guint type);
GtkCssValue * gtk_css_round_value_parse (GtkCssParser *parser,
GtkCssNumberParseFlags flags,
guint type);
GtkCssValue * gtk_css_arg2_value_parse (GtkCssParser *parser,
GtkCssNumberParseFlags flags,
guint min_args,
guint max_args,
const char *function,
guint type);
GtkCssValue * gtk_css_argn_value_parse (GtkCssParser *parser,
GtkCssNumberParseFlags flags,
const char *function,
guint type);
G_END_DECLS

View File

@ -170,10 +170,10 @@ _gtk_css_corner_value_parse (GtkCssParser *parser)
{
GtkCssValue *x, *y;
x = _gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
x = gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
if (x == NULL)
return NULL;
@ -181,10 +181,10 @@ _gtk_css_corner_value_parse (GtkCssParser *parser)
y = gtk_css_value_ref (x);
else
{
y = _gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
y = gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
if (y == NULL)
{
gtk_css_value_unref (x);
@ -202,7 +202,7 @@ _gtk_css_corner_value_get_x (const GtkCssValue *corner,
g_return_val_if_fail (corner != NULL, 0.0);
g_return_val_if_fail (corner->class == &GTK_CSS_VALUE_CORNER, 0.0);
return _gtk_css_number_value_get (corner->x, one_hundred_percent);
return gtk_css_number_value_get (corner->x, one_hundred_percent);
}
double
@ -212,7 +212,7 @@ _gtk_css_corner_value_get_y (const GtkCssValue *corner,
g_return_val_if_fail (corner != NULL, 0.0);
g_return_val_if_fail (corner->class == &GTK_CSS_VALUE_CORNER, 0.0);
return _gtk_css_number_value_get (corner->y, one_hundred_percent);
return gtk_css_number_value_get (corner->y, one_hundred_percent);
}
gboolean

View File

@ -198,7 +198,7 @@ _gtk_css_blend_mode_value_get (const GtkCssValue *value)
static double
get_dpi (GtkCssStyle *style)
{
return _gtk_css_number_value_get (style->core->dpi, 96);
return gtk_css_number_value_get (style->core->dpi, 96);
}
/* XXX: Kinda bad to have that machinery here, nobody expects vital font
@ -265,7 +265,7 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
break;
case GTK_CSS_FONT_SIZE_SMALLER:
if (parent_style)
font_size = _gtk_css_number_value_get (parent_style->core->font_size, 100);
font_size = gtk_css_number_value_get (parent_style->core->font_size, 100);
else
font_size = gtk_css_font_size_get_default_px (provider, style);
/* This is what WebKit does... */
@ -273,7 +273,7 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
break;
case GTK_CSS_FONT_SIZE_LARGER:
if (parent_style)
font_size = _gtk_css_number_value_get (parent_style->core->font_size, 100);
font_size = gtk_css_number_value_get (parent_style->core->font_size, 100);
else
font_size = gtk_css_font_size_get_default_px (provider, style);
/* This is what WebKit does... */
@ -281,7 +281,7 @@ gtk_css_value_font_size_compute (GtkCssValue *value,
break;
}
return _gtk_css_number_value_new (font_size, GTK_CSS_PX);
return gtk_css_number_value_new (font_size, GTK_CSS_PX);
}
static const GtkCssValueClass GTK_CSS_VALUE_FONT_SIZE = {
@ -407,7 +407,7 @@ gtk_css_value_font_weight_compute (GtkCssValue *value,
return gtk_css_value_ref (value);
if (context->parent_style)
parent_value = _gtk_css_number_value_get (context->parent_style->font->font_weight, 100);
parent_value = gtk_css_number_value_get (context->parent_style->font->font_weight, 100);
else
parent_value = 400;
@ -435,7 +435,7 @@ gtk_css_value_font_weight_compute (GtkCssValue *value,
new_weight = PANGO_WEIGHT_NORMAL;
}
return _gtk_css_number_value_new (new_weight, GTK_CSS_NUMBER);
return gtk_css_number_value_new (new_weight, GTK_CSS_NUMBER);
}
static const GtkCssValueClass GTK_CSS_VALUE_FONT_WEIGHT = {
@ -468,9 +468,9 @@ gtk_css_font_weight_value_try_parse (GtkCssParser *parser)
}
if (gtk_css_parser_try_ident (parser, "normal"))
return _gtk_css_number_value_new (PANGO_WEIGHT_NORMAL, GTK_CSS_NUMBER);
return gtk_css_number_value_new (PANGO_WEIGHT_NORMAL, GTK_CSS_NUMBER);
if (gtk_css_parser_try_ident (parser, "bold"))
return _gtk_css_number_value_new (PANGO_WEIGHT_BOLD, GTK_CSS_NUMBER);
return gtk_css_number_value_new (PANGO_WEIGHT_BOLD, GTK_CSS_NUMBER);
return NULL;
}

View File

@ -108,31 +108,31 @@ gtk_css_filter_init_identity (GtkCssFilter *filter,
switch (other->type)
{
case GTK_CSS_FILTER_BRIGHTNESS:
filter->brightness.value = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
filter->brightness.value = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
break;
case GTK_CSS_FILTER_CONTRAST:
filter->contrast.value = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
filter->contrast.value = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
break;
case GTK_CSS_FILTER_GRAYSCALE:
filter->grayscale.value = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
filter->grayscale.value = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
break;
case GTK_CSS_FILTER_HUE_ROTATE:
filter->hue_rotate.value = _gtk_css_number_value_new (0, GTK_CSS_DEG);
filter->hue_rotate.value = gtk_css_number_value_new (0, GTK_CSS_DEG);
break;
case GTK_CSS_FILTER_INVERT:
filter->invert.value = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
filter->invert.value = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
break;
case GTK_CSS_FILTER_OPACITY:
filter->opacity.value = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
filter->opacity.value = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
break;
case GTK_CSS_FILTER_SATURATE:
filter->saturate.value = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
filter->saturate.value = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
break;
case GTK_CSS_FILTER_SEPIA:
filter->sepia.value = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
filter->sepia.value = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
break;
case GTK_CSS_FILTER_BLUR:
filter->blur.value = _gtk_css_number_value_new (0, GTK_CSS_PX);
filter->blur.value = gtk_css_number_value_new (0, GTK_CSS_PX);
break;
case GTK_CSS_FILTER_DROP_SHADOW:
filter->drop_shadow.value = gtk_css_shadow_value_new_filter (other->drop_shadow.value);
@ -160,19 +160,19 @@ gtk_css_filter_get_matrix (const GtkCssFilter *filter,
switch (filter->type)
{
case GTK_CSS_FILTER_BRIGHTNESS:
value = _gtk_css_number_value_get (filter->brightness.value, 1.0);
value = gtk_css_number_value_get (filter->brightness.value, 1.0);
graphene_matrix_init_scale (matrix, value, value, value);
graphene_vec4_init (offset, 0.0, 0.0, 0.0, 0.0);
break;
case GTK_CSS_FILTER_CONTRAST:
value = _gtk_css_number_value_get (filter->contrast.value, 1.0);
value = gtk_css_number_value_get (filter->contrast.value, 1.0);
graphene_matrix_init_scale (matrix, value, value, value);
graphene_vec4_init (offset, 0.5 - 0.5 * value, 0.5 - 0.5 * value, 0.5 - 0.5 * value, 0.0);
break;
case GTK_CSS_FILTER_GRAYSCALE:
value = _gtk_css_number_value_get (filter->grayscale.value, 1.0);
value = gtk_css_number_value_get (filter->grayscale.value, 1.0);
graphene_matrix_init_from_float (matrix, (float[16]) {
1.0 - (1.0 - R) * value, R * value, R * value, 0.0,
G * value, 1.0 - (1.0 - G) * value, G * value, 0.0,
@ -185,7 +185,7 @@ gtk_css_filter_get_matrix (const GtkCssFilter *filter,
case GTK_CSS_FILTER_HUE_ROTATE:
{
double c, s;
value = _gtk_css_number_value_get (filter->grayscale.value, 1.0) * G_PI / 180.0;
value = gtk_css_number_value_get (filter->grayscale.value, 1.0) * G_PI / 180.0;
c = cos (value);
s = sin (value);
graphene_matrix_init_from_float (matrix, (float[16]) {
@ -208,13 +208,13 @@ gtk_css_filter_get_matrix (const GtkCssFilter *filter,
break;
case GTK_CSS_FILTER_INVERT:
value = _gtk_css_number_value_get (filter->invert.value, 1.0);
value = gtk_css_number_value_get (filter->invert.value, 1.0);
graphene_matrix_init_scale (matrix, 1.0 - 2 * value, 1.0 - 2 * value, 1.0 - 2 * value);
graphene_vec4_init (offset, value, value, value, 0.0);
break;
case GTK_CSS_FILTER_OPACITY:
value = _gtk_css_number_value_get (filter->opacity.value, 1.0);
value = gtk_css_number_value_get (filter->opacity.value, 1.0);
graphene_matrix_init_from_float (matrix, (float[16]) {
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
@ -225,7 +225,7 @@ gtk_css_filter_get_matrix (const GtkCssFilter *filter,
break;
case GTK_CSS_FILTER_SATURATE:
value = _gtk_css_number_value_get (filter->saturate.value, 1.0);
value = gtk_css_number_value_get (filter->saturate.value, 1.0);
graphene_matrix_init_from_float (matrix, (float[16]) {
R + (1.0 - R) * value, R - R * value, R - R * value, 0.0,
G - G * value, G + (1.0 - G) * value, G - G * value, 0.0,
@ -236,7 +236,7 @@ gtk_css_filter_get_matrix (const GtkCssFilter *filter,
break;
case GTK_CSS_FILTER_SEPIA:
value = _gtk_css_number_value_get (filter->sepia.value, 1.0);
value = gtk_css_number_value_get (filter->sepia.value, 1.0);
graphene_matrix_init_from_float (matrix, (float[16]) {
1.0 - 0.607 * value, 0.349 * value, 0.272 * value, 0.0,
0.769 * value, 1.0 - 0.314 * value, 0.534 * value, 0.0,
@ -751,7 +751,7 @@ gtk_css_filter_parse_number (GtkCssParser *parser,
{
GtkCssValue **values = data;
values[n] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER | GTK_CSS_PARSE_PERCENT | GTK_CSS_POSITIVE_ONLY);
values[n] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER | GTK_CSS_PARSE_PERCENT | GTK_CSS_POSITIVE_ONLY);
if (values[n] == NULL)
return 0;
@ -765,7 +765,7 @@ gtk_css_filter_parse_length (GtkCssParser *parser,
{
GtkCssValue **values = data;
values[n] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_POSITIVE_ONLY);
values[n] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_POSITIVE_ONLY);
if (values[n] == NULL)
return 0;
@ -779,7 +779,7 @@ gtk_css_filter_parse_angle (GtkCssParser *parser,
{
GtkCssValue **values = data;
values[n] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
values[n] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
if (values[n] == NULL)
return 0;
@ -957,7 +957,7 @@ gtk_css_filter_value_push_snapshot (const GtkCssValue *filter,
{
if (filter->filters[j].type == GTK_CSS_FILTER_BLUR)
{
double std_dev = _gtk_css_number_value_get (filter->filters[j].blur.value, 100.0);
double std_dev = gtk_css_number_value_get (filter->filters[j].blur.value, 100.0);
gtk_snapshot_push_blur (snapshot, 2 * std_dev);
}
else if (filter->filters[j].type == GTK_CSS_FILTER_DROP_SHADOW)

View File

@ -229,7 +229,7 @@ gtk_css_font_variations_value_parse (GtkCssParser *parser)
return NULL;
}
coord = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
coord = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
if (coord == NULL)
{
g_free (name);
@ -268,7 +268,7 @@ gtk_css_font_variations_value_get_variations (GtkCssValue *value)
else
g_string_append (string, ",");
g_string_append_printf (string, "%s=%g", name,
_gtk_css_number_value_get (coord, 100));
gtk_css_number_value_get (coord, 100));
}
return g_string_free (string, FALSE);

View File

@ -61,7 +61,7 @@ gtk_css_image_conic_snapshot (GtkCssImage *image,
}
else
{
pos = _gtk_css_number_value_get (stop->offset, 360) / 360;
pos = gtk_css_number_value_get (stop->offset, 360) / 360;
pos = CLAMP (pos, 0.0, 1.0);
}
@ -86,7 +86,7 @@ gtk_css_image_conic_snapshot (GtkCssImage *image,
&GRAPHENE_RECT_INIT (0, 0, width, height),
&GRAPHENE_POINT_INIT (_gtk_css_position_value_get_x (self->center, width),
_gtk_css_position_value_get_y (self->center, height)),
_gtk_css_number_value_get (self->rotation, 360),
gtk_css_number_value_get (self->rotation, 360),
stops,
self->n_stops);
}
@ -98,13 +98,13 @@ parse_angles (GtkCssParser *parser,
{
GtkCssValue **angles = option_data;
angles[0] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE | GTK_CSS_PARSE_PERCENT);
angles[0] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE | GTK_CSS_PARSE_PERCENT);
if (angles[0] == NULL)
return FALSE;
if (gtk_css_number_value_can_parse (parser))
{
angles[1] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE | GTK_CSS_PARSE_PERCENT);
angles[1] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE | GTK_CSS_PARSE_PERCENT);
if (angles[1] == NULL)
return FALSE;
}
@ -176,14 +176,14 @@ gtk_css_image_conic_parse_first_arg (GtkCssImageConic *self,
if (gtk_css_parser_try_ident (parser, "from"))
{
self->rotation = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
self->rotation = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
if (self->rotation == NULL)
return 0;
nothing_parsed = FALSE;
}
else
{
self->rotation = _gtk_css_number_value_new (0, GTK_CSS_DEG);
self->rotation = gtk_css_number_value_new (0, GTK_CSS_DEG);
}
if (gtk_css_parser_try_ident (parser, "at"))
@ -195,8 +195,8 @@ gtk_css_image_conic_parse_first_arg (GtkCssImageConic *self,
}
else
{
self->center = _gtk_css_position_value_new (_gtk_css_number_value_new (50, GTK_CSS_PERCENT),
_gtk_css_number_value_new (50, GTK_CSS_PERCENT));
self->center = _gtk_css_position_value_new (gtk_css_number_value_new (50, GTK_CSS_PERCENT),
gtk_css_number_value_new (50, GTK_CSS_PERCENT));
}
if (!nothing_parsed)
@ -269,8 +269,8 @@ gtk_css_image_conic_print (GtkCssImage *image,
if (self->center)
{
GtkCssValue *compare = _gtk_css_position_value_new (_gtk_css_number_value_new (50, GTK_CSS_PERCENT),
_gtk_css_number_value_new (50, GTK_CSS_PERCENT));
GtkCssValue *compare = _gtk_css_position_value_new (gtk_css_number_value_new (50, GTK_CSS_PERCENT),
gtk_css_number_value_new (50, GTK_CSS_PERCENT));
if (!gtk_css_value_equal (self->center, compare))
{
@ -282,7 +282,7 @@ gtk_css_image_conic_print (GtkCssImage *image,
gtk_css_value_unref (compare);
}
if (self->rotation && _gtk_css_number_value_get (self->rotation, 360) != 0)
if (self->rotation && gtk_css_number_value_get (self->rotation, 360) != 0)
{
if (written)
g_string_append_c (string, ' ');

View File

@ -289,10 +289,10 @@ parse_progress (GtkCssParser *parser,
double *progress = option_data;
GtkCssValue *number;
number = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_PERCENT | GTK_CSS_POSITIVE_ONLY);
number = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_PERCENT | GTK_CSS_POSITIVE_ONLY);
if (number == NULL)
return FALSE;
*progress = _gtk_css_number_value_get (number, 1);
*progress = gtk_css_number_value_get (number, 1);
gtk_css_value_unref (number);
if (*progress > 1.0)

View File

@ -46,7 +46,7 @@ gtk_css_image_linear_get_repeating_start_end (GtkCssImageLinear *linear,
if (stop->offset == NULL)
*start = 0;
else
*start = _gtk_css_number_value_get (stop->offset, length) / length;
*start = gtk_css_number_value_get (stop->offset, length) / length;
*end = *start;
@ -57,7 +57,7 @@ gtk_css_image_linear_get_repeating_start_end (GtkCssImageLinear *linear,
if (stop->offset == NULL)
continue;
pos = _gtk_css_number_value_get (stop->offset, length) / length;
pos = gtk_css_number_value_get (stop->offset, length) / length;
*end = MAX (pos, *end);
}
@ -174,7 +174,7 @@ gtk_css_image_linear_snapshot (GtkCssImage *image,
}
else
{
angle = _gtk_css_number_value_get (linear->angle, 100);
angle = gtk_css_number_value_get (linear->angle, 100);
}
gtk_css_image_linear_compute_start_point (angle,
@ -224,7 +224,7 @@ gtk_css_image_linear_snapshot (GtkCssImage *image,
}
else
{
pos = _gtk_css_number_value_get (stop->offset, length) / length;
pos = gtk_css_number_value_get (stop->offset, length) / length;
pos = CLAMP (pos, 0.0, 1.0);
}
@ -279,9 +279,9 @@ gtk_css_image_linear_parse_color_stop (GtkCssImageLinear *self,
if (gtk_css_number_value_can_parse (parser))
{
stop.offset = _gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
stop.offset = gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
if (stop.offset == NULL)
{
gtk_css_value_unref (stop.color);
@ -359,7 +359,7 @@ gtk_css_image_linear_parse_first_arg (GtkCssImageLinear *linear,
}
else if (gtk_css_number_value_can_parse (parser))
{
linear->angle = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
linear->angle = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
if (linear->angle == NULL)
return 0;

View File

@ -47,7 +47,7 @@ gtk_css_image_radial_get_start_end (GtkCssImageRadial *radial,
if (stop->offset == NULL)
*start = 0;
else
*start = _gtk_css_number_value_get (stop->offset, radius) / radius;
*start = gtk_css_number_value_get (stop->offset, radius) / radius;
*end = *start;
@ -58,7 +58,7 @@ gtk_css_image_radial_get_start_end (GtkCssImageRadial *radial,
if (stop->offset == NULL)
continue;
pos = _gtk_css_number_value_get (stop->offset, radius) / radius;
pos = gtk_css_number_value_get (stop->offset, radius) / radius;
*end = MAX (pos, *end);
}
@ -96,7 +96,7 @@ gtk_css_image_radial_snapshot (GtkCssImage *image,
switch (radial->size)
{
case GTK_CSS_EXPLICIT_SIZE:
hradius = _gtk_css_number_value_get (radial->sizes[0], width);
hradius = gtk_css_number_value_get (radial->sizes[0], width);
break;
case GTK_CSS_CLOSEST_SIDE:
hradius = MIN (MIN (x, width - x), MIN (y, height - y));
@ -128,8 +128,8 @@ gtk_css_image_radial_snapshot (GtkCssImage *image,
switch (radial->size)
{
case GTK_CSS_EXPLICIT_SIZE:
hradius = _gtk_css_number_value_get (radial->sizes[0], width);
vradius = _gtk_css_number_value_get (radial->sizes[1], height);
hradius = gtk_css_number_value_get (radial->sizes[0], width);
vradius = gtk_css_number_value_get (radial->sizes[1], height);
break;
case GTK_CSS_CLOSEST_SIDE:
hradius = MIN (x, width - x);
@ -176,7 +176,7 @@ gtk_css_image_radial_snapshot (GtkCssImage *image,
continue;
}
else
pos = MIN (1.0, _gtk_css_number_value_get (stop->offset, hradius) / hradius);
pos = MIN (1.0, gtk_css_number_value_get (stop->offset, hradius) / hradius);
pos = MAX (pos, offset);
step = (pos - offset) / (i - last);
@ -229,9 +229,9 @@ gtk_css_image_radial_parse_color_stop (GtkCssImageRadial *radial,
if (gtk_css_number_value_can_parse (parser))
{
stop.offset = _gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
stop.offset = gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
if (stop.offset == NULL)
{
gtk_css_value_unref (stop.color);
@ -294,12 +294,12 @@ gtk_css_image_radial_parse_first_arg (GtkCssImageRadial *radial,
if (!has_size && gtk_css_number_value_can_parse (parser))
{
radial->sizes[0] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_PARSE_PERCENT);
radial->sizes[0] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_PARSE_PERCENT);
if (radial->sizes[0] == NULL)
return 0;
if (gtk_css_number_value_can_parse (parser))
{
radial->sizes[1] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_PARSE_PERCENT);
radial->sizes[1] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_PARSE_PERCENT);
if (radial->sizes[1] == NULL)
return 0;
}
@ -323,8 +323,8 @@ gtk_css_image_radial_parse_first_arg (GtkCssImageRadial *radial,
}
else
{
radial->position = _gtk_css_position_value_new (_gtk_css_number_value_new (50, GTK_CSS_PERCENT),
_gtk_css_number_value_new (50, GTK_CSS_PERCENT));
radial->position = _gtk_css_position_value_new (gtk_css_number_value_new (50, GTK_CSS_PERCENT),
gtk_css_number_value_new (50, GTK_CSS_PERCENT));
}
if (!has_size)

View File

@ -55,7 +55,7 @@ gtk_css_value_initial_compute (GtkCssValue *value,
g_object_get (settings, "gtk-xft-dpi", &dpi_int, NULL);
if (dpi_int > 0.0)
return _gtk_css_number_value_new (dpi_int / 1024., GTK_CSS_NUMBER);
return gtk_css_number_value_new (dpi_int / 1024., GTK_CSS_NUMBER);
}
break;

View File

@ -52,7 +52,7 @@ gtk_css_value_line_height_compute (GtkCssValue *value,
double factor;
GtkCssValue *computed;
factor = _gtk_css_number_value_get (height, 1);
factor = gtk_css_number_value_get (height, 1);
computed = gtk_css_number_value_multiply (context->style->core->font_size, factor);
gtk_css_value_unref (height);
@ -154,10 +154,10 @@ gtk_css_line_height_value_parse (GtkCssParser *parser)
if (gtk_css_parser_try_ident (parser, "normal"))
return gtk_css_value_ref (gtk_css_line_height_value_get_default ());
height = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER |
GTK_CSS_PARSE_PERCENT |
GTK_CSS_PARSE_LENGTH |
GTK_CSS_POSITIVE_ONLY);
height = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER |
GTK_CSS_PARSE_PERCENT |
GTK_CSS_PARSE_LENGTH |
GTK_CSS_POSITIVE_ONLY);
if (!height)
return NULL;
@ -170,5 +170,5 @@ gtk_css_line_height_value_get (const GtkCssValue *value)
if (value->class == &GTK_CSS_VALUE_LINE_HEIGHT)
return 0.0;
return _gtk_css_number_value_get (value, 1);
return gtk_css_number_value_get (value, 1);
}

File diff suppressed because it is too large Load Diff

View File

@ -36,13 +36,15 @@ typedef enum /*< skip >*/ {
GTK_CSS_PARSE_TIME = (1 << 5)
} GtkCssNumberParseFlags;
#define GTK_CSS_PARSE_DIMENSION (GTK_CSS_PARSE_LENGTH|GTK_CSS_PARSE_ANGLE|GTK_CSS_PARSE_TIME)
GtkCssValue * gtk_css_dimension_value_new (double value,
GtkCssUnit unit);
GtkCssValue * _gtk_css_number_value_new (double value,
GtkCssValue * gtk_css_number_value_new (double value,
GtkCssUnit unit);
gboolean gtk_css_number_value_can_parse (GtkCssParser *parser);
GtkCssValue * _gtk_css_number_value_parse (GtkCssParser *parser,
GtkCssValue * gtk_css_number_value_parse (GtkCssParser *parser,
GtkCssNumberParseFlags flags);
GtkCssDimension gtk_css_number_value_get_dimension (const GtkCssValue *value) G_GNUC_PURE;
@ -53,10 +55,22 @@ GtkCssValue * gtk_css_number_value_add (GtkCssValue *val
GtkCssValue *value2);
GtkCssValue * gtk_css_number_value_try_add (GtkCssValue *value1,
GtkCssValue *value2);
double _gtk_css_number_value_get (const GtkCssValue *number,
double gtk_css_number_value_get (const GtkCssValue *number,
double one_hundred_percent) G_GNUC_PURE;
gboolean gtk_css_dimension_value_is_zero (const GtkCssValue *value) G_GNUC_PURE;
enum {
ROUND_NEAREST,
ROUND_UP,
ROUND_DOWN,
ROUND_TO_ZERO,
};
GtkCssValue * gtk_css_math_value_new (guint type,
guint mode,
GtkCssValue **values,
guint n_values);
G_END_DECLS

View File

@ -92,10 +92,10 @@ gtk_css_value_position_print (const GtkCssValue *position,
const char *y_name;
GtkCssValue *number;
} values[] = {
{ "left", "top", _gtk_css_number_value_new (0, GTK_CSS_PERCENT) },
{ "right", "bottom", _gtk_css_number_value_new (100, GTK_CSS_PERCENT) }
{ "left", "top", gtk_css_number_value_new (0, GTK_CSS_PERCENT) },
{ "right", "bottom", gtk_css_number_value_new (100, GTK_CSS_PERCENT) }
};
GtkCssValue *center = _gtk_css_number_value_new (50, GTK_CSS_PERCENT);
GtkCssValue *center = gtk_css_number_value_new (50, GTK_CSS_PERCENT);
guint i;
if (gtk_css_value_equal (position->x, center))
@ -196,9 +196,9 @@ position_value_parse (GtkCssParser *parser, gboolean try)
if (gtk_css_parser_try_ident (parser, names[i].name))
{
if (names[i].horizontal)
x = _gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
x = gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
else
y = _gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
y = gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
swap = names[i].swap;
break;
}
@ -207,9 +207,9 @@ position_value_parse (GtkCssParser *parser, gboolean try)
{
if (gtk_css_number_value_can_parse (parser))
{
x = _gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
x = gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
if (x == NULL)
return NULL;
@ -239,17 +239,17 @@ position_value_parse (GtkCssParser *parser, gboolean try)
if (names[i].horizontal && !names[i].swap)
{
y = x;
x = _gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
x = gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
}
else
{
y = _gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
y = gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
}
}
else
{
g_assert (names[i].horizontal || names[i].swap);
x = _gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
x = gtk_css_number_value_new (names[i].percentage, GTK_CSS_PERCENT);
}
break;
}
@ -266,9 +266,9 @@ position_value_parse (GtkCssParser *parser, gboolean try)
gtk_css_value_unref (y);
return NULL;
}
y = _gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
y = gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
if (y == NULL)
{
gtk_css_value_unref (x);
@ -278,9 +278,9 @@ position_value_parse (GtkCssParser *parser, gboolean try)
else
{
if (y)
x = _gtk_css_number_value_new (50, GTK_CSS_PERCENT);
x = gtk_css_number_value_new (50, GTK_CSS_PERCENT);
else
y = _gtk_css_number_value_new (50, GTK_CSS_PERCENT);
y = gtk_css_number_value_new (50, GTK_CSS_PERCENT);
}
}
@ -304,13 +304,13 @@ gtk_css_position_value_parse_spacing (GtkCssParser *parser)
{
GtkCssValue *x, *y;
x = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_POSITIVE_ONLY);
x = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_POSITIVE_ONLY);
if (x == NULL)
return NULL;
if (gtk_css_number_value_can_parse (parser))
{
y = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_POSITIVE_ONLY);
y = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH | GTK_CSS_POSITIVE_ONLY);
if (y == NULL)
{
gtk_css_value_unref (x);
@ -332,7 +332,7 @@ _gtk_css_position_value_get_x (const GtkCssValue *position,
g_return_val_if_fail (position != NULL, 0.0);
g_return_val_if_fail (position->class == &GTK_CSS_VALUE_POSITION, 0.0);
return _gtk_css_number_value_get (position->x, one_hundred_percent);
return gtk_css_number_value_get (position->x, one_hundred_percent);
}
double
@ -342,6 +342,6 @@ _gtk_css_position_value_get_y (const GtkCssValue *position,
g_return_val_if_fail (position != NULL, 0.0);
g_return_val_if_fail (position->class == &GTK_CSS_VALUE_POSITION, 0.0);
return _gtk_css_number_value_get (position->y, one_hundred_percent);
return gtk_css_number_value_get (position->y, one_hundred_percent);
}

View File

@ -59,10 +59,10 @@ shadow_value_for_transition (ShadowValue *result,
gboolean inset)
{
result->inset = inset;
result->hoffset = _gtk_css_number_value_new (0, GTK_CSS_PX);
result->voffset = _gtk_css_number_value_new (0, GTK_CSS_PX);
result->radius = _gtk_css_number_value_new (0, GTK_CSS_PX);
result->spread = _gtk_css_number_value_new (0, GTK_CSS_PX);
result->hoffset = gtk_css_number_value_new (0, GTK_CSS_PX);
result->voffset = gtk_css_number_value_new (0, GTK_CSS_PX);
result->radius = gtk_css_number_value_new (0, GTK_CSS_PX);
result->spread = gtk_css_number_value_new (0, GTK_CSS_PX);
result->color = gtk_css_color_value_new_transparent ();
}
@ -254,14 +254,14 @@ gtk_css_value_shadow_print (const GtkCssValue *value,
g_string_append_c (string, ' ');
gtk_css_value_print (shadow->voffset, string);
g_string_append_c (string, ' ');
if (_gtk_css_number_value_get (shadow->radius, 100) != 0 ||
_gtk_css_number_value_get (shadow->spread, 100) != 0)
if (gtk_css_number_value_get (shadow->radius, 100) != 0 ||
gtk_css_number_value_get (shadow->spread, 100) != 0)
{
gtk_css_value_print (shadow->radius, string);
g_string_append_c (string, ' ');
}
if (_gtk_css_number_value_get (shadow->spread, 100) != 0)
if (gtk_css_number_value_get (shadow->spread, 100) != 0)
{
gtk_css_value_print (shadow->spread, string);
g_string_append_c (string, ' ');
@ -335,10 +335,10 @@ gtk_css_shadow_value_new_filter (const GtkCssValue *other)
ShadowValue value;
value.inset = FALSE;
value.hoffset = _gtk_css_number_value_new (0, GTK_CSS_PX);
value.voffset = _gtk_css_number_value_new (0, GTK_CSS_PX);
value.radius = _gtk_css_number_value_new (0, GTK_CSS_PX);
value.spread = _gtk_css_number_value_new (0, GTK_CSS_PX);
value.hoffset = gtk_css_number_value_new (0, GTK_CSS_PX);
value.voffset = gtk_css_number_value_new (0, GTK_CSS_PX);
value.radius = gtk_css_number_value_new (0, GTK_CSS_PX);
value.spread = gtk_css_number_value_new (0, GTK_CSS_PX);
value.color = gtk_css_value_ref (other->shadows[0].color);
return gtk_css_shadow_value_new (&value, 1, TRUE);
@ -385,36 +385,36 @@ parse_lengths (GtkCssParser *parser,
{
GtkCssValue **values = option_data;
values[HOFFSET] = _gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_LENGTH);
values[HOFFSET] = gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_LENGTH);
if (values[HOFFSET] == NULL)
return FALSE;
values[VOFFSET] = _gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_LENGTH);
values[VOFFSET] = gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_LENGTH);
if (values[VOFFSET] == NULL)
return FALSE;
if (gtk_css_number_value_can_parse (parser))
{
values[RADIUS] = _gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_LENGTH
| GTK_CSS_POSITIVE_ONLY);
values[RADIUS] = gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_LENGTH
| GTK_CSS_POSITIVE_ONLY);
if (values[RADIUS] == NULL)
return FALSE;
}
else
values[RADIUS] = _gtk_css_number_value_new (0.0, GTK_CSS_PX);
values[RADIUS] = gtk_css_number_value_new (0.0, GTK_CSS_PX);
if (box_shadow_mode && gtk_css_number_value_can_parse (parser))
{
values[SPREAD] = _gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_LENGTH);
values[SPREAD] = gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_LENGTH);
if (values[SPREAD] == NULL)
return FALSE;
}
else
values[SPREAD] = _gtk_css_number_value_new (0.0, GTK_CSS_PX);
values[SPREAD] = gtk_css_number_value_new (0.0, GTK_CSS_PX);
return TRUE;
}
@ -539,13 +539,13 @@ gtk_css_shadow_value_get_extents (const GtkCssValue *value,
const ShadowValue *shadow = &value->shadows[i];
double hoffset, voffset, spread, radius, clip_radius;
spread = _gtk_css_number_value_get (shadow->spread, 0);
radius = _gtk_css_number_value_get (shadow->radius, 0);
spread = gtk_css_number_value_get (shadow->spread, 0);
radius = gtk_css_number_value_get (shadow->radius, 0);
if (!value->is_filter)
radius = radius / 2.0;
clip_radius = gsk_cairo_blur_compute_pixels (radius);
hoffset = _gtk_css_number_value_get (shadow->hoffset, 0);
voffset = _gtk_css_number_value_get (shadow->voffset, 0);
hoffset = gtk_css_number_value_get (shadow->hoffset, 0);
voffset = gtk_css_number_value_get (shadow->voffset, 0);
border->top = MAX (border->top, ceil (clip_radius + spread - voffset));
border->right = MAX (border->right, ceil (clip_radius + spread + hoffset));
@ -578,10 +578,10 @@ gtk_css_shadow_value_snapshot_outset (const GtkCssValue *value,
if (gdk_rgba_is_clear (color))
continue;
dx = _gtk_css_number_value_get (shadow->hoffset, 0);
dy = _gtk_css_number_value_get (shadow->voffset, 0);
spread = _gtk_css_number_value_get (shadow->spread, 0);
radius = _gtk_css_number_value_get (shadow->radius, 0);
dx = gtk_css_number_value_get (shadow->hoffset, 0);
dy = gtk_css_number_value_get (shadow->voffset, 0);
spread = gtk_css_number_value_get (shadow->spread, 0);
radius = gtk_css_number_value_get (shadow->radius, 0);
if (value->is_filter)
radius = 2 * radius;
@ -613,10 +613,10 @@ gtk_css_shadow_value_snapshot_inset (const GtkCssValue *value,
if (gdk_rgba_is_clear (color))
continue;
dx = _gtk_css_number_value_get (shadow->hoffset, 0);
dy = _gtk_css_number_value_get (shadow->voffset, 0);
spread = _gtk_css_number_value_get (shadow->spread, 0);
radius = _gtk_css_number_value_get (shadow->radius, 0);
dx = gtk_css_number_value_get (shadow->hoffset, 0);
dy = gtk_css_number_value_get (shadow->voffset, 0);
spread = gtk_css_number_value_get (shadow->spread, 0);
radius = gtk_css_number_value_get (shadow->radius, 0);
if (value->is_filter)
radius = 2 * radius;
@ -733,10 +733,10 @@ gtk_css_shadow_value_push_snapshot (const GtkCssValue *value,
{
const ShadowValue *shadow = &value->shadows[i];
shadows[i].dx = _gtk_css_number_value_get (shadow->hoffset, 0);
shadows[i].dy = _gtk_css_number_value_get (shadow->voffset, 0);
shadows[i].dx = gtk_css_number_value_get (shadow->hoffset, 0);
shadows[i].dy = gtk_css_number_value_get (shadow->voffset, 0);
shadows[i].color = *gtk_css_color_value_get_rgba (shadow->color);
shadows[i].radius = _gtk_css_number_value_get (shadow->radius, 0);
shadows[i].radius = gtk_css_number_value_get (shadow->radius, 0);
if (value->is_filter)
shadows[i].radius *= 2;
}

View File

@ -64,7 +64,7 @@ parse_four_numbers (GtkCssShorthandProperty *shorthand,
if (!gtk_css_number_value_can_parse (parser))
break;
values[i] = _gtk_css_number_value_parse (parser, flags);
values[i] = gtk_css_number_value_parse (parser, flags);
if (values[i] == NULL)
return FALSE;
}
@ -130,10 +130,10 @@ parse_border_radius (GtkCssShorthandProperty *shorthand,
{
if (!gtk_css_number_value_can_parse (parser))
break;
x[i] = _gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
x[i] = gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
if (x[i] == NULL)
goto fail;
}
@ -156,10 +156,10 @@ parse_border_radius (GtkCssShorthandProperty *shorthand,
{
if (!gtk_css_number_value_can_parse (parser))
break;
y[i] = _gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
y[i] = gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_PERCENT
| GTK_CSS_PARSE_LENGTH);
if (y[i] == NULL)
goto fail;
}
@ -325,9 +325,9 @@ parse_border_side (GtkCssShorthandProperty *shorthand,
if (values[0] == NULL &&
gtk_css_number_value_can_parse (parser))
{
values[0] = _gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_LENGTH);
values[0] = gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_LENGTH);
if (values[0] == NULL)
return FALSE;
}
@ -366,9 +366,9 @@ parse_border (GtkCssShorthandProperty *shorthand,
if (values[0] == NULL &&
gtk_css_number_value_can_parse (parser))
{
values[0] = _gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_LENGTH);
values[0] = gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_LENGTH);
if (values[0] == NULL)
return FALSE;
values[1] = gtk_css_value_ref (values[0]);
@ -449,11 +449,11 @@ parse_font (GtkCssShorthandProperty *shorthand,
if (values[3] == NULL && gtk_css_number_value_can_parse (parser))
{
/* This needs to check for font-size, too */
GtkCssValue *num = _gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_NUMBER |
GTK_CSS_PARSE_LENGTH |
GTK_CSS_PARSE_PERCENT |
GTK_CSS_POSITIVE_ONLY);
GtkCssValue *num = gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_NUMBER |
GTK_CSS_PARSE_LENGTH |
GTK_CSS_PARSE_PERCENT |
GTK_CSS_POSITIVE_ONLY);
if (num == NULL)
return FALSE;
@ -464,8 +464,8 @@ parse_font (GtkCssShorthandProperty *shorthand,
}
values[3] = num;
if (_gtk_css_number_value_get (values[3], 100) < 1 ||
_gtk_css_number_value_get (values[3], 100) > 1000)
if (gtk_css_number_value_get (values[3], 100) < 1 ||
gtk_css_number_value_get (values[3], 100) > 1000)
{
gtk_css_parser_error_value (parser, "Font weight values must be between 1 and 1000");
g_clear_pointer (&values[3], gtk_css_value_unref);
@ -662,7 +662,7 @@ parse_transition_time (GtkCssParser *parser,
{
GtkCssValue **value = option_data;
*value = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_TIME);
*value = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_TIME);
return *value != NULL;
}
@ -752,17 +752,17 @@ parse_one_animation (GtkCssShorthandProperty *shorthand,
{
if (values[1] == NULL && gtk_css_parser_try_ident (parser, "infinite"))
{
values[1] = _gtk_css_number_value_new (HUGE_VAL, GTK_CSS_NUMBER);
values[1] = gtk_css_number_value_new (HUGE_VAL, GTK_CSS_NUMBER);
}
else if ((values[1] == NULL || values[3] == NULL) &&
gtk_css_number_value_can_parse (parser))
{
GtkCssValue *value;
value = _gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| (values[1] == NULL ? GTK_CSS_PARSE_NUMBER : 0)
| (values[3] == NULL ? GTK_CSS_PARSE_TIME : 0));
value = gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| (values[1] == NULL ? GTK_CSS_PARSE_NUMBER : 0)
| (values[3] == NULL ? GTK_CSS_PARSE_TIME : 0));
if (value == NULL)
return FALSE;

View File

@ -683,7 +683,7 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style)
}
/* letter-spacing */
letter_spacing = _gtk_css_number_value_get (style->font->letter_spacing, 100);
letter_spacing = gtk_css_number_value_get (style->font->letter_spacing, 100);
if (letter_spacing != 0)
{
attrs = add_pango_attr (attrs, pango_attr_letter_spacing_new (letter_spacing * PANGO_SCALE));
@ -781,13 +781,13 @@ gtk_css_style_get_pango_font (GtkCssStyle *style)
}
v = style->core->font_size;
pango_font_description_set_absolute_size (description, round (_gtk_css_number_value_get (v, 100) * PANGO_SCALE));
pango_font_description_set_absolute_size (description, round (gtk_css_number_value_get (v, 100) * PANGO_SCALE));
v = style->font->font_style;
pango_font_description_set_style (description, _gtk_css_font_style_value_get (v));
v = style->font->font_weight;
pango_font_description_set_weight (description, _gtk_css_number_value_get (v, 100));
pango_font_description_set_weight (description, gtk_css_number_value_get (v, 100));
v = style->font->font_stretch;
pango_font_description_set_stretch (description, _gtk_css_font_stretch_value_get (v));

View File

@ -163,12 +163,12 @@ font_weight_parse (GtkCssStyleProperty *property,
value = gtk_css_font_weight_value_try_parse (parser);
if (value == NULL)
{
value = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER | GTK_CSS_POSITIVE_ONLY);
value = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER | GTK_CSS_POSITIVE_ONLY);
if (value == NULL)
return NULL;
if (_gtk_css_number_value_get (value, 100) < 1 ||
_gtk_css_number_value_get (value, 100) > 1000)
if (gtk_css_number_value_get (value, 100) < 1 ||
gtk_css_number_value_get (value, 100) > 1000)
{
gtk_css_parser_error_value (parser, "Font weight values must be between 1 and 1000");
g_clear_pointer (&value, gtk_css_value_unref);
@ -242,7 +242,7 @@ static GtkCssValue *
opacity_parse (GtkCssStyleProperty *property,
GtkCssParser *parser)
{
return _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
return gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
}
static GtkCssValue *
@ -285,10 +285,10 @@ static GtkCssValue *
icon_size_parse (GtkCssStyleProperty *property,
GtkCssParser *parser)
{
return _gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_LENGTH
| GTK_CSS_PARSE_PERCENT
| GTK_CSS_POSITIVE_ONLY);
return gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_LENGTH
| GTK_CSS_PARSE_PERCENT
| GTK_CSS_POSITIVE_ONLY);
}
static GtkCssValue *
@ -314,7 +314,7 @@ static GtkCssValue *
parse_letter_spacing (GtkCssStyleProperty *property,
GtkCssParser *parser)
{
return _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH);
return gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH);
}
static gboolean
@ -597,7 +597,7 @@ static GtkCssValue *
dpi_parse (GtkCssStyleProperty *property,
GtkCssParser *parser)
{
return _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
return gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
}
GtkCssValue *
@ -609,10 +609,10 @@ gtk_css_font_size_value_parse (GtkCssParser *parser)
if (value)
return value;
return _gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_LENGTH
| GTK_CSS_PARSE_PERCENT
| GTK_CSS_POSITIVE_ONLY);
return gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_LENGTH
| GTK_CSS_PARSE_PERCENT
| GTK_CSS_POSITIVE_ONLY);
}
static GtkCssValue *
@ -626,8 +626,8 @@ static GtkCssValue *
outline_parse (GtkCssStyleProperty *property,
GtkCssParser *parser)
{
return _gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_LENGTH);
return gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_LENGTH);
}
static GtkCssValue *
@ -674,9 +674,9 @@ static GtkCssValue *
minmax_parse (GtkCssStyleProperty *property,
GtkCssParser *parser)
{
return _gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_LENGTH
| GTK_CSS_POSITIVE_ONLY);
return gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_LENGTH
| GTK_CSS_POSITIVE_ONLY);
}
static GtkCssValue *
@ -705,7 +705,7 @@ transition_property_parse (GtkCssStyleProperty *property,
static GtkCssValue *
transition_time_parse_one (GtkCssParser *parser)
{
return _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_TIME);
return gtk_css_number_value_parse (parser, GTK_CSS_PARSE_TIME);
}
static GtkCssValue *
@ -726,9 +726,9 @@ static GtkCssValue *
iteration_count_parse_one (GtkCssParser *parser)
{
if (gtk_css_parser_try_ident (parser, "infinite"))
return _gtk_css_number_value_new (HUGE_VAL, GTK_CSS_NUMBER);
return gtk_css_number_value_new (HUGE_VAL, GTK_CSS_NUMBER);
return _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER | GTK_CSS_POSITIVE_ONLY);
return gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER | GTK_CSS_POSITIVE_ONLY);
}
static GtkCssValue *
@ -742,26 +742,25 @@ static GtkCssValue *
parse_margin (GtkCssStyleProperty *property,
GtkCssParser *parser)
{
return _gtk_css_number_value_parse (parser,
GTK_CSS_PARSE_LENGTH);
return gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH);
}
static GtkCssValue *
parse_padding (GtkCssStyleProperty *property,
GtkCssParser *parser)
{
return _gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_LENGTH);
return gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_LENGTH);
}
static GtkCssValue *
parse_border_width (GtkCssStyleProperty *property,
GtkCssParser *parser)
{
return _gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_LENGTH);
return gtk_css_number_value_parse (parser,
GTK_CSS_POSITIVE_ONLY
| GTK_CSS_PARSE_LENGTH);
}
static GtkCssValue *
@ -854,7 +853,7 @@ _gtk_css_style_property_init_properties (void)
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_TEXT_SIZE,
dpi_parse,
_gtk_css_number_value_new (96.0, GTK_CSS_NUMBER));
gtk_css_number_value_new (96.0, GTK_CSS_NUMBER));
gtk_css_style_property_register ("font-size",
GTK_CSS_PROPERTY_FONT_SIZE,
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
@ -895,7 +894,7 @@ _gtk_css_style_property_init_properties (void)
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_TEXT_SIZE,
font_weight_parse,
_gtk_css_number_value_new (PANGO_WEIGHT_NORMAL, GTK_CSS_NUMBER));
gtk_css_number_value_new (PANGO_WEIGHT_NORMAL, GTK_CSS_NUMBER));
gtk_css_style_property_register ("font-stretch",
GTK_CSS_PROPERTY_FONT_STRETCH,
GTK_STYLE_PROPERTY_INHERIT,
@ -908,7 +907,7 @@ _gtk_css_style_property_init_properties (void)
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_TEXT_ATTRS | GTK_CSS_AFFECTS_TEXT_SIZE,
parse_letter_spacing,
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("text-decoration-line",
GTK_CSS_PROPERTY_TEXT_DECORATION_LINE,
@ -995,49 +994,49 @@ _gtk_css_style_property_init_properties (void)
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_SIZE,
parse_margin,
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("margin-left",
GTK_CSS_PROPERTY_MARGIN_LEFT,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_SIZE,
parse_margin,
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("margin-bottom",
GTK_CSS_PROPERTY_MARGIN_BOTTOM,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_SIZE,
parse_margin,
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("margin-right",
GTK_CSS_PROPERTY_MARGIN_RIGHT,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_SIZE,
parse_margin,
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("padding-top",
GTK_CSS_PROPERTY_PADDING_TOP,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_SIZE,
parse_padding,
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("padding-left",
GTK_CSS_PROPERTY_PADDING_LEFT,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_SIZE,
parse_padding,
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("padding-bottom",
GTK_CSS_PROPERTY_PADDING_BOTTOM,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_SIZE,
parse_padding,
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("padding-right",
GTK_CSS_PROPERTY_PADDING_RIGHT,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_SIZE,
parse_padding,
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_number_value_new (0.0, GTK_CSS_PX));
/* IMPORTANT: the border-width properties must come after border-style properties,
* they depend on them for their value computation.
*/
@ -1052,7 +1051,7 @@ _gtk_css_style_property_init_properties (void)
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_BORDER | GTK_CSS_AFFECTS_SIZE,
parse_border_width,
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("border-left-style",
GTK_CSS_PROPERTY_BORDER_LEFT_STYLE,
0,
@ -1064,7 +1063,7 @@ _gtk_css_style_property_init_properties (void)
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_BORDER | GTK_CSS_AFFECTS_SIZE,
parse_border_width,
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("border-bottom-style",
GTK_CSS_PROPERTY_BORDER_BOTTOM_STYLE,
0,
@ -1076,7 +1075,7 @@ _gtk_css_style_property_init_properties (void)
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_BORDER | GTK_CSS_AFFECTS_SIZE,
parse_border_width,
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("border-right-style",
GTK_CSS_PROPERTY_BORDER_RIGHT_STYLE,
0,
@ -1088,36 +1087,36 @@ _gtk_css_style_property_init_properties (void)
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_BORDER | GTK_CSS_AFFECTS_SIZE,
parse_border_width,
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("border-top-left-radius",
GTK_CSS_PROPERTY_BORDER_TOP_LEFT_RADIUS,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER,
border_corner_radius_value_parse,
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
_gtk_css_number_value_new (0, GTK_CSS_PX)));
_gtk_css_corner_value_new (gtk_css_number_value_new (0, GTK_CSS_PX),
gtk_css_number_value_new (0, GTK_CSS_PX)));
gtk_css_style_property_register ("border-top-right-radius",
GTK_CSS_PROPERTY_BORDER_TOP_RIGHT_RADIUS,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER,
border_corner_radius_value_parse,
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
_gtk_css_number_value_new (0, GTK_CSS_PX)));
_gtk_css_corner_value_new (gtk_css_number_value_new (0, GTK_CSS_PX),
gtk_css_number_value_new (0, GTK_CSS_PX)));
gtk_css_style_property_register ("border-bottom-right-radius",
GTK_CSS_PROPERTY_BORDER_BOTTOM_RIGHT_RADIUS,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER,
border_corner_radius_value_parse,
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
_gtk_css_number_value_new (0, GTK_CSS_PX)));
_gtk_css_corner_value_new (gtk_css_number_value_new (0, GTK_CSS_PX),
gtk_css_number_value_new (0, GTK_CSS_PX)));
gtk_css_style_property_register ("border-bottom-left-radius",
GTK_CSS_PROPERTY_BORDER_BOTTOM_LEFT_RADIUS,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_BACKGROUND | GTK_CSS_AFFECTS_BORDER,
border_corner_radius_value_parse,
_gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
_gtk_css_number_value_new (0, GTK_CSS_PX)));
_gtk_css_corner_value_new (gtk_css_number_value_new (0, GTK_CSS_PX),
gtk_css_number_value_new (0, GTK_CSS_PX)));
gtk_css_style_property_register ("outline-style",
GTK_CSS_PROPERTY_OUTLINE_STYLE,
@ -1130,13 +1129,13 @@ _gtk_css_style_property_init_properties (void)
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_OUTLINE,
parse_border_width,
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("outline-offset",
GTK_CSS_PROPERTY_OUTLINE_OFFSET,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_OUTLINE,
outline_parse,
_gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_number_value_new (0.0, GTK_CSS_PX));
gtk_css_style_property_register ("background-clip",
GTK_CSS_PROPERTY_BACKGROUND_CLIP,
0,
@ -1160,8 +1159,8 @@ _gtk_css_style_property_init_properties (void)
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_BACKGROUND,
background_position_parse,
_gtk_css_position_value_new (_gtk_css_number_value_new (0, GTK_CSS_PERCENT),
_gtk_css_number_value_new (0, GTK_CSS_PERCENT)));
_gtk_css_position_value_new (gtk_css_number_value_new (0, GTK_CSS_PERCENT),
gtk_css_number_value_new (0, GTK_CSS_PERCENT)));
gtk_css_style_property_register ("border-top-color",
GTK_CSS_PROPERTY_BORDER_TOP_COLOR,
@ -1234,19 +1233,19 @@ _gtk_css_style_property_init_properties (void)
0,
GTK_CSS_AFFECTS_BORDER,
border_image_slice_parse,
_gtk_css_border_value_new (_gtk_css_number_value_new (100, GTK_CSS_PERCENT),
_gtk_css_number_value_new (100, GTK_CSS_PERCENT),
_gtk_css_number_value_new (100, GTK_CSS_PERCENT),
_gtk_css_number_value_new (100, GTK_CSS_PERCENT)));
_gtk_css_border_value_new (gtk_css_number_value_new (100, GTK_CSS_PERCENT),
gtk_css_number_value_new (100, GTK_CSS_PERCENT),
gtk_css_number_value_new (100, GTK_CSS_PERCENT),
gtk_css_number_value_new (100, GTK_CSS_PERCENT)));
gtk_css_style_property_register ("border-image-width",
GTK_CSS_PROPERTY_BORDER_IMAGE_WIDTH,
0,
GTK_CSS_AFFECTS_BORDER,
border_image_width_parse,
_gtk_css_border_value_new (_gtk_css_number_value_new (1, GTK_CSS_NUMBER),
_gtk_css_number_value_new (1, GTK_CSS_NUMBER),
_gtk_css_number_value_new (1, GTK_CSS_NUMBER),
_gtk_css_number_value_new (1, GTK_CSS_NUMBER)));
_gtk_css_border_value_new (gtk_css_number_value_new (1, GTK_CSS_NUMBER),
gtk_css_number_value_new (1, GTK_CSS_NUMBER),
gtk_css_number_value_new (1, GTK_CSS_NUMBER),
gtk_css_number_value_new (1, GTK_CSS_NUMBER)));
gtk_css_style_property_register ("-gtk-icon-source",
GTK_CSS_PROPERTY_ICON_SOURCE,
@ -1259,7 +1258,7 @@ _gtk_css_style_property_init_properties (void)
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_ICON_SIZE,
icon_size_parse,
_gtk_css_number_value_new (16, GTK_CSS_PX));
gtk_css_number_value_new (16, GTK_CSS_PX));
gtk_css_style_property_register ("-gtk-icon-shadow",
GTK_CSS_PROPERTY_ICON_SHADOW,
GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
@ -1289,8 +1288,8 @@ _gtk_css_style_property_init_properties (void)
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_SIZE,
border_spacing_value_parse,
_gtk_css_position_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX),
_gtk_css_number_value_new (0, GTK_CSS_PX)));
_gtk_css_position_value_new (gtk_css_number_value_new (0, GTK_CSS_PX),
gtk_css_number_value_new (0, GTK_CSS_PX)));
gtk_css_style_property_register ("transform",
GTK_CSS_PROPERTY_TRANSFORM,
@ -1303,20 +1302,20 @@ _gtk_css_style_property_init_properties (void)
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_TRANSFORM,
transform_origin_parse,
_gtk_css_position_value_new (_gtk_css_number_value_new (50, GTK_CSS_PERCENT),
_gtk_css_number_value_new (50, GTK_CSS_PERCENT)));
_gtk_css_position_value_new (gtk_css_number_value_new (50, GTK_CSS_PERCENT),
gtk_css_number_value_new (50, GTK_CSS_PERCENT)));
gtk_css_style_property_register ("min-width",
GTK_CSS_PROPERTY_MIN_WIDTH,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_SIZE,
minmax_parse,
_gtk_css_number_value_new (0, GTK_CSS_PX));
gtk_css_number_value_new (0, GTK_CSS_PX));
gtk_css_style_property_register ("min-height",
GTK_CSS_PROPERTY_MIN_HEIGHT,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_SIZE,
minmax_parse,
_gtk_css_number_value_new (0, GTK_CSS_PX));
gtk_css_number_value_new (0, GTK_CSS_PX));
gtk_css_style_property_register ("transition-property",
GTK_CSS_PROPERTY_TRANSITION_PROPERTY,
@ -1329,7 +1328,7 @@ _gtk_css_style_property_init_properties (void)
0,
0,
transition_time_parse,
_gtk_css_number_value_new (0, GTK_CSS_S));
gtk_css_number_value_new (0, GTK_CSS_S));
gtk_css_style_property_register ("transition-timing-function",
GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION,
0,
@ -1341,7 +1340,7 @@ _gtk_css_style_property_init_properties (void)
0,
0,
transition_time_parse,
_gtk_css_number_value_new (0, GTK_CSS_S));
gtk_css_number_value_new (0, GTK_CSS_S));
gtk_css_style_property_register ("animation-name",
GTK_CSS_PROPERTY_ANIMATION_NAME,
@ -1354,7 +1353,7 @@ _gtk_css_style_property_init_properties (void)
0,
0,
transition_time_parse,
_gtk_css_number_value_new (0, GTK_CSS_S));
gtk_css_number_value_new (0, GTK_CSS_S));
gtk_css_style_property_register ("animation-timing-function",
GTK_CSS_PROPERTY_ANIMATION_TIMING_FUNCTION,
0,
@ -1366,7 +1365,7 @@ _gtk_css_style_property_init_properties (void)
0,
0,
iteration_count_parse,
_gtk_css_number_value_new (1, GTK_CSS_NUMBER));
gtk_css_number_value_new (1, GTK_CSS_NUMBER));
gtk_css_style_property_register ("animation-direction",
GTK_CSS_PROPERTY_ANIMATION_DIRECTION,
0,
@ -1384,7 +1383,7 @@ _gtk_css_style_property_init_properties (void)
0,
0,
transition_time_parse,
_gtk_css_number_value_new (0, GTK_CSS_S));
gtk_css_number_value_new (0, GTK_CSS_S));
gtk_css_style_property_register ("animation-fill-mode",
GTK_CSS_PROPERTY_ANIMATION_FILL_MODE,
0,
@ -1397,7 +1396,7 @@ _gtk_css_style_property_init_properties (void)
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_POSTEFFECT,
opacity_parse,
_gtk_css_number_value_new (1, GTK_CSS_NUMBER));
gtk_css_number_value_new (1, GTK_CSS_NUMBER));
gtk_css_style_property_register ("filter",
GTK_CSS_PROPERTY_FILTER,
GTK_STYLE_PROPERTY_ANIMATED,

View File

@ -135,30 +135,30 @@ gtk_css_transform_init_identity (GtkCssTransform *transform,
graphene_matrix_init_identity (&transform->matrix.matrix);
break;
case GTK_CSS_TRANSFORM_TRANSLATE:
transform->translate.x = _gtk_css_number_value_new (0, GTK_CSS_PX);
transform->translate.y = _gtk_css_number_value_new (0, GTK_CSS_PX);
transform->translate.z = _gtk_css_number_value_new (0, GTK_CSS_PX);
transform->translate.x = gtk_css_number_value_new (0, GTK_CSS_PX);
transform->translate.y = gtk_css_number_value_new (0, GTK_CSS_PX);
transform->translate.z = gtk_css_number_value_new (0, GTK_CSS_PX);
break;
case GTK_CSS_TRANSFORM_ROTATE:
transform->rotate.x = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform->rotate.y = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform->rotate.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform->rotate.angle = _gtk_css_number_value_new (0, GTK_CSS_DEG);
transform->rotate.x = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform->rotate.y = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform->rotate.z = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform->rotate.angle = gtk_css_number_value_new (0, GTK_CSS_DEG);
break;
case GTK_CSS_TRANSFORM_SCALE:
transform->scale.x = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform->scale.y = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform->scale.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform->scale.x = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform->scale.y = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform->scale.z = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
break;
case GTK_CSS_TRANSFORM_SKEW:
transform->skew.x = _gtk_css_number_value_new (0, GTK_CSS_DEG);
transform->skew.y = _gtk_css_number_value_new (0, GTK_CSS_DEG);
transform->skew.x = gtk_css_number_value_new (0, GTK_CSS_DEG);
transform->skew.y = gtk_css_number_value_new (0, GTK_CSS_DEG);
break;
case GTK_CSS_TRANSFORM_SKEW_X:
transform->skew_x.skew = _gtk_css_number_value_new (0, GTK_CSS_DEG);
transform->skew_x.skew = gtk_css_number_value_new (0, GTK_CSS_DEG);
break;
case GTK_CSS_TRANSFORM_SKEW_Y:
transform->skew_y.skew = _gtk_css_number_value_new (0, GTK_CSS_DEG);
transform->skew_y.skew = gtk_css_number_value_new (0, GTK_CSS_DEG);
break;
case GTK_CSS_TRANSFORM_PERSPECTIVE:
return FALSE;
@ -188,9 +188,9 @@ gtk_css_transform_apply (const GtkCssTransform *transform,
case GTK_CSS_TRANSFORM_TRANSLATE:
return gsk_transform_translate_3d (next,
&GRAPHENE_POINT3D_INIT (
_gtk_css_number_value_get (transform->translate.x, 100),
_gtk_css_number_value_get (transform->translate.y, 100),
_gtk_css_number_value_get (transform->translate.z, 100)
gtk_css_number_value_get (transform->translate.x, 100),
gtk_css_number_value_get (transform->translate.y, 100),
gtk_css_number_value_get (transform->translate.z, 100)
));
case GTK_CSS_TRANSFORM_ROTATE:
@ -198,41 +198,41 @@ gtk_css_transform_apply (const GtkCssTransform *transform,
graphene_vec3_t axis;
graphene_vec3_init (&axis,
_gtk_css_number_value_get (transform->rotate.x, 1),
_gtk_css_number_value_get (transform->rotate.y, 1),
_gtk_css_number_value_get (transform->rotate.z, 1));
gtk_css_number_value_get (transform->rotate.x, 1),
gtk_css_number_value_get (transform->rotate.y, 1),
gtk_css_number_value_get (transform->rotate.z, 1));
return gsk_transform_rotate_3d (next,
_gtk_css_number_value_get (transform->rotate.angle, 100),
gtk_css_number_value_get (transform->rotate.angle, 100),
&axis);
}
case GTK_CSS_TRANSFORM_SCALE:
return gsk_transform_scale_3d (next,
_gtk_css_number_value_get (transform->scale.x, 1),
_gtk_css_number_value_get (transform->scale.y, 1),
_gtk_css_number_value_get (transform->scale.z, 1));
gtk_css_number_value_get (transform->scale.x, 1),
gtk_css_number_value_get (transform->scale.y, 1),
gtk_css_number_value_get (transform->scale.z, 1));
case GTK_CSS_TRANSFORM_SKEW:
graphene_matrix_init_skew (&skew,
_gtk_css_number_value_get (transform->skew.x, 100) / 180.0f * G_PI,
_gtk_css_number_value_get (transform->skew.y, 100) / 180.0f * G_PI);
gtk_css_number_value_get (transform->skew.x, 100) / 180.0f * G_PI,
gtk_css_number_value_get (transform->skew.y, 100) / 180.0f * G_PI);
return gsk_transform_matrix (next, &skew);
case GTK_CSS_TRANSFORM_SKEW_X:
graphene_matrix_init_skew (&skew,
_gtk_css_number_value_get (transform->skew_x.skew, 100) / 180.0f * G_PI,
gtk_css_number_value_get (transform->skew_x.skew, 100) / 180.0f * G_PI,
0);
return gsk_transform_matrix (next, &skew);
case GTK_CSS_TRANSFORM_SKEW_Y:
graphene_matrix_init_skew (&skew,
0,
_gtk_css_number_value_get (transform->skew_y.skew, 100) / 180.0f * G_PI);
gtk_css_number_value_get (transform->skew_y.skew, 100) / 180.0f * G_PI);
return gsk_transform_matrix (next, &skew);
case GTK_CSS_TRANSFORM_PERSPECTIVE:
return gsk_transform_perspective (next,
_gtk_css_number_value_get (transform->perspective.depth, 100));
gtk_css_number_value_get (transform->perspective.depth, 100));
case GTK_CSS_TRANSFORM_NONE:
default:
@ -712,7 +712,7 @@ gtk_css_transform_print (const GtkCssTransform *transform,
g_string_append (string, ")");
break;
case GTK_CSS_TRANSFORM_SCALE:
if (_gtk_css_number_value_get (transform->scale.z, 100) == 1)
if (gtk_css_number_value_get (transform->scale.z, 100) == 1)
{
g_string_append (string, "scale(");
gtk_css_value_print (transform->scale.x, string);
@ -844,7 +844,7 @@ gtk_css_transform_parse_length (GtkCssParser *parser,
{
GtkCssValue **values = data;
values[n] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH);
values[n] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_LENGTH);
if (values[n] == NULL)
return 0;
@ -858,7 +858,7 @@ gtk_css_transform_parse_angle (GtkCssParser *parser,
{
GtkCssValue **values = data;
values[n] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
values[n] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
if (values[n] == NULL)
return 0;
@ -872,7 +872,7 @@ gtk_css_transform_parse_number (GtkCssParser *parser,
{
GtkCssValue **values = data;
values[n] = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
values[n] = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
if (values[n] == NULL)
return 0;
@ -889,25 +889,25 @@ gtk_css_transform_parse_rotate3d (GtkCssParser *parser,
switch (n)
{
case 0:
transform->rotate.x = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
transform->rotate.x = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
if (transform->rotate.x == NULL)
return 0;
break;
case 1:
transform->rotate.y = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
transform->rotate.y = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
if (transform->rotate.y == NULL)
return 0;
break;
case 2:
transform->rotate.z = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
transform->rotate.z = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER);
if (transform->rotate.z == NULL)
return 0;
break;
case 3:
transform->rotate.angle = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
transform->rotate.angle = gtk_css_number_value_parse (parser, GTK_CSS_PARSE_ANGLE);
if (transform->rotate.angle == NULL)
return 0;
break;
@ -972,9 +972,9 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
goto fail;
transform.type = GTK_CSS_TRANSFORM_ROTATE;
transform.rotate.x = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform.rotate.y = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform.rotate.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.rotate.x = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform.rotate.y = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform.rotate.z = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
computed = computed && gtk_css_value_is_computed (transform.rotate.angle);
}
else if (gtk_css_parser_has_function (parser, "rotate3d"))
@ -1000,9 +1000,9 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
goto fail;
transform.type = GTK_CSS_TRANSFORM_ROTATE;
transform.rotate.x = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.rotate.y = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform.rotate.z = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform.rotate.x = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.rotate.y = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform.rotate.z = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
computed = computed && gtk_css_value_is_computed (transform.rotate.angle);
}
else if (gtk_css_parser_has_function (parser, "rotateY"))
@ -1011,9 +1011,9 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
goto fail;
transform.type = GTK_CSS_TRANSFORM_ROTATE;
transform.rotate.x = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform.rotate.y = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.rotate.z = _gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform.rotate.x = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
transform.rotate.y = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.rotate.z = gtk_css_number_value_new (0, GTK_CSS_NUMBER);
computed = computed && gtk_css_value_is_computed (transform.rotate.angle);
}
else if (gtk_css_parser_has_function (parser, "scale"))
@ -1033,7 +1033,7 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
transform.scale.y = values[1];
else
transform.scale.y = gtk_css_value_ref (values[0]);
transform.scale.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.scale.z = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
computed = computed && gtk_css_value_is_computed (transform.scale.x) &&
gtk_css_value_is_computed (transform.scale.y);
}
@ -1063,8 +1063,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
goto fail;
transform.type = GTK_CSS_TRANSFORM_SCALE;
transform.scale.y = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.scale.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.scale.y = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.scale.z = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
computed = computed && gtk_css_value_is_computed (transform.scale.x);
}
else if (gtk_css_parser_has_function (parser, "scaleY"))
@ -1073,8 +1073,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
goto fail;
transform.type = GTK_CSS_TRANSFORM_SCALE;
transform.scale.x = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.scale.z = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.scale.x = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.scale.z = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
computed = computed && gtk_css_value_is_computed (transform.scale.y);
}
else if (gtk_css_parser_has_function (parser, "scaleZ"))
@ -1083,8 +1083,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
goto fail;
transform.type = GTK_CSS_TRANSFORM_SCALE;
transform.scale.x = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.scale.y = _gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.scale.x = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
transform.scale.y = gtk_css_number_value_new (1, GTK_CSS_NUMBER);
computed = computed && gtk_css_value_is_computed (transform.scale.z);
}
else if (gtk_css_parser_has_function (parser, "skew"))
@ -1136,8 +1136,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
if (values[1])
transform.translate.y = values[1];
else
transform.translate.y = _gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.z = _gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.y = gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.z = gtk_css_number_value_new (0, GTK_CSS_PX);
computed = computed && gtk_css_value_is_computed (transform.translate.x) &&
gtk_css_value_is_computed (transform.translate.y);
}
@ -1167,8 +1167,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
goto fail;
transform.type = GTK_CSS_TRANSFORM_TRANSLATE;
transform.translate.y = _gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.z = _gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.y = gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.z = gtk_css_number_value_new (0, GTK_CSS_PX);
computed = computed && gtk_css_value_is_computed (transform.translate.x);
}
else if (gtk_css_parser_has_function (parser, "translateY"))
@ -1177,8 +1177,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
goto fail;
transform.type = GTK_CSS_TRANSFORM_TRANSLATE;
transform.translate.x = _gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.z = _gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.x = gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.z = gtk_css_number_value_new (0, GTK_CSS_PX);
computed = computed && gtk_css_value_is_computed (transform.translate.y);
}
else if (gtk_css_parser_has_function (parser, "translateZ"))
@ -1187,8 +1187,8 @@ _gtk_css_transform_value_parse (GtkCssParser *parser)
goto fail;
transform.type = GTK_CSS_TRANSFORM_TRANSLATE;
transform.translate.x = _gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.y = _gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.x = gtk_css_number_value_new (0, GTK_CSS_PX);
transform.translate.y = gtk_css_number_value_new (0, GTK_CSS_PX);
computed = computed && gtk_css_value_is_computed (transform.translate.z);
}
else

View File

@ -2610,7 +2610,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
cairo_path_destroy (path);
border_color = gtk_css_color_value_get_rgba (style->border->border_top_color ? style->border->border_top_color : style->core->color);
border_width = round (_gtk_css_number_value_get (style->border->border_left_width, 100));
border_width = round (gtk_css_number_value_get (style->border->border_left_width, 100));
cairo_set_line_width (cr, border_width);
gdk_cairo_set_source_rgba (cr, border_color);

View File

@ -456,7 +456,7 @@ gtk_icon_helper_get_size (GtkIconHelper *self)
return self->pixel_size;
style = gtk_css_node_get_style (self->node);
return _gtk_css_number_value_get (style->icon->icon_size, 100);
return gtk_css_number_value_get (style->icon->icon_size, 100);
}
void

View File

@ -349,7 +349,7 @@ get_translucent_border_edge (const GtkCssValue *color,
border_color = color;
if (!gdk_rgba_is_opaque (gtk_css_color_value_get_rgba (border_color)))
return round (_gtk_css_number_value_get (border_width, 100));
return round (gtk_css_number_value_get (border_width, 100));
return 0;
}

View File

@ -215,7 +215,7 @@ gtk_picture_measure (GtkWidget *widget,
}
style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
default_size = _gtk_css_number_value_get (style->icon->icon_size, 100);
default_size = gtk_css_number_value_get (style->icon->icon_size, 100);
if (self->can_shrink)
{

View File

@ -1246,9 +1246,9 @@ gtk_popover_get_gap_coords (GtkPopover *popover,
style = gtk_css_node_get_style (gtk_widget_get_css_node (priv->contents_widget));
border_radius = round (get_border_radius (widget));
border_top = _gtk_css_number_value_get (style->border->border_top_width, 100);
border_right = _gtk_css_number_value_get (style->border->border_right_width, 100);
border_bottom = _gtk_css_number_value_get (style->border->border_bottom_width, 100);
border_top = gtk_css_number_value_get (style->border->border_top_width, 100);
border_right = gtk_css_number_value_get (style->border->border_right_width, 100);
border_bottom = gtk_css_number_value_get (style->border->border_bottom_width, 100);
gtk_css_shadow_value_get_extents (style->background->box_shadow, &shadow_width);
@ -1327,10 +1327,10 @@ get_border (GtkCssNode *node,
style = gtk_css_node_get_style (node);
border->top = _gtk_css_number_value_get (style->border->border_top_width, 100);
border->right = _gtk_css_number_value_get (style->border->border_right_width, 100);
border->bottom = _gtk_css_number_value_get (style->border->border_bottom_width, 100);
border->left = _gtk_css_number_value_get (style->border->border_left_width, 100);
border->top = gtk_css_number_value_get (style->border->border_top_width, 100);
border->right = gtk_css_number_value_get (style->border->border_right_width, 100);
border->bottom = gtk_css_number_value_get (style->border->border_bottom_width, 100);
border->left = gtk_css_number_value_get (style->border->border_left_width, 100);
}
static void

View File

@ -83,13 +83,13 @@ gtk_border_image_compute_border_size (GtkBorderImageSliceSize sizes[3],
double start, end;
if (gtk_css_number_value_get_dimension (start_border) == GTK_CSS_DIMENSION_NUMBER)
start = start_border_width * _gtk_css_number_value_get (start_border, 100);
start = start_border_width * gtk_css_number_value_get (start_border, 100);
else
start = _gtk_css_number_value_get (start_border, area_size);
start = gtk_css_number_value_get (start_border, area_size);
if (gtk_css_number_value_get_dimension (end_border) == GTK_CSS_DIMENSION_NUMBER)
end = end_border_width * _gtk_css_number_value_get (end_border, 100);
end = end_border_width * gtk_css_number_value_get (end_border, 100);
else
end = _gtk_css_number_value_get (end_border, area_size);
end = gtk_css_number_value_get (end_border, area_size);
/* XXX: reduce vertical and horizontal by the same factor */
if (start + end > area_size)
@ -271,12 +271,12 @@ gtk_border_image_render (GtkBorderImage *image,
gtk_border_image_compute_slice_size (horizontal_slice,
source_width,
_gtk_css_number_value_get (_gtk_css_border_value_get_left (image->slice), source_width),
_gtk_css_number_value_get (_gtk_css_border_value_get_right (image->slice), source_width));
gtk_css_number_value_get (_gtk_css_border_value_get_left (image->slice), source_width),
gtk_css_number_value_get (_gtk_css_border_value_get_right (image->slice), source_width));
gtk_border_image_compute_slice_size (vertical_slice,
source_height,
_gtk_css_number_value_get (_gtk_css_border_value_get_top (image->slice), source_height),
_gtk_css_number_value_get (_gtk_css_border_value_get_bottom (image->slice), source_height));
gtk_css_number_value_get (_gtk_css_border_value_get_top (image->slice), source_height),
gtk_css_number_value_get (_gtk_css_border_value_get_bottom (image->slice), source_height));
gtk_border_image_compute_border_size (horizontal_border,
rect->origin.x,
rect->size.width,
@ -659,10 +659,10 @@ gtk_css_style_snapshot_border (GtkCssBoxes *boxes,
cairo_t *cr;
const graphene_rect_t *bounds;
border_width[0] = _gtk_css_number_value_get (border->border_top_width, 100);
border_width[1] = _gtk_css_number_value_get (border->border_right_width, 100);
border_width[2] = _gtk_css_number_value_get (border->border_bottom_width, 100);
border_width[3] = _gtk_css_number_value_get (border->border_left_width, 100);
border_width[0] = gtk_css_number_value_get (border->border_top_width, 100);
border_width[1] = gtk_css_number_value_get (border->border_right_width, 100);
border_width[2] = gtk_css_number_value_get (border->border_bottom_width, 100);
border_width[3] = gtk_css_number_value_get (border->border_left_width, 100);
bounds = gtk_css_boxes_get_border_rect (boxes);
@ -697,10 +697,10 @@ gtk_css_style_snapshot_border (GtkCssBoxes *boxes,
border_style[2] = _gtk_css_border_style_value_get (border->border_bottom_style);
border_style[3] = _gtk_css_border_style_value_get (border->border_left_style);
border_width[0] = _gtk_css_number_value_get (border->border_top_width, 100);
border_width[1] = _gtk_css_number_value_get (border->border_right_width, 100);
border_width[2] = _gtk_css_number_value_get (border->border_bottom_width, 100);
border_width[3] = _gtk_css_number_value_get (border->border_left_width, 100);
border_width[0] = gtk_css_number_value_get (border->border_top_width, 100);
border_width[1] = gtk_css_number_value_get (border->border_right_width, 100);
border_width[2] = gtk_css_number_value_get (border->border_bottom_width, 100);
border_width[3] = gtk_css_number_value_get (border->border_left_width, 100);
gtk_snapshot_push_debug (snapshot, "CSS border");
if (border_style[0] <= GTK_BORDER_STYLE_SOLID &&
@ -744,7 +744,7 @@ gtk_css_style_snapshot_outline (GtkCssBoxes *boxes,
if (gdk_rgba_is_clear (color))
return;
border_width[0] = _gtk_css_number_value_get (outline->outline_width, 100);
border_width[0] = gtk_css_number_value_get (outline->outline_width, 100);
if (G_APPROX_VALUE (border_width[0], 0, FLT_EPSILON))
return;

View File

@ -84,7 +84,7 @@ fetch_request_mode (GtkWidget *widget)
static int
get_number (GtkCssValue *value)
{
double d = _gtk_css_number_value_get (value, 100);
double d = gtk_css_number_value_get (value, 100);
if (d < 1)
return ceil (d);
@ -96,7 +96,7 @@ get_number (GtkCssValue *value)
static int
get_number_ceil (GtkCssValue *value)
{
return ceil (_gtk_css_number_value_get (value, 100));
return ceil (gtk_css_number_value_get (value, 100));
}
static void

View File

@ -93,7 +93,7 @@ gtk_spinner_measure (GtkWidget *widget,
GtkCssStyle *style;
style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
*minimum = *natural = _gtk_css_number_value_get (style->icon->icon_size, 100);
*minimum = *natural = gtk_css_number_value_get (style->icon->icon_size, 100);
}
static void

View File

@ -118,10 +118,10 @@ gtk_text_handle_get_padding (GtkTextHandle *handle,
GtkWidget *widget = GTK_WIDGET (handle);
GtkCssStyle *style = gtk_css_node_get_style (gtk_widget_get_css_node (widget));
padding->left = _gtk_css_number_value_get (style->size->padding_left, 100);
padding->right = _gtk_css_number_value_get (style->size->padding_right, 100);
padding->top = _gtk_css_number_value_get (style->size->padding_top, 100);
padding->bottom = _gtk_css_number_value_get (style->size->padding_bottom, 100);
padding->left = gtk_css_number_value_get (style->size->padding_left, 100);
padding->right = gtk_css_number_value_get (style->size->padding_right, 100);
padding->top = gtk_css_number_value_get (style->size->padding_top, 100);
padding->bottom = gtk_css_number_value_get (style->size->padding_bottom, 100);
}
static void

View File

@ -7922,7 +7922,7 @@ gtk_text_view_set_attributes_from_style (GtkTextView *text_view,
}
/* letter-spacing */
values->letter_spacing = _gtk_css_number_value_get (style->font->letter_spacing, 100) * PANGO_SCALE;
values->letter_spacing = gtk_css_number_value_get (style->font->letter_spacing, 100) * PANGO_SCALE;
/* line-height */

View File

@ -3683,7 +3683,7 @@ gtk_widget_get_frame_clock (GtkWidget *widget)
static int
get_number (GtkCssValue *value)
{
double d = _gtk_css_number_value_get (value, 100);
double d = gtk_css_number_value_get (value, 100);
if (d < 1)
return ceil (d);
@ -6478,7 +6478,7 @@ gtk_widget_update_pango_context (GtkWidget *widget,
? PANGO_DIRECTION_LTR
: PANGO_DIRECTION_RTL);
pango_cairo_context_set_resolution (context, _gtk_css_number_value_get (style->core->dpi, 100));
pango_cairo_context_set_resolution (context, gtk_css_number_value_get (style->core->dpi, 100));
pango_context_set_font_map (context, gtk_widget_get_effective_font_map (widget));
@ -11857,7 +11857,7 @@ gtk_widget_create_render_node (GtkWidget *widget,
style = gtk_css_node_get_style (priv->cssnode);
css_opacity = _gtk_css_number_value_get (style->other->opacity, 100);
css_opacity = gtk_css_number_value_get (style->other->opacity, 100);
opacity = CLAMP (css_opacity, 0.0, 1.0) * priv->user_alpha / 255.0;
if (opacity <= 0.0)

View File

@ -1395,7 +1395,7 @@ constraints_for_edge (GdkSurfaceEdge edge)
static int
get_number (GtkCssValue *value)
{
double d = _gtk_css_number_value_get (value, 100);
double d = gtk_css_number_value_get (value, 100);
if (d < 1)
return ceil (d);

View File

@ -23,7 +23,7 @@ G_DEFINE_TYPE (GtkLayoutOverlay, gtk_layout_overlay, GTK_TYPE_INSPECTOR_OVERLAY)
static int
get_number (GtkCssValue *value)
{
double d = _gtk_css_number_value_get (value, 100);
double d = gtk_css_number_value_get (value, 100);
if (d < 1)
return ceil (d);

View File

@ -3,7 +3,7 @@ a {
}
b {
transition-duration: calc(-200ms + 1s);
transition-duration: 0.80000000000000004s;
}
c {

View File

@ -0,0 +1,88 @@
a {
margin-left: min(3px, 1em, 20cm);
margin-right: min(3px, 5px, 30px);
margin-top: calc(1px * min(3, 5, 10));
}
b {
padding-left: max(3px, 4em, 2px, 20cm);
padding-top: calc(1cm * max(3, 5, 7));
transition-duration: max(1s, 100ms);
}
c {
background-size: clamp(none, calc(pi * 1pt), 10cm);
border-left-width: clamp(2px, calc(e * 1px), none);
margin-left: clamp(2px, 1em, 10cm);
}
d {
background-size: round(nearest, 17.3px, 2.2px);
border-left-width: round(down, 17px, 3ex);
border-right-width: calc(1px * round(17.5));
border-top-width: round(up, 17px, 3px);
}
e {
background-size: rem(17.3px, 2.2px);
}
f {
border-top-left-radius: mod(-17.3px, 2.2px);
}
g {
border-bottom-right-radius: calc(1px * sin(20));
}
h {
margin-left: calc(1px * cos(20));
}
i {
margin-right: calc(1px * tan(20));
}
j {
filter: hue-rotate(asin(20));
}
k {
filter: hue-rotate(acos(20));
}
l {
filter: hue-rotate(atan(20));
}
m {
filter: hue-rotate(atan2(20px, 30px));
}
n {
margin-top: calc(1px * pow(2, 3.5));
}
o {
margin-bottom: calc(1px * sqrt(2));
}
p {
padding-left: calc(1px * hypot(2, 3, 4, 5));
}
q {
padding-right: calc(1px * log(8, 3));
}
r {
padding-top: calc(1px * exp(5.4));
}
s {
padding-bottom: calc(1px * abs(sin(e)));
}
t {
border-width: calc(1px * pow(pi, sign(-infinity)));
}

View File

@ -0,0 +1,91 @@
a {
margin-left: min(3px, 1em, 20cm);
margin-right: 3px;
margin-top: 3px;
}
b {
padding-left: max(3px, 4em, 20cm);
padding-top: 7cm;
transition-duration: 1s;
}
c {
background-size: 1.1082840819977162mm;
border-left-width: 2.7182818284590451px;
margin-left: clamp(2px, 1em, 10cm);
}
d {
background-size: 17.600000000000001px;
border-left-width: round(down, 17px, 3ex);
border-right-width: 18px;
border-top-width: 18px;
}
e {
background-size: 1.8999999999999995;
}
f {
border-top-left-radius: 0.30000000000000071;
}
g {
border-bottom-right-radius: 0.91294525072762767px;
}
h {
margin-left: 0.40808206181339196px;
}
i {
margin-right: 2.2371609442247422px;
}
j {
filter: hue-rotate(NaN);
}
k {
filter: hue-rotate(NaN);
}
l {
filter: hue-rotate(87.137594773888253deg);
}
m {
filter: hue-rotate(33.690067525979785deg);
}
n {
margin-top: 11.313708498984761px;
}
o {
margin-bottom: 1.4142135623730951px;
}
p {
padding-left: 7.3484692283495345px;
}
q {
padding-right: 1.8927892607143719px;
}
r {
padding-top: 221.40641620418717px;
}
s {
padding-bottom: 0.41078129050290885px;
}
t {
border-bottom-width: 0.31830988618379069px;
border-left-width: 0.31830988618379069px;
border-right-width: 0.31830988618379069px;
border-top-width: 0.31830988618379069px;
}

View File

@ -0,0 +1,50 @@
a {
margin-left: calc(1px * mod(5, 0));
margin-right: calc(1px * mod(infinity, 2));
margin-top: calc(1px * mod(-1, infinity));
padding-left: mod(18px, 5px);
padding-right: mod(18px, -5px);
padding-top: mod(-18px, 5px);
}
b {
margin-left: calc(1px * rem(5, 0));
margin-right: calc(1px * rem(infinity, 2));
margin-top: calc(1px * rem(-1, infinity));
padding-left: rem(18px, 5px);
padding-right: rem(18px, -5px);
padding-top: rem(-18px, 5px);
}
c {
margin-bottom: round(to-zero, 18px, 5px);
margin-left: round(up, 18px, 5px);
margin-right: round(down, 18px, 5px);
margin-top: round(nearest, 18px, 5px);
}
d {
margin-left: abs(20px);
margin-right: round(1px * cos(abs(-90deg)), 1px);
margin-top: calc(1px * sign(-20deg));
}
e {
margin-bottom: calc(1px * round(18, 0));
margin-left: calc(1px * round(infinity, infinity));
margin-right: calc(1px * round(infinity, 5));
margin-top: calc(1px * round(18, infinity));
padding-bottom: calc(1px * round(nearest, 18, infinity));
padding-left: calc(1px * round(up, 18, infinity));
padding-right: calc(1px * round(down, -18, infinity));
padding-top: calc(1px * round(to-zero, 18, infinity));
}
f {
margin-bottom: mod(18px, 0px);
margin-left: mod(calc(infinity * 1px), 5px);
margin-right: mod(-18px, calc(infinity * 1px));
}

View File

@ -0,0 +1,47 @@
a {
margin-left: NaN;
margin-right: NaN;
margin-top: NaN;
padding-left: 3;
padding-right: 3;
padding-top: 2;
}
b {
margin-left: NaN;
margin-right: NaN;
margin-top: -1px;
padding-left: 3;
padding-right: 3;
padding-top: -3;
}
c {
margin-bottom: 15px;
margin-left: 20px;
margin-right: 15px;
margin-top: 20px;
}
d {
margin-left: 20px;
margin-right: 0;
margin-top: -1px;
}
e {
margin-bottom: NaN;
margin-left: NaN;
margin-right: infinite;
margin-top: 0;
padding-bottom: 0;
padding-left: infinite;
padding-right: -infinite;
padding-top: 0;
}
f {
margin-bottom: NaN;
margin-left: NaN;
margin-right: NaN;
}

View File

@ -414,6 +414,10 @@ test_data = [
'line-height-invalid3.ref.css',
'margin.css',
'margin.ref.css',
'math.css',
'math.ref.css',
'math2.css',
'math2.ref.css',
'min-height.css',
'min-height.ref.css',
'min-width.css',

View File

@ -63,8 +63,8 @@ value_is_near (int prop,
break;
case GTK_CSS_PROPERTY_FONT_SIZE:
return fabs (_gtk_css_number_value_get (value1, 100) -
_gtk_css_number_value_get (value2, 100)) < FLT_EPSILON;
return fabs (gtk_css_number_value_get (value1, 100) -
gtk_css_number_value_get (value2, 100)) < FLT_EPSILON;
break;
default: