[gtk+/wip/css: 5/125] cssprovider: Keep a bitmask for the properties
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/css: 5/125] cssprovider: Keep a bitmask for the properties
- Date: Tue, 3 Jan 2012 04:11:09 +0000 (UTC)
commit 5b38887ea1e702cdebcfcfa5244020ee143f953c
Author: Benjamin Otte <otte redhat com>
Date: Fri Dec 23 14:23:52 2011 +0100
cssprovider: Keep a bitmask for the properties
That way we can easily tell wich properties are in use.
gtk/gtkcssprovider.c | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 4b8ef52..81655bd 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -27,6 +27,7 @@
#include "gtkcssproviderprivate.h"
+#include "gtkbitmaskprivate.h"
#include "gtkcssparserprivate.h"
#include "gtkcsssectionprivate.h"
#include "gtkcssselectorprivate.h"
@@ -960,6 +961,7 @@ struct GtkCssRuleset
GtkCssSelector *selector;
GHashTable *widget_style;
GHashTable *style;
+ GtkBitmask *set_styles;
guint has_inherit :1;
};
@@ -1109,6 +1111,8 @@ gtk_css_ruleset_init_copy (GtkCssRuleset *new,
g_hash_table_ref (new->widget_style);
if (new->style)
g_hash_table_ref (new->style);
+ if (new->set_styles)
+ new->set_styles = _gtk_bitmask_copy (new->set_styles);
}
static void
@@ -1116,6 +1120,8 @@ gtk_css_ruleset_clear (GtkCssRuleset *ruleset)
{
if (ruleset->style)
g_hash_table_unref (ruleset->style);
+ if (ruleset->set_styles)
+ _gtk_bitmask_free (ruleset->set_styles);
if (ruleset->widget_style)
g_hash_table_unref (ruleset->widget_style);
if (ruleset->selector)
@@ -1173,10 +1179,13 @@ gtk_css_ruleset_add (GtkCssRuleset *ruleset,
PropertyValue *value)
{
if (ruleset->style == NULL)
- ruleset->style = g_hash_table_new_full (g_direct_hash,
- g_direct_equal,
- NULL,
- (GDestroyNotify) property_value_free);
+ {
+ ruleset->style = g_hash_table_new_full (g_direct_hash,
+ g_direct_equal,
+ NULL,
+ (GDestroyNotify) property_value_free);
+ ruleset->set_styles = _gtk_bitmask_new ();
+ }
if (_gtk_style_property_is_shorthand (prop))
{
@@ -1200,6 +1209,7 @@ gtk_css_ruleset_add (GtkCssRuleset *ruleset,
return;
}
+ _gtk_bitmask_set (ruleset->set_styles, _gtk_style_property_get_id (prop), TRUE);
ruleset->has_inherit |= _gtk_style_property_is_inherit (prop);
g_hash_table_insert (ruleset->style, (gpointer) prop, value);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]