summaryrefslogtreecommitdiff
path: root/gtk/gtkcsslookup.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2012-01-02 15:44:45 +0100
committerBenjamin Otte <otte@redhat.com>2012-01-09 18:37:55 +0100
commite87cf5d7896746c8e9b81b037843c670f728287c (patch)
tree3e7cd8614154e458243d4e5e93d6db8d3bb16380 /gtk/gtkcsslookup.c
parent29382c130529caf94e037767b6dd3e2897071c0d (diff)
downloadgtk+-e87cf5d7896746c8e9b81b037843c670f728287c.tar.gz
css: Redo value resolving
Instead of on-demand resolvage, we now resolve during lookup. The step is done via _gtk_css_style_property_compute_value() which currently calls into _gtk_css_style_compute_value() That function has all the old resolving machinery. The only part missing for now is the handling of win32 code. It will be added back later.
Diffstat (limited to 'gtk/gtkcsslookup.c')
-rw-r--r--gtk/gtkcsslookup.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/gtk/gtkcsslookup.c b/gtk/gtkcsslookup.c
index dc43005287..af4eddfd41 100644
--- a/gtk/gtkcsslookup.c
+++ b/gtk/gtkcsslookup.c
@@ -135,6 +135,7 @@ _gtk_css_lookup_resolve (GtkCssLookup *lookup,
{
GtkCssStyleProperty *prop = _gtk_css_style_property_lookup_by_id (i);
const GValue *result;
+ GValue value = { 0, };
/* http://www.w3.org/TR/css3-cascade/#cascade
* Then, for every element, the value for each property can be found
@@ -192,36 +193,31 @@ _gtk_css_lookup_resolve (GtkCssLookup *lookup,
}
}
- if (result)
- {
- _gtk_style_properties_set_property_by_property (props,
- prop,
- 0,
- result);
- }
- else if (parent == NULL)
+ if (result == NULL && parent == NULL)
{
/* If the ‘inherit’ value is set on the root element, the property is
* assigned its initial value. */
- _gtk_style_properties_set_property_by_property (props,
- prop,
- 0,
- _gtk_css_style_property_get_initial_value (prop));
+ result = _gtk_css_style_property_get_initial_value (prop);
+ }
+
+ if (result)
+ {
+ _gtk_css_style_property_compute_value (prop, &value, context, result);
}
else
{
- GValue value = { 0, };
/* Set NULL here and do the inheritance upon lookup? */
gtk_style_context_get_property (parent,
_gtk_style_property_get_name (GTK_STYLE_PROPERTY (prop)),
gtk_style_context_get_state (parent),
&value);
- _gtk_style_properties_set_property_by_property (props,
- prop,
- 0,
- &value);
- g_value_unset (&value);
}
+
+ _gtk_style_properties_set_property_by_property (props,
+ prop,
+ 0,
+ &value);
+ g_value_unset (&value);
}
return props;