[gtk+] stylecontext: Split out a function
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] stylecontext: Split out a function
- Date: Sun, 18 Nov 2012 20:56:27 +0000 (UTC)
commit c3f3a82db93128b37d456306ce25db65adbbf995
Author: Benjamin Otte <otte redhat com>
Date: Sat Nov 17 13:23:44 2012 +0100
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.
gtk/gtkcsscomputedvalues.c | 18 ++++++++++++++++++
gtk/gtkcsscomputedvaluesprivate.h | 2 ++
gtk/gtkstylecontext.c | 14 ++------------
3 files changed, 22 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkcsscomputedvalues.c b/gtk/gtkcsscomputedvalues.c
index 339be02..7ab7035 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 28afec3..5c88c72 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 8a193cc..312ae15 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]