cssnode: Fix a corner case in style computation
authorMatthias Clasen <mclasen@redhat.com>
Sat, 18 Jan 2020 03:00:21 +0000 (22:00 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 18 Jan 2020 04:47:34 +0000 (23:47 -0500)
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

index b921b8ba7335d73aca349beacf9eb7961f506d90..ad3b707f60163014be1ddddb52dd0e4c68703bd4 100644 (file)
@@ -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);