css: Pass relevant properties to css lookup code

This is not used yet in this patch.
This commit is contained in:
Benjamin Otte
2012-08-24 17:31:57 +02:00
parent 6fbd8b0003
commit 1d7b23845f
3 changed files with 16 additions and 6 deletions

View File

@ -36,14 +36,22 @@ struct _GtkCssLookup {
}; };
GtkCssLookup * GtkCssLookup *
_gtk_css_lookup_new (void) _gtk_css_lookup_new (const GtkBitmask *relevant)
{ {
GtkCssLookup *lookup; GtkCssLookup *lookup;
guint n = _gtk_css_style_property_get_n_properties (); guint n = _gtk_css_style_property_get_n_properties ();
lookup = g_malloc0 (sizeof (GtkCssLookup) + sizeof (GtkCssLookupValue) * n); lookup = g_malloc0 (sizeof (GtkCssLookup) + sizeof (GtkCssLookupValue) * n);
lookup->missing = _gtk_bitmask_new ();
lookup->missing = _gtk_bitmask_invert_range (lookup->missing, 0, n); if (relevant)
{
lookup->missing = _gtk_bitmask_copy (relevant);
}
else
{
lookup->missing = _gtk_bitmask_new ();
lookup->missing = _gtk_bitmask_invert_range (lookup->missing, 0, n);
}
return lookup; return lookup;
} }
@ -169,11 +177,13 @@ _gtk_css_lookup_resolve (GtkCssLookup *lookup,
lookup->values[i].computed, lookup->values[i].computed,
0, 0,
lookup->values[i].section); lookup->values[i].section);
else else if (lookup->values[i].value ||
_gtk_bitmask_get (lookup->missing, i))
_gtk_css_computed_values_compute_value (values, _gtk_css_computed_values_compute_value (values,
context, context,
i, i,
lookup->values[i].value, lookup->values[i].value,
lookup->values[i].section); lookup->values[i].section);
/* else not a relevant property */
} }
} }

View File

@ -29,7 +29,7 @@ G_BEGIN_DECLS
typedef struct _GtkCssLookup GtkCssLookup; typedef struct _GtkCssLookup GtkCssLookup;
GtkCssLookup * _gtk_css_lookup_new (void); GtkCssLookup * _gtk_css_lookup_new (const GtkBitmask *relevant);
void _gtk_css_lookup_free (GtkCssLookup *lookup); void _gtk_css_lookup_free (GtkCssLookup *lookup);
const GtkBitmask * _gtk_css_lookup_get_missing (const GtkCssLookup *lookup); const GtkBitmask * _gtk_css_lookup_get_missing (const GtkCssLookup *lookup);

View File

@ -902,7 +902,7 @@ build_properties (GtkStyleContext *context,
priv = context->priv; priv = context->priv;
lookup = _gtk_css_lookup_new (); lookup = _gtk_css_lookup_new (NULL);
if (_gtk_css_matcher_init (&matcher, path, state)) if (_gtk_css_matcher_init (&matcher, path, state))
_gtk_style_provider_private_lookup (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade), _gtk_style_provider_private_lookup (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),