[gtk/matthiasc/css-change-tracking-4: 4/20] cssnode: Fix a corner case in style computation



commit 6840f75a5352cf9385cb3b375de54ecd7213a3b7
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jan 17 22:00:21 2020 -0500

    cssnode: Fix a corner case in style computation
    
    When we recomputed the change flags, and the style
    did not change, we still need to replace the style
    object, since it holds the new change flags.

 gtk/gtkcssnode.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkcssnode.c b/gtk/gtkcssnode.c
index b921b8ba73..ad3b707f60 100644
--- a/gtk/gtkcssnode.c
+++ b/gtk/gtkcssnode.c
@@ -930,12 +930,17 @@ gtk_css_node_set_style (GtkCssNode  *cssnode,
     {
       g_signal_emit (cssnode, cssnode_signals[STYLE_CHANGED], 0, &change);
     }
-  else if (cssnode->style != style &&
-           (GTK_IS_CSS_ANIMATED_STYLE (cssnode->style) || GTK_IS_CSS_ANIMATED_STYLE (style)))
+  else if (GTK_IS_CSS_ANIMATED_STYLE (cssnode->style) || GTK_IS_CSS_ANIMATED_STYLE (style))
     {
       /* This is when animations are starting/stopping but they didn't change any CSS this frame */
       g_set_object (&cssnode->style, style);
     }
+  else if (gtk_css_static_style_get_change (gtk_css_style_get_static_style (cssnode->style)) !=
+           gtk_css_static_style_get_change (gtk_css_style_get_static_style (style)))
+    {
+      /* This is when we recomputed the change flags but the style didn't change */
+      g_set_object (&cssnode->style, style);
+    }
 
   gtk_css_style_change_finish (&change);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]