[gtk+] styleproperty: Add _gtk_css_style_property_changes_affect_size()



commit 8560ff88cd4c88bf105e6aa13f428c189e0f6c1b
Author: Benjamin Otte <otte redhat com>
Date:   Fri Nov 30 20:37:46 2012 +0100

    styleproperty: Add _gtk_css_style_property_changes_affect_size()
    
    This gives fast access to the question of wether a style update requires
    a resize.

 gtk/gtkcssstyleproperty.c        |   13 +++++++++++++
 gtk/gtkcssstylepropertyprivate.h |    3 +++
 2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssstyleproperty.c b/gtk/gtkcssstyleproperty.c
index 9327921..bd7d5a0 100644
--- a/gtk/gtkcssstyleproperty.c
+++ b/gtk/gtkcssstyleproperty.c
@@ -46,6 +46,8 @@ enum {
 
 G_DEFINE_TYPE (GtkCssStyleProperty, _gtk_css_style_property, GTK_TYPE_STYLE_PROPERTY)
 
+static GtkBitmask *_properties_affecting_size = NULL;
+
 static void
 gtk_css_style_property_constructed (GObject *object)
 {
@@ -55,6 +57,9 @@ gtk_css_style_property_constructed (GObject *object)
   property->id = klass->style_properties->len;
   g_ptr_array_add (klass->style_properties, property);
 
+  if (property->affects_size)
+    _properties_affecting_size = _gtk_bitmask_set (_properties_affecting_size, property->id, TRUE);
+
   G_OBJECT_CLASS (_gtk_css_style_property_parent_class)->constructed (object);
 }
 
@@ -292,6 +297,8 @@ _gtk_css_style_property_class_init (GtkCssStylePropertyClass *klass)
   property_class->parse_value = gtk_css_style_property_parse_value;
 
   klass->style_properties = g_ptr_array_new ();
+
+  _properties_affecting_size = _gtk_bitmask_new ();
 }
 
 static GtkCssValue *
@@ -446,3 +453,9 @@ _gtk_css_style_property_get_initial_value (GtkCssStyleProperty *property)
 
   return property->initial_value;
 }
+
+gboolean
+_gtk_css_style_property_changes_affect_size (const GtkBitmask *changes)
+{
+  return _gtk_bitmask_intersects (changes, _properties_affecting_size);
+}
diff --git a/gtk/gtkcssstylepropertyprivate.h b/gtk/gtkcssstylepropertyprivate.h
index 34411e0..00d8437 100644
--- a/gtk/gtkcssstylepropertyprivate.h
+++ b/gtk/gtkcssstylepropertyprivate.h
@@ -80,6 +80,9 @@ GtkCssValue  *          _gtk_css_style_property_get_initial_value
 void                    _gtk_css_style_property_print_value     (GtkCssStyleProperty    *property,
                                                                  GtkCssValue            *value,
                                                                  GString                *string);
+
+gboolean                _gtk_css_style_property_changes_affect_size
+                                                                (const GtkBitmask       *changes);
                                                                  
 
 G_END_DECLS



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]