summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2015-01-27 05:03:52 +0100
committerBenjamin Otte <otte@redhat.com>2015-01-27 05:04:34 +0100
commitaa1b7fab9c6a2b39ccdf90c8ee1e04e583815424 (patch)
treefdf73cb68531894f160b97b65a91b4439452de74
parent488ea44a597063ecd9d1354bc01b1e165670a98d (diff)
downloadgtk+-aa1b7fab9c6a2b39ccdf90c8ee1e04e583815424.tar.gz
css: Remove _gtk_css_style_property_changes_affect_size()
... and _gtk_css_style_property_changes_affect_font(). Replace it with _gtk_css_style_property_get_mask_affecting().
-rw-r--r--gtk/gtkcssstyleproperty.c23
-rw-r--r--gtk/gtkcssstylepropertyprivate.h4
-rw-r--r--gtk/gtktextview.c7
-rw-r--r--gtk/gtktreeview.c7
-rw-r--r--gtk/gtkwidget.c7
5 files changed, 18 insertions, 30 deletions
diff --git a/gtk/gtkcssstyleproperty.c b/gtk/gtkcssstyleproperty.c
index 55da7d17de..9f6dca23f2 100644
--- a/gtk/gtkcssstyleproperty.c
+++ b/gtk/gtkcssstyleproperty.c
@@ -47,9 +47,6 @@ enum {
G_DEFINE_TYPE (GtkCssStyleProperty, _gtk_css_style_property, GTK_TYPE_STYLE_PROPERTY)
-static GtkBitmask *_properties_affecting_size = NULL;
-static GtkBitmask *_properties_affecting_font = NULL;
-
static GtkCssStylePropertyClass *gtk_css_style_property_class = NULL;
static void
@@ -61,12 +58,6 @@ gtk_css_style_property_constructed (GObject *object)
property->id = klass->style_properties->len;
g_ptr_array_add (klass->style_properties, property);
- if (property->affects & (GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP))
- _properties_affecting_size = _gtk_bitmask_set (_properties_affecting_size, property->id, TRUE);
-
- if (property->affects & GTK_CSS_AFFECTS_FONT)
- _properties_affecting_font = _gtk_bitmask_set (_properties_affecting_font, property->id, TRUE);
-
G_OBJECT_CLASS (_gtk_css_style_property_parent_class)->constructed (object);
}
@@ -253,9 +244,6 @@ _gtk_css_style_property_class_init (GtkCssStylePropertyClass *klass)
klass->style_properties = g_ptr_array_new ();
- _properties_affecting_size = _gtk_bitmask_new ();
- _properties_affecting_font = _gtk_bitmask_new ();
-
gtk_css_style_property_class = klass;
}
@@ -435,14 +423,3 @@ _gtk_css_style_property_get_mask_affecting (GtkCssAffects affects)
return result;
}
-gboolean
-_gtk_css_style_property_changes_affect_size (const GtkBitmask *changes)
-{
- return _gtk_bitmask_intersects (changes, _properties_affecting_size);
-}
-
-gboolean
-_gtk_css_style_property_changes_affect_font (const GtkBitmask *changes)
-{
- return _gtk_bitmask_intersects (changes, _properties_affecting_font);
-}
diff --git a/gtk/gtkcssstylepropertyprivate.h b/gtk/gtkcssstylepropertyprivate.h
index fbc8489749..2dbe6ed9fb 100644
--- a/gtk/gtkcssstylepropertyprivate.h
+++ b/gtk/gtkcssstylepropertyprivate.h
@@ -85,10 +85,6 @@ void _gtk_css_style_property_print_value (GtkCssStyleProp
GtkBitmask * _gtk_css_style_property_get_mask_affecting
(GtkCssAffects affects);
-gboolean _gtk_css_style_property_changes_affect_size
- (const GtkBitmask *changes);
-gboolean _gtk_css_style_property_changes_affect_font
- (const GtkBitmask *changes);
G_END_DECLS
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index cdf7503e10..6d0777cc16 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -4454,12 +4454,16 @@ gtk_text_view_set_background (GtkTextView *text_view)
static void
gtk_text_view_style_updated (GtkWidget *widget)
{
+ static GtkBitmask *affects_font = NULL;
GtkTextView *text_view;
GtkTextViewPrivate *priv;
PangoContext *ltr_context, *rtl_context;
GtkStyleContext *style_context;
const GtkBitmask *changes;
+ if (G_UNLIKELY (affects_font) == NULL)
+ affects_font = _gtk_css_style_property_get_mask_affecting (GTK_CSS_AFFECTS_FONT);
+
text_view = GTK_TEXT_VIEW (widget);
priv = text_view->priv;
@@ -4473,7 +4477,8 @@ gtk_text_view_style_updated (GtkWidget *widget)
style_context = gtk_widget_get_style_context (widget);
changes = _gtk_style_context_get_changes (style_context);
- if ((changes == NULL || _gtk_css_style_property_changes_affect_font (changes)) &&
+
+ if ((changes == NULL || _gtk_bitmask_intersects (changes, affects_font)) &&
priv->layout && priv->layout->default_style)
{
gtk_text_view_set_attributes_from_style (text_view,
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 2c79b620a5..3a7355dc48 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -8700,12 +8700,16 @@ gtk_tree_view_grab_focus (GtkWidget *widget)
static void
gtk_tree_view_style_updated (GtkWidget *widget)
{
+ static GtkBitmask *affects_size = NULL;
GtkTreeView *tree_view = GTK_TREE_VIEW (widget);
GList *list;
GtkTreeViewColumn *column;
GtkStyleContext *style_context;
const GtkBitmask *changes;
+ if (G_UNLIKELY (affects_size) == NULL)
+ affects_size = _gtk_css_style_property_get_mask_affecting (GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP);
+
GTK_WIDGET_CLASS (gtk_tree_view_parent_class)->style_updated (widget);
if (gtk_widget_get_realized (widget))
@@ -8718,7 +8722,8 @@ gtk_tree_view_style_updated (GtkWidget *widget)
style_context = gtk_widget_get_style_context (widget);
changes = _gtk_style_context_get_changes (style_context);
- if (changes == NULL || _gtk_css_style_property_changes_affect_size (changes))
+
+ if (changes == NULL || _gtk_bitmask_intersects (changes, affects_size))
{
for (list = tree_view->priv->columns; list; list = list->next)
{
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 980e457eef..b7fa3670a5 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -8229,7 +8229,12 @@ gtk_widget_real_style_updated (GtkWidget *widget)
if (widget->priv->anchored)
{
- if (changes == NULL || _gtk_css_style_property_changes_affect_size (changes))
+ static GtkBitmask *affects_size = NULL;
+
+ if (G_UNLIKELY (affects_size) == NULL)
+ affects_size = _gtk_css_style_property_get_mask_affecting (GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP);
+
+ if (changes == NULL || _gtk_bitmask_intersects (changes, affects_size))
gtk_widget_queue_resize (widget);
else
gtk_widget_queue_draw (widget);