[gtk+] css: Remove _gtk_css_style_property_changes_affect_size()
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] css: Remove _gtk_css_style_property_changes_affect_size()
- Date: Tue, 27 Jan 2015 04:08:40 +0000 (UTC)
commit aa1b7fab9c6a2b39ccdf90c8ee1e04e583815424
Author: Benjamin Otte <otte redhat com>
Date: Tue Jan 27 05:03:52 2015 +0100
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().
gtk/gtkcssstyleproperty.c | 23 -----------------------
gtk/gtkcssstylepropertyprivate.h | 4 ----
gtk/gtktextview.c | 7 ++++++-
gtk/gtktreeview.c | 7 ++++++-
gtk/gtkwidget.c | 7 ++++++-
5 files changed, 18 insertions(+), 30 deletions(-)
---
diff --git a/gtk/gtkcssstyleproperty.c b/gtk/gtkcssstyleproperty.c
index 55da7d1..9f6dca2 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 fbc8489..2dbe6ed 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 cdf7503..6d0777c 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 2c79b62..3a7355d 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 980e457..b7fa367 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]