stylecontext: Split out a function

The function is used in multiple places, so split it out. In particular
because I'm about to change it.
This commit is contained in:
Benjamin Otte 2012-11-17 13:23:44 +01:00
parent b55724e3a7
commit c3f3a82db9
3 changed files with 22 additions and 12 deletions

View File

@ -604,3 +604,21 @@ _gtk_css_computed_values_cancel_animations (GtkCssComputedValues *values)
values->animations = NULL;
}
GtkBitmask *
_gtk_css_computed_values_compute_dependencies (GtkCssComputedValues *values,
const GtkBitmask *parent_changes)
{
GtkBitmask *changes;
g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), _gtk_bitmask_new ());
changes = _gtk_bitmask_copy (parent_changes);
changes = _gtk_bitmask_intersect (changes, values->depends_on_parent);
if (_gtk_bitmask_get (changes, GTK_CSS_PROPERTY_COLOR))
changes = _gtk_bitmask_union (changes, values->depends_on_color);
if (_gtk_bitmask_get (changes, GTK_CSS_PROPERTY_FONT_SIZE))
changes = _gtk_bitmask_union (changes, values->depends_on_font_size);
return changes;
}

View File

@ -87,6 +87,8 @@ GtkCssValue * _gtk_css_computed_values_get_intrinsic_value (GtkCssCom
guint id);
GtkBitmask * _gtk_css_computed_values_get_difference (GtkCssComputedValues *values,
GtkCssComputedValues *other);
GtkBitmask * _gtk_css_computed_values_compute_dependencies (GtkCssComputedValues *values,
const GtkBitmask *parent_changes);
void _gtk_css_computed_values_create_animations (GtkCssComputedValues *values,
GtkCssComputedValues *parent_values,

View File

@ -2955,12 +2955,7 @@ gtk_style_context_update_cache (GtkStyleContext *context,
StyleData *data = value;
GtkBitmask *changes;
changes = _gtk_bitmask_copy (parent_changes);
changes = _gtk_bitmask_intersect (changes, data->store->depends_on_parent);
if (_gtk_bitmask_get (changes, GTK_CSS_PROPERTY_COLOR))
changes = _gtk_bitmask_union (changes, data->store->depends_on_color);
if (_gtk_bitmask_get (changes, GTK_CSS_PROPERTY_FONT_SIZE))
changes = _gtk_bitmask_union (changes, data->store->depends_on_font_size);
changes = _gtk_css_computed_values_compute_dependencies (data->store, parent_changes);
if (!_gtk_bitmask_is_empty (changes))
build_properties (context, data->store, info, changes);
@ -3157,12 +3152,7 @@ _gtk_style_context_validate (GtkStyleContext *context,
}
else
{
changes = _gtk_bitmask_copy (parent_changes);
changes = _gtk_bitmask_intersect (changes, current->store->depends_on_parent);
if (_gtk_bitmask_get (changes, GTK_CSS_PROPERTY_COLOR))
changes = _gtk_bitmask_union (changes, current->store->depends_on_color);
if (_gtk_bitmask_get (changes, GTK_CSS_PROPERTY_FONT_SIZE))
changes = _gtk_bitmask_union (changes, current->store->depends_on_font_size);
changes = _gtk_css_computed_values_compute_dependencies (current->store, parent_changes);
gtk_style_context_update_cache (context, parent_changes);
}