Commit 971a2774 authored by Benjamin Otte's avatar Benjamin Otte

cssnode: Change style-changed signal

Instead of having old and new style, now have a GtkCssStyleChange opaque
object that will compute the changes you are interested in for you.

This simplifies change signal handlers quite a bit and avoids lots of
repeated computation in every signal handler.
parent 0ad259a1
......@@ -425,6 +425,7 @@ gtk_private_h_sources = \
gtkcssstaticstyleprivate.h \
gtkcssstringvalueprivate.h \
gtkcssstylefuncsprivate.h \
gtkcssstylechangeprivate.h \
gtkcssstyleprivate.h \
gtkcssstylepropertyprivate.h \
gtkcsstransformvalueprivate.h \
......@@ -673,6 +674,7 @@ gtk_base_c_sources = \
gtkcssselector.c \
gtkcssstringvalue.c \
gtkcssstyle.c \
gtkcssstylechange.c \
gtkcssshadowsvalue.c \
gtkcssshadowvalue.c \
gtkcssshorthandproperty.c \
......
......@@ -268,26 +268,14 @@ gtk_accel_label_get_property (GObject *object,
}
static void
node_style_changed_cb (GtkCssNode *node,
GtkCssStyle *old_style,
GtkCssStyle *new_style,
GtkWidget *widget)
node_style_changed_cb (GtkCssNode *node,
GtkCssStyleChange *change,
GtkWidget *widget)
{
GtkBitmask *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);
changes = _gtk_bitmask_new ();
changes = gtk_css_style_add_difference (changes, old_style, new_style);
if (_gtk_bitmask_intersects (changes, affects_size))
if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP))
gtk_widget_queue_resize (widget);
else
gtk_widget_queue_draw (widget);
_gtk_bitmask_free (changes);
}
static void
......
......@@ -209,26 +209,14 @@ G_GNUC_END_IGNORE_DEPRECATIONS
}
static void
node_style_changed_cb (GtkCssNode *node,
GtkCssStyle *old_style,
GtkCssStyle *new_style,
GtkWidget *widget)
node_style_changed_cb (GtkCssNode *node,
GtkCssStyleChange *change,
GtkWidget *widget)
{
GtkBitmask *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);
changes = _gtk_bitmask_new ();
changes = gtk_css_style_add_difference (changes, old_style, new_style);
if (_gtk_bitmask_intersects (changes, affects_size))
if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP))
gtk_widget_queue_resize (widget);
else
gtk_widget_queue_draw (widget);
_gtk_bitmask_free (changes);
}
static void
......
......@@ -525,26 +525,14 @@ gtk_check_menu_item_get_draw_as_radio (GtkCheckMenuItem *check_menu_item)
}
static void
node_style_changed_cb (GtkCssNode *node,
GtkCssStyle *old_style,
GtkCssStyle *new_style,
GtkWidget *widget)
node_style_changed_cb (GtkCssNode *node,
GtkCssStyleChange *change,
GtkWidget *widget)
{
GtkBitmask *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);
changes = _gtk_bitmask_new ();
changes = gtk_css_style_add_difference (changes, old_style, new_style);
if (_gtk_bitmask_intersects (changes, affects_size))
if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP))
gtk_widget_queue_resize (widget);
else
gtk_widget_queue_draw (widget);
_gtk_bitmask_free (changes);
}
static void
......
......@@ -106,6 +106,11 @@ enum {
NUM_PROPERTIES
};
struct _GtkCssNodeStyleChange {
GtkCssStyle *old_style;
GtkCssStyle *new_style;
};
static guint cssnode_signals[LAST_SIGNAL] = { 0 };
static GParamSpec *cssnode_properties[NUM_PROPERTIES];
......@@ -577,14 +582,11 @@ gtk_css_node_real_node_added (GtkCssNode *parent,
}
static void
gtk_css_node_real_style_changed (GtkCssNode *cssnode,
GtkCssStyle *old_style,
GtkCssStyle *new_style)
gtk_css_node_real_style_changed (GtkCssNode *cssnode,
GtkCssStyleChange *change)
{
g_object_ref (new_style);
g_object_unref (old_style);
cssnode->style = new_style;
g_object_unref (cssnode->style);
cssnode->style = g_object_ref (gtk_css_style_change_get_new_style (change));
}
static void
......@@ -638,9 +640,9 @@ gtk_css_node_class_init (GtkCssNodeClass *klass)
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GtkCssNodeClass, style_changed),
NULL, NULL,
_gtk_marshal_VOID__OBJECT_OBJECT,
G_TYPE_NONE, 2,
GTK_TYPE_CSS_STYLE, GTK_TYPE_CSS_STYLE);
_gtk_marshal_VOID__POINTER,
G_TYPE_NONE, 1,
G_TYPE_POINTER);
cssnode_properties[PROP_CLASSES] =
g_param_spec_boxed ("classes", "Classes",
......@@ -947,10 +949,17 @@ static gboolean
gtk_css_node_set_style (GtkCssNode *cssnode,
GtkCssStyle *style)
{
GtkCssStyleChange change;
if (cssnode->style == style)
return FALSE;
g_signal_emit (cssnode, cssnode_signals[STYLE_CHANGED], 0, cssnode->style, style);
gtk_css_style_change_init (&change, cssnode->style, style);
g_signal_emit (cssnode, cssnode_signals[STYLE_CHANGED], 0, &change);
gtk_css_style_change_finish (&change);
return TRUE;
}
......
......@@ -19,6 +19,7 @@
#define __GTK_CSS_NODE_PRIVATE_H__
#include "gtkcssnodedeclarationprivate.h"
#include "gtkcssstylechangeprivate.h"
#include "gtkbitmaskprivate.h"
#include "gtkcsstypesprivate.h"
......@@ -31,7 +32,7 @@ G_BEGIN_DECLS
#define GTK_IS_CSS_NODE_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE (obj, GTK_TYPE_CSS_NODE))
#define GTK_CSS_NODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_CSS_NODE, GtkCssNodeClass))
typedef struct _GtkCssNodeClass GtkCssNodeClass;
typedef struct _GtkCssNodeClass GtkCssNodeClass;
struct _GtkCssNode
{
......@@ -70,8 +71,7 @@ struct _GtkCssNodeClass
GtkCssNode *child,
GtkCssNode *previous);
void (* style_changed) (GtkCssNode *cssnode,
GtkCssStyle *old_style,
GtkCssStyle *new_style);
GtkCssStyleChange *style_change);
gboolean (* init_matcher) (GtkCssNode *cssnode,
GtkCssMatcher *matcher);
......
/* GTK - The GIMP Toolkit
* Copyright (C) 2015 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gtkcssstylechangeprivate.h"
#include "gtkcssstylepropertyprivate.h"
void
gtk_css_style_change_init (GtkCssStyleChange *change,
GtkCssStyle *old_style,
GtkCssStyle *new_style)
{
change->old_style = g_object_ref (old_style);
change->new_style = g_object_ref (new_style);
change->n_compared = 0;
change->affects = 0;
change->has_change = FALSE;
}
void
gtk_css_style_change_finish (GtkCssStyleChange *change)
{
g_object_unref (change->old_style);
g_object_unref (change->new_style);
}
GtkCssStyle *
gtk_css_style_change_get_old_style (GtkCssStyleChange *change)
{
return change->old_style;
}
GtkCssStyle *
gtk_css_style_change_get_new_style (GtkCssStyleChange *change)
{
return change->new_style;
}
static gboolean
gtk_css_style_compare_next_value (GtkCssStyleChange *change)
{
if (change->n_compared == GTK_CSS_PROPERTY_N_PROPERTIES)
return FALSE;
if (!_gtk_css_value_equal (gtk_css_style_get_value (change->old_style, change->n_compared),
gtk_css_style_get_value (change->new_style, change->n_compared)))
{
change->has_change = TRUE;
change->affects |= _gtk_css_style_property_get_affects (_gtk_css_style_property_lookup_by_id (change->n_compared));
}
change->n_compared++;
return TRUE;
}
gboolean
gtk_css_style_change_has_change (GtkCssStyleChange *change)
{
do {
if (change->has_change)
return TRUE;
} while (gtk_css_style_compare_next_value (change));
return FALSE;
}
gboolean
gtk_css_style_change_affects (GtkCssStyleChange *change,
GtkCssAffects affects)
{
do {
if (change->affects & affects)
return TRUE;
} while (gtk_css_style_compare_next_value (change));
return FALSE;
}
/* GTK - The GIMP Toolkit
* Copyright (C) 2015 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_CSS_STYLE_CHANGE_PRIVATE_H__
#define __GTK_CSS_STYLE_CHANGE_PRIVATE_H__
#include "gtkcssstyleprivate.h"
G_BEGIN_DECLS
typedef struct _GtkCssStyleChange GtkCssStyleChange;
struct _GtkCssStyleChange {
GtkCssStyle *old_style;
GtkCssStyle *new_style;
guint n_compared;
GtkCssAffects affects;
guint has_change :1;
};
void gtk_css_style_change_init (GtkCssStyleChange *change,
GtkCssStyle *old_style,
GtkCssStyle *new_style);
void gtk_css_style_change_finish (GtkCssStyleChange *change);
GtkCssStyle * gtk_css_style_change_get_old_style (GtkCssStyleChange *change);
GtkCssStyle * gtk_css_style_change_get_new_style (GtkCssStyleChange *change);
gboolean gtk_css_style_change_has_change (GtkCssStyleChange *change);
gboolean gtk_css_style_change_affects (GtkCssStyleChange *change,
GtkCssAffects affects);
G_END_DECLS
#endif /* __GTK_CSS_STYLE_CHANGE_PRIVATE_H__ */
......@@ -45,9 +45,8 @@ gtk_css_widget_node_finalize (GObject *object)
}
static void
gtk_css_widget_node_style_changed (GtkCssNode *cssnode,
GtkCssStyle *old_style,
GtkCssStyle *new_style)
gtk_css_widget_node_style_changed (GtkCssNode *cssnode,
GtkCssStyleChange *change)
{
GtkCssWidgetNode *node;
......@@ -56,9 +55,11 @@ gtk_css_widget_node_style_changed (GtkCssNode *cssnode,
if (node->widget)
gtk_widget_clear_path (node->widget);
GTK_CSS_NODE_CLASS (gtk_css_widget_node_parent_class)->style_changed (cssnode, old_style, new_style);
GTK_CSS_NODE_CLASS (gtk_css_widget_node_parent_class)->style_changed (cssnode, change);
node->accumulated_changes = gtk_css_style_add_difference (node->accumulated_changes, new_style, old_style);
node->accumulated_changes = gtk_css_style_add_difference (node->accumulated_changes,
gtk_css_style_change_get_new_style (change),
gtk_css_style_change_get_old_style (change));
}
static gboolean
......
......@@ -383,26 +383,14 @@ gtk_expander_class_init (GtkExpanderClass *klass)
}
static void
node_style_changed_cb (GtkCssNode *node,
GtkCssStyle *old_style,
GtkCssStyle *new_style,
GtkWidget *widget)
node_style_changed_cb (GtkCssNode *node,
GtkCssStyleChange *change,
GtkWidget *widget)
{
GtkBitmask *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);
changes = _gtk_bitmask_new ();
changes = gtk_css_style_add_difference (changes, old_style, new_style);
if (_gtk_bitmask_intersects (changes, affects_size))
if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP))
gtk_widget_queue_resize (widget);
else
gtk_widget_queue_draw (widget);
_gtk_bitmask_free (changes);
}
static void
......
......@@ -574,26 +574,14 @@ gtk_level_bar_size_allocate (GtkWidget *widget,
}
static void
node_style_changed_cb (GtkCssNode *node,
GtkCssStyle *old_style,
GtkCssStyle *new_style,
GtkWidget *widget)
node_style_changed_cb (GtkCssNode *node,
GtkCssStyleChange *change,
GtkWidget *widget)
{
GtkBitmask *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);
changes = _gtk_bitmask_new ();
changes = gtk_css_style_add_difference (changes, old_style, new_style);
if (_gtk_bitmask_intersects (changes, affects_size))
if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP))
gtk_widget_queue_resize (widget);
else
gtk_widget_queue_draw (widget);
_gtk_bitmask_free (changes);
}
static void
......
......@@ -1095,26 +1095,14 @@ gtk_menu_window_event (GtkWidget *window,
}
static void
node_style_changed_cb (GtkCssNode *node,
GtkCssStyle *old_style,
GtkCssStyle *new_style,
GtkWidget *widget)
node_style_changed_cb (GtkCssNode *node,
GtkCssStyleChange *change,
GtkWidget *widget)
{
GtkBitmask *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);
changes = _gtk_bitmask_new ();
changes = gtk_css_style_add_difference (changes, old_style, new_style);
if (_gtk_bitmask_intersects (changes, affects_size))
if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP))
gtk_widget_queue_resize (widget);
else
gtk_widget_queue_draw (widget);
_gtk_bitmask_free (changes);
}
static void
......
......@@ -1328,26 +1328,14 @@ gtk_menu_item_set_use_action_appearance (GtkMenuItem *menu_item,
}
static void
node_style_changed_cb (GtkCssNode *node,
GtkCssStyle *old_style,
GtkCssStyle *new_style,
GtkWidget *widget)
node_style_changed_cb (GtkCssNode *node,
GtkCssStyleChange *change,
GtkWidget *widget)
{
GtkBitmask *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);
changes = _gtk_bitmask_new ();
changes = gtk_css_style_add_difference (changes, old_style, new_style);
if (_gtk_bitmask_intersects (changes, affects_size))
if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP))
gtk_widget_queue_resize (widget);
else
gtk_widget_queue_draw (widget);
_gtk_bitmask_free (changes);
}
static void
......
......@@ -1086,26 +1086,14 @@ gtk_model_button_class_init (GtkModelButtonClass *class)
}
static void
node_style_changed_cb (GtkCssNode *node,
GtkCssStyle *old_style,
GtkCssStyle *new_style,
GtkWidget *widget)
node_style_changed_cb (GtkCssNode *node,
GtkCssStyleChange *change,
GtkWidget *widget)
{
GtkBitmask *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);
changes = _gtk_bitmask_new ();
changes = gtk_css_style_add_difference (changes, old_style, new_style);
if (_gtk_bitmask_intersects (changes, affects_size))
if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP))
gtk_widget_queue_resize (widget);
else
gtk_widget_queue_draw (widget);
_gtk_bitmask_free (changes);
}
static void
......
......@@ -1210,26 +1210,14 @@ gtk_notebook_class_init (GtkNotebookClass *class)
}
static void
node_style_changed_cb (GtkCssNode *node,
GtkCssStyle *old_style,
GtkCssStyle *new_style,
GtkWidget *widget)
node_style_changed_cb (GtkCssNode *node,
GtkCssStyleChange *change,
GtkWidget *widget)
{
GtkBitmask *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);
changes = _gtk_bitmask_new ();
changes = gtk_css_style_add_difference (changes, old_style, new_style);
if (_gtk_bitmask_intersects (changes, affects_size))
if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP))
gtk_widget_queue_resize (widget);
else
gtk_widget_queue_draw (widget);
_gtk_bitmask_free (changes);
}
static void
......
......@@ -785,26 +785,14 @@ pan_gesture_drag_end_cb (GtkGestureDrag *gesture,
}
static void
node_style_changed_cb (GtkCssNode *node,
GtkCssStyle *old_style,
GtkCssStyle *new_style,
GtkWidget *widget)
node_style_changed_cb (GtkCssNode *node,
GtkCssStyleChange *change,
GtkWidget *widget)
{
GtkBitmask *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);
changes = _gtk_bitmask_new ();
changes = gtk_css_style_add_difference (changes, old_style, new_style);
if (_gtk_bitmask_intersects (changes, affects_size))
if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP))
gtk_widget_queue_resize (widget);
else
gtk_widget_queue_draw (widget);
_gtk_bitmask_free (changes);
}
static void
......
......@@ -345,26 +345,14 @@ gtk_progress_bar_class_init (GtkProgressBarClass *class)
}
static void
node_style_changed_cb (GtkCssNode *node,
GtkCssStyle *old_style,
GtkCssStyle *new_style,
GtkWidget *widget)
node_style_changed_cb (GtkCssNode *node,
GtkCssStyleChange *change,
GtkWidget *widget)
{
GtkBitmask *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);
changes = _gtk_bitmask_new ();
changes = gtk_css_style_add_difference (changes, old_style, new_style);
if (_gtk_bitmask_intersects (changes, affects_size))
if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP))
gtk_widget_queue_resize (widget);
else
gtk_widget_queue_draw (widget);
_gtk_bitmask_free (changes);
}
static void
......
......@@ -730,26 +730,14 @@ gtk_range_get_property (GObject *object,
}
static void
node_style_changed_cb (GtkCssNode *node,
GtkCssStyle *old_style,
GtkCssStyle *new_style,
GtkWidget *widget)
node_style_changed_cb (GtkCssNode *node,
GtkCssStyleChange *change,
GtkWidget *widget)
{
GtkBitmask *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);
changes = _gtk_bitmask_new ();
changes = gtk_css_style_add_difference (changes, old_style, new_style);
if (_gtk_bitmask_intersects (changes, affects_size))
if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP))
gtk_widget_queue_resize (widget);
else
gtk_widget_queue_draw (widget);
_gtk_bitmask_free (changes);
}
static void
......
......@@ -726,26 +726,14 @@ swipe_gesture_update (GtkGesture *gesture,
}
static void
node_style_changed_cb (GtkCssNode *node,
GtkCssStyle *old_style,
GtkCssStyle *new_style,
GtkWidget *widget)
node_style_changed_cb (GtkCssNode *node,
GtkCssStyleChange *change,
GtkWidget *widget)
{
GtkBitmask *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);
changes = _gtk_bitmask_new ();
changes = gtk_css_style_add_difference (changes, old_style, new_style);
if (_gtk_bitmask_intersects (changes, affects_size))
if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP))
gtk_widget_queue_resize (widget);
else
gtk_widget_queue_draw (widget);
_gtk_bitmask_free (changes);
}
static void
......
......@@ -870,26 +870,14 @@ state_set (GtkSwitch *sw, gboolean state)
}
static void
node_style_changed_cb (GtkCssNode *node,
GtkCssStyle *old_style,
GtkCssStyle *new_style,
GtkWidget *widget)
node_style_changed_cb (GtkCssNode *node,
GtkCssStyleChange *change,
GtkWidget *widget)
{
GtkBitmask *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);
changes = _gtk_bitmask_new ();
changes = gtk_css_style_add_difference (changes, old_style, new_style);
if (_gtk_bitmask_intersects (changes, affects_size))
if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_CLIP))
gtk_widget_queue_resize (widget);
else
gtk_widget_queue_draw (widget);
_gtk_bitmask_free (changes);
}
static void
......
......@@ -9741,26 +9741,14 @@ gtk_text_view_selection_bubble_popup_set (GtkTextView *text_view)
/* Child GdkWindows */
static void
node_style_changed_cb (GtkCssNode *node,
GtkCssStyle *old_style,
GtkCssStyle *new_style,
GtkWidget *widget)
node_style_changed_cb (GtkCssNode *node,
GtkCssStyleChange *change,
GtkWidget *widget)
{
GtkBitmask *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);
changes = _gtk_bitmask_new ();