[gtk+/wip/cssvalue: 156/164] stylecontext: Shuffle around code
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/cssvalue: 156/164] stylecontext: Shuffle around code
- Date: Wed, 11 Apr 2012 14:53:01 +0000 (UTC)
commit 14e74d5739ababc6617e3f02dd5ede8694065482
Author: Benjamin Otte <otte redhat com>
Date: Wed Apr 11 12:37:44 2012 +0200
stylecontext: Shuffle around code
This has two goals:
1) Move invalidation code out of a nested if branch. Invalidation is
actually the most important thing this function does.
2) Have the changes bitmask available. It will needed for invalidate
calls to children later.
gtk/gtkstylecontext.c | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 73db284..40d24f5 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -2939,6 +2939,7 @@ _gtk_style_context_validate (GtkStyleContext *context,
GtkCssChange change)
{
GtkStyleContextPrivate *priv;
+ GtkBitmask *changes;
GSList *list;
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
@@ -2990,27 +2991,31 @@ _gtk_style_context_validate (GtkStyleContext *context,
if (old)
{
- GtkBitmask *bitmask;
-
new = style_data_lookup (context)->store;
- bitmask = _gtk_css_computed_values_get_difference (new, old);
- if (!_gtk_bitmask_is_empty (bitmask))
- gtk_style_context_do_invalidate (context);
+ changes = _gtk_css_computed_values_get_difference (new, old);
- _gtk_bitmask_free (bitmask);
g_object_unref (old);
}
else
- gtk_style_context_do_invalidate (context);
-
+ {
+ changes = _gtk_bitmask_new ();
+ changes = _gtk_bitmask_invert_range (changes, 0, _gtk_css_style_property_get_n_properties ());
+ }
}
+ else
+ changes = _gtk_bitmask_new ();
+
+ if (!_gtk_bitmask_is_empty (changes))
+ gtk_style_context_do_invalidate (context);
change = _gtk_css_change_for_child (change);
for (list = priv->children; list; list = list->next)
{
_gtk_style_context_validate (list->data, timestamp, change);
}
+
+ _gtk_bitmask_free (changes);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]