[gtk+/wip/gbsneto/other-locations] cssnode: Only invalidate sibling nodes if changed node is visible
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/gbsneto/other-locations] cssnode: Only invalidate sibling nodes if changed node is visible
- Date: Sat, 11 Jul 2015 14:29:14 +0000 (UTC)
commit c29e1711b9b856bc083097ea30ed0da50a48c696
Author: Benjamin Otte <otte redhat com>
Date: Fri Jul 10 21:34:06 2015 +0200
cssnode: Only invalidate sibling nodes if changed node is visible
gtk/gtkcssnode.c | 35 +++++++++++++++++++++++++----------
1 files changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkcssnode.c b/gtk/gtkcssnode.c
index 29301eb..7bae9d5 100644
--- a/gtk/gtkcssnode.c
+++ b/gtk/gtkcssnode.c
@@ -657,7 +657,7 @@ gtk_css_node_reposition (GtkCssNode *node,
if (old_parent != NULL)
{
g_signal_emit (old_parent, cssnode_signals[NODE_REMOVED], 0, node, node->previous_sibling);
- if (old_parent->first_child)
+ if (old_parent->first_child && node->visible)
gtk_css_node_invalidate (old_parent->first_child, GTK_CSS_CHANGE_NTH_LAST_CHILD);
}
@@ -694,19 +694,28 @@ gtk_css_node_reposition (GtkCssNode *node,
if (new_parent)
{
g_signal_emit (new_parent, cssnode_signals[NODE_ADDED], 0, node, previous);
- gtk_css_node_invalidate (new_parent->first_child, GTK_CSS_CHANGE_NTH_LAST_CHILD);
+ if (node->visible)
+ gtk_css_node_invalidate (new_parent->first_child, GTK_CSS_CHANGE_NTH_LAST_CHILD);
}
- if (node->next_sibling)
+ if (node->visible)
{
- if (node->previous_sibling == NULL)
- gtk_css_node_invalidate (node->next_sibling, GTK_CSS_CHANGE_FIRST_CHILD);
- else
- gtk_css_node_invalidate_style (node->next_sibling);
+ if (node->next_sibling)
+ {
+ if (node->previous_sibling == NULL)
+ gtk_css_node_invalidate (node->next_sibling, GTK_CSS_CHANGE_FIRST_CHILD);
+ else
+ gtk_css_node_invalidate_style (node->next_sibling);
+ }
+ else if (node->previous_sibling)
+ {
+ gtk_css_node_invalidate (node->previous_sibling, GTK_CSS_CHANGE_LAST_CHILD);
+ }
}
- else if (node->previous_sibling)
+ else
{
- gtk_css_node_invalidate (node->previous_sibling, GTK_CSS_CHANGE_LAST_CHILD);
+ if (node->next_sibling)
+ gtk_css_node_invalidate_style (node->next_sibling);
}
gtk_css_node_invalidate (node, GTK_CSS_CHANGE_ANY_PARENT
@@ -888,7 +897,13 @@ gtk_css_node_set_visible (GtkCssNode *cssnode,
g_object_notify_by_pspec (G_OBJECT (cssnode), cssnode_properties[PROP_VISIBLE]);
if (cssnode->next_sibling)
- gtk_css_node_invalidate (cssnode->next_sibling, GTK_CSS_CHANGE_POSITION | GTK_CSS_CHANGE_ANY_SIBLING);
+ gtk_css_node_invalidate (cssnode->next_sibling, GTK_CSS_CHANGE_ANY_SIBLING
+ | GTK_CSS_CHANGE_NTH_CHILD
+ | (cssnode->previous_sibling ? 0 :
GTK_CSS_CHANGE_FIRST_CHILD));
+
+ if (cssnode->previous_sibling)
+ gtk_css_node_invalidate (cssnode->previous_sibling, GTK_CSS_CHANGE_NTH_LAST_CHILD
+ | (cssnode->next_sibling ? 0 :
GTK_CSS_CHANGE_LAST_CHILD));
}
gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]