static void
gtk_css_font_features_value_add_feature (GtkCssValue *value,
- const char *name,
- GtkCssValue *val)
+ const char *name,
+ int num)
{
- g_hash_table_insert (value->features, g_strdup (name), val);
+ g_hash_table_insert (value->features, g_strdup (name), GINT_TO_POINTER (num));
}
while (g_hash_table_iter_next (&iter, &name, &val1))
{
val2 = g_hash_table_lookup (value2->features, name);
- if (val2 == NULL)
- return FALSE;
- if (!_gtk_css_value_equal (val1, val2))
+ if (val1 != val2)
return FALSE;
}
double progress)
{
const char *name;
- GtkCssValue *start_val, *end_val;
+ gpointer start_val, end_val;
GHashTableIter iter;
- GtkCssValue *result, *transition;
+ gpointer transition;
+ GtkCssValue *result;
/* XXX: For value that are only in start or end but not both,
* we don't transition but just keep the value.
{
end_val = g_hash_table_lookup (end->features, name);
if (end_val == NULL)
- transition = _gtk_css_value_ref (start_val);
+ transition = start_val;
else
- transition = _gtk_css_value_transition (start_val, end_val, property_id, progress);
+ transition = progress > 0.5 ? start_val : end_val;
- gtk_css_font_features_value_add_feature (result, name, transition);
+ gtk_css_font_features_value_add_feature (result, name, GPOINTER_TO_INT (transition));
}
g_hash_table_iter_init (&iter, end->features);
if (start_val != NULL)
continue;
- gtk_css_font_features_value_add_feature (result, name, _gtk_css_value_ref (end_val));
+ gtk_css_font_features_value_add_feature (result, name, GPOINTER_TO_INT (end_val));
}
return result;
{
GHashTableIter iter;
const char *name;
- GtkCssValue *val;
+ gpointer val;
gboolean first = TRUE;
if (value == default_font_features)
else
g_string_append (string, ", ");
g_string_append_printf (string, "\"%s\" ", name);
- _gtk_css_value_print (val, string);
+ g_string_append_printf (string, "%d", GPOINTER_TO_INT (val));
}
}
GtkCssValue *
gtk_css_font_features_value_parse (GtkCssParser *parser)
{
- GtkCssValue *result, *val;
+ GtkCssValue *result;
char *name;
int num;
}
if (gtk_css_parser_try_ident (parser, "on"))
- val = _gtk_css_number_value_new (1.0, GTK_CSS_NUMBER);
+ num = 1;
else if (gtk_css_parser_try_ident (parser, "off"))
- val = _gtk_css_number_value_new (0.0, GTK_CSS_NUMBER);
+ num = 0;
else if (gtk_css_parser_has_integer (parser))
{
- if (gtk_css_parser_consume_integer (parser, &num))
- {
- val = _gtk_css_number_value_new ((double)num, GTK_CSS_NUMBER);
- }
- else
+ if (!gtk_css_parser_consume_integer (parser, &num))
{
g_free (name);
_gtk_css_value_unref (result);
}
}
else
- val = _gtk_css_number_value_new (1.0, GTK_CSS_NUMBER);
+ num = 1;
- gtk_css_font_features_value_add_feature (result, name, val);
+ gtk_css_font_features_value_add_feature (result, name, num);
g_free (name);
} while (gtk_css_parser_try_token (parser, GTK_CSS_TOKEN_COMMA));
first = FALSE;
else
g_string_append (string, ", ");
- g_string_append_printf (string, "%s %d", name, (int)_gtk_css_number_value_get (val, 100));
+ g_string_append_printf (string, "%s %d", name, GPOINTER_TO_INT (val));
}
return g_string_free (string, FALSE);