cssnode: Only pass a boolean for parent changes

Nobody cares what changed in the parent, so don't track it.
This commit is contained in:
Benjamin Otte 2015-02-14 06:40:00 +01:00
parent da25771e58
commit 75b633ae08
5 changed files with 24 additions and 31 deletions

View File

@ -1846,16 +1846,10 @@ gtk_container_idle_sizer (GdkFrameClock *clock,
*/
if (container->priv->restyle_pending)
{
GtkBitmask *empty;
empty = _gtk_bitmask_new ();
container->priv->restyle_pending = FALSE;
gtk_css_node_validate (gtk_widget_get_css_node (GTK_WIDGET (container)),
gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (GTK_WIDGET (container))),
empty);
_gtk_bitmask_free (empty);
FALSE);
}
/* we may be invoked with a container_resize_queue of NULL, because

View File

@ -241,13 +241,13 @@ gtk_css_node_real_dequeue_validate (GtkCssNode *node)
{
}
static GtkBitmask *
static gboolean
gtk_css_node_real_validate (GtkCssNode *cssnode,
gint64 timestamp,
GtkCssChange change,
const GtkBitmask *parent_changes)
gboolean parent_changed)
{
return _gtk_bitmask_new ();
return FALSE;
}
gboolean
@ -703,11 +703,11 @@ gtk_css_node_propagate_pending_changes (GtkCssNode *cssnode)
void
gtk_css_node_validate (GtkCssNode *cssnode,
gint64 timestamp,
const GtkBitmask *parent_changes)
gboolean parent_changed)
{
GtkCssChange change;
GtkCssNode *child;
GtkBitmask *changes;
gboolean changed;
/* If you run your application with
* GTK_DEBUG=no-css-cache
@ -726,7 +726,7 @@ gtk_css_node_validate (GtkCssNode *cssnode,
gtk_css_node_propagate_pending_changes (cssnode);
if (!cssnode->invalid && change == 0 && _gtk_bitmask_is_empty (parent_changes))
if (!cssnode->invalid && change == 0 && !parent_changed)
return;
gtk_css_node_set_invalid (cssnode, FALSE);
@ -734,17 +734,15 @@ gtk_css_node_validate (GtkCssNode *cssnode,
change = cssnode->pending_changes;
cssnode->pending_changes = 0;
changes = GTK_CSS_NODE_GET_CLASS (cssnode)->validate (cssnode, timestamp, change, parent_changes);
changed = GTK_CSS_NODE_GET_CLASS (cssnode)->validate (cssnode, timestamp, change, parent_changed);
for (child = gtk_css_node_get_first_child (cssnode);
child;
child = gtk_css_node_get_next_sibling (child))
{
if (child->visible)
gtk_css_node_validate (child, timestamp, changes);
gtk_css_node_validate (child, timestamp, changed);
}
_gtk_bitmask_free (changes);
}
gboolean

View File

@ -69,10 +69,10 @@ struct _GtkCssNodeClass
void (* invalidate) (GtkCssNode *node);
void (* queue_validate) (GtkCssNode *node);
void (* dequeue_validate) (GtkCssNode *node);
GtkBitmask * (* validate) (GtkCssNode *cssnode,
gboolean (* validate) (GtkCssNode *cssnode,
gint64 timestamp,
GtkCssChange change,
const GtkBitmask *parent_changes);
gboolean parent_changed);
};
GType gtk_css_node_get_type (void) G_GNUC_CONST;
@ -135,7 +135,7 @@ void gtk_css_node_invalidate (GtkCssNode *
GtkCssChange change);
void gtk_css_node_validate (GtkCssNode *cssnode,
gint64 timestamp,
const GtkBitmask *parent_changes);
gboolean parent_changed);
void gtk_css_node_set_invalid (GtkCssNode *node,
gboolean invalid);

View File

@ -88,10 +88,10 @@ static GtkCssStyle *
validate_static_style (GtkCssNode *node,
GtkCssStyle *style,
GtkCssChange change,
const GtkBitmask *parent_changes)
gboolean parent_changed)
{
if (gtk_css_static_style_needs_revalidate (GTK_CSS_STATIC_STYLE (style), change) ||
!_gtk_bitmask_is_empty (parent_changes))
parent_changed)
{
return gtk_css_node_create_style (node);
}
@ -101,20 +101,21 @@ validate_static_style (GtkCssNode *node,
}
}
static GtkBitmask *
static gboolean
gtk_css_widget_node_validate (GtkCssNode *node,
gint64 timestamp,
GtkCssChange change,
const GtkBitmask *parent_changes)
gboolean parent_changed)
{
GtkCssWidgetNode *widget_node = GTK_CSS_WIDGET_NODE (node);
GtkStyleContext *context;
GtkBitmask *changes;
GtkCssStyle *style, *static_style;
GtkCssStyle *new_style, *new_static_style;
gboolean result;
if (widget_node->widget == NULL)
return _gtk_bitmask_new ();
return FALSE;
context = gtk_widget_get_style_context (widget_node->widget);
style = gtk_css_node_get_style (node);
@ -130,7 +131,7 @@ gtk_css_widget_node_validate (GtkCssNode *node,
static_style = style;
}
new_static_style = validate_static_style (node, static_style, change, parent_changes);
new_static_style = validate_static_style (node, static_style, change, parent_changed);
if (new_static_style != static_style)
{
@ -165,7 +166,10 @@ gtk_css_widget_node_validate (GtkCssNode *node,
gtk_style_context_validate (context, changes);
return changes;
result = !_gtk_bitmask_is_empty (changes);
_gtk_bitmask_free (changes);
return result;
}
typedef GtkWidgetPath * (* GetPathForChildFunc) (GtkContainer *, GtkWidget *);

View File

@ -5834,7 +5834,6 @@ gtk_window_show (GtkWidget *widget)
GtkWindow *window = GTK_WINDOW (widget);
GtkWindowPrivate *priv = window->priv;
GtkContainer *container = GTK_CONTAINER (window);
GtkBitmask *empty;
gboolean need_resize;
gboolean is_plug;
@ -5848,11 +5847,9 @@ gtk_window_show (GtkWidget *widget)
need_resize = _gtk_widget_get_alloc_needed (widget) || !gtk_widget_get_realized (widget);
empty = _gtk_bitmask_new ();
gtk_css_node_validate (gtk_widget_get_css_node (widget),
g_get_monotonic_time (),
empty);
_gtk_bitmask_free (empty);
FALSE);
if (need_resize)
{