summaryrefslogtreecommitdiff
path: root/gtk/gtkstylecontext.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2014-12-16 06:40:10 +0100
committerBenjamin Otte <otte@redhat.com>2015-01-07 14:26:47 +0100
commitc0af2d6fa6acecb987273fea66faedcc33bbbad7 (patch)
tree925f1ec54f878ef96eb783c51d6ad94ac257028f /gtk/gtkstylecontext.c
parent7493e814a9501538d5db1e289200ed40bffdc857 (diff)
downloadgtk+-c0af2d6fa6acecb987273fea66faedcc33bbbad7.tar.gz
stylecontext: Simplify code
Compute the differences only once and not in both if branches.
Diffstat (limited to 'gtk/gtkstylecontext.c')
-rw-r--r--gtk/gtkstylecontext.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 401a5601bc..e515755f20 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -2832,16 +2832,6 @@ _gtk_style_context_validate (GtkStyleContext *context,
style_info_set_values (info, values);
_gtk_style_context_update_animating (context);
- if (current)
- {
- changes = gtk_css_style_get_difference (values, current);
- }
- else
- {
- changes = _gtk_bitmask_new ();
- changes = _gtk_bitmask_invert_range (changes, 0, _gtk_css_style_property_get_n_properties ());
- }
-
g_object_unref (values);
}
else
@@ -2856,21 +2846,17 @@ _gtk_style_context_validate (GtkStyleContext *context,
else
update_properties (context, current, info->decl, changes);
}
+ _gtk_bitmask_free (changes);
if (change & GTK_CSS_CHANGE_ANIMATE &&
gtk_style_context_is_animating (context))
{
GtkCssStyle *new_values;
- GtkBitmask *animation_changes;
new_values = gtk_css_animated_style_new_advance (GTK_CSS_ANIMATED_STYLE (info->values), timestamp);
- animation_changes = gtk_css_style_get_difference (new_values, info->values);
style_info_set_values (info, new_values);
g_object_unref (new_values);
- changes = _gtk_bitmask_union (changes, animation_changes);
- _gtk_bitmask_free (animation_changes);
-
if (!GTK_IS_CSS_ANIMATED_STYLE (info->values) ||
gtk_css_animated_style_is_static (GTK_CSS_ANIMATED_STYLE (info->values)))
_gtk_style_context_update_animating (context);
@@ -2878,7 +2864,15 @@ _gtk_style_context_validate (GtkStyleContext *context,
}
if (current)
- g_object_unref (current);
+ {
+ changes = gtk_css_style_get_difference (info->values, current);
+ g_object_unref (current);
+ }
+ else
+ {
+ changes = _gtk_bitmask_new ();
+ changes = _gtk_bitmask_invert_range (changes, 0, _gtk_css_style_property_get_n_properties ());
+ }
if (!_gtk_bitmask_is_empty (changes))
gtk_style_context_do_invalidate (context, changes);