[gtk+/wip/cssstyle: 19/27] stylecontext: Simplify function
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/cssstyle: 19/27] stylecontext: Simplify function
- Date: Wed, 24 Dec 2014 02:20:59 +0000 (UTC)
commit 0fca4b637f29b6ceac772c9cda37a8373f85cc06
Author: Benjamin Otte <otte redhat com>
Date: Tue Dec 16 06:47:08 2014 +0100
stylecontext: Simplify function
Instead of computing the changes manually everywhere from the parent
changes, just pass in the parent changes.
gtk/gtkstylecontext.c | 29 +++++++++++++++--------------
1 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index e09af0e..bdbb129 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -673,17 +673,25 @@ static void
update_properties (GtkStyleContext *context,
GtkCssStyle *style,
const GtkCssNodeDeclaration *decl,
- const GtkBitmask *relevant_changes)
+ const GtkBitmask *parent_changes)
{
GtkStyleContextPrivate *priv;
GtkCssMatcher matcher;
GtkWidgetPath *path;
GtkCssLookup *lookup;
+ GtkBitmask *changes;
priv = context->priv;
+ changes = gtk_css_style_compute_dependencies (style, parent_changes);
+ if (_gtk_bitmask_is_empty (changes))
+ {
+ _gtk_bitmask_free (changes);
+ return;
+ }
+
path = create_query_path (context, decl);
- lookup = _gtk_css_lookup_new (relevant_changes);
+ lookup = _gtk_css_lookup_new (changes);
if (_gtk_css_matcher_init (&matcher, path))
_gtk_style_provider_private_lookup (GTK_STYLE_PROVIDER_PRIVATE (priv->cascade),
@@ -699,6 +707,7 @@ update_properties (GtkStyleContext *context,
_gtk_css_lookup_free (lookup);
gtk_widget_path_free (path);
+ _gtk_bitmask_free (changes);
}
static GtkCssStyle *
@@ -2676,14 +2685,8 @@ gtk_style_context_update_cache (GtkStyleContext *context,
{
const GtkCssNodeDeclaration *decl = key;
GtkCssStyle *values = value;
- GtkBitmask *changes;
-
- changes = gtk_css_style_compute_dependencies (values, parent_changes);
-
- if (!_gtk_bitmask_is_empty (changes))
- update_properties (context, values, decl, changes);
- _gtk_bitmask_free (changes);
+ update_properties (context, values, decl, parent_changes);
}
gtk_style_context_clear_property_cache (context);
@@ -2830,15 +2833,13 @@ _gtk_style_context_validate (GtkStyleContext *context,
{
gtk_style_context_update_cache (context, parent_changes);
- changes = gtk_css_style_compute_dependencies (current, parent_changes);
- if (!_gtk_bitmask_is_empty (changes))
+ if (!_gtk_bitmask_is_empty (parent_changes))
{
if (GTK_IS_CSS_ANIMATED_STYLE (current))
- update_properties (context, GTK_CSS_ANIMATED_STYLE (current)->style, info->decl, changes);
+ update_properties (context, GTK_CSS_ANIMATED_STYLE (current)->style, info->decl, parent_changes);
else
- update_properties (context, current, info->decl, changes);
+ update_properties (context, current, info->decl, parent_changes);
}
- _gtk_bitmask_free (changes);
if (change & GTK_CSS_CHANGE_ANIMATE &&
gtk_style_context_is_animating (context))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]