summaryrefslogtreecommitdiff
path: root/gtk/gtkcssshorthandpropertyimpl.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2018-07-03 23:23:36 +0200
committerBenjamin Otte <otte@redhat.com>2018-07-04 06:15:33 +0200
commit3ca59b8701f93b446a695a61be3b76fa4d842e4c (patch)
treefd844543221093d2f94ebc54dff9e53a72287b31 /gtk/gtkcssshorthandpropertyimpl.c
parentfba0b359d48493efc19dab5d35926f5e55e4c9d5 (diff)
downloadgtk+-3ca59b8701f93b446a695a61be3b76fa4d842e4c.tar.gz
css: Don't do indirections
We don't need to look up the property by name to query its ID when we know the ID already because it's inside an enum.
Diffstat (limited to 'gtk/gtkcssshorthandpropertyimpl.c')
-rw-r--r--gtk/gtkcssshorthandpropertyimpl.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/gtk/gtkcssshorthandpropertyimpl.c b/gtk/gtkcssshorthandpropertyimpl.c
index f5c078009b..be88cc672b 100644
--- a/gtk/gtkcssshorthandpropertyimpl.c
+++ b/gtk/gtkcssshorthandpropertyimpl.c
@@ -1080,12 +1080,10 @@ pack_border_radius (GtkCssShorthandProperty *shorthand,
GtkStyleQueryFunc query_func,
gpointer query_data)
{
- GtkCssStyleProperty *prop;
GtkCssValue *v;
int i = 0;
- prop = GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("border-top-left-radius"));
- v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
+ v = (* query_func) (GTK_CSS_PROPERTY_BORDER_TOP_LEFT_RADIUS, query_data);
if (v)
i = _gtk_css_corner_value_get_x (v, 100);
@@ -1104,26 +1102,26 @@ pack_font_description (GtkCssShorthandProperty *shorthand,
description = pango_font_description_new ();
- v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-family"))), query_data);
+ v = (* query_func) (GTK_CSS_PROPERTY_FONT_FAMILY, query_data);
if (v)
{
/* xxx: Can we set all the families here somehow? */
pango_font_description_set_family (description, _gtk_css_string_value_get (_gtk_css_array_value_get_nth (v, 0)));
}
- v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-size"))), query_data);
+ v = (* query_func) (GTK_CSS_PROPERTY_FONT_SIZE, query_data);
if (v)
pango_font_description_set_absolute_size (description, round (_gtk_css_number_value_get (v, 100) * PANGO_SCALE));
- v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-style"))), query_data);
+ v = (* query_func) (GTK_CSS_PROPERTY_FONT_STYLE, query_data);
if (v)
pango_font_description_set_style (description, _gtk_css_font_style_value_get (v));
- v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-weight"))), query_data);
+ v = (* query_func) (GTK_CSS_PROPERTY_FONT_WEIGHT, query_data);
if (v)
pango_font_description_set_weight (description, _gtk_css_font_weight_value_get (v));
- v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-stretch"))), query_data);
+ v = (* query_func) (GTK_CSS_PROPERTY_FONT_STRETCH, query_data);
if (v)
pango_font_description_set_stretch (description, _gtk_css_font_stretch_value_get (v));