diff options
author | Benjamin Otte <otte@redhat.com> | 2012-11-17 13:23:44 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-11-18 21:55:43 +0100 |
commit | c3f3a82db93128b37d456306ce25db65adbbf995 (patch) | |
tree | 7b68a15400c9c02ea19c4a07992b87b46eae1254 | |
parent | b55724e3a741029915b9e563cd5c9adf76259755 (diff) | |
download | gtk+-c3f3a82db93128b37d456306ce25db65adbbf995.tar.gz |
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.
-rw-r--r-- | gtk/gtkcsscomputedvalues.c | 18 | ||||
-rw-r--r-- | gtk/gtkcsscomputedvaluesprivate.h | 2 | ||||
-rw-r--r-- | gtk/gtkstylecontext.c | 14 |
3 files changed, 22 insertions, 12 deletions
diff --git a/gtk/gtkcsscomputedvalues.c b/gtk/gtkcsscomputedvalues.c index 339be02ad7..7ab7035941 100644 --- a/gtk/gtkcsscomputedvalues.c +++ b/gtk/gtkcsscomputedvalues.c @@ -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; +} + diff --git a/gtk/gtkcsscomputedvaluesprivate.h b/gtk/gtkcsscomputedvaluesprivate.h index 28afec3807..5c88c72a33 100644 --- a/gtk/gtkcsscomputedvaluesprivate.h +++ b/gtk/gtkcsscomputedvaluesprivate.h @@ -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, diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index 8a193cc65d..312ae15ee8 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -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); } |