[gtk+] cssnode: Clear widget path more aggressively



commit fdc620cd56e79e461aa9f8738b4043f12080274c
Author: Benjamin Otte <otte redhat com>
Date:   Tue Mar 24 04:14:28 2015 +0100

    cssnode: Clear widget path more aggressively
    
    When recomputing CSS, we need a correct widget path in the fallback mode
    where we're still using widget paths.
    So we need to invalidate it everytime it actually changes, and not just
    when emitting the style-updated signal.
    
    Fixes css-match-regions reftest.

 gtk/gtkcsswidgetnode.c |    3 +++
 gtk/gtkwidget.c        |    6 +++++-
 gtk/gtkwidgetprivate.h |    1 +
 3 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcsswidgetnode.c b/gtk/gtkcsswidgetnode.c
index 12bd143..70ae532 100644
--- a/gtk/gtkcsswidgetnode.c
+++ b/gtk/gtkcsswidgetnode.c
@@ -54,6 +54,9 @@ gtk_css_widget_node_style_changed (GtkCssNode   *cssnode,
 
   node = GTK_CSS_WIDGET_NODE (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);
 
   diff = gtk_css_style_get_difference (new_style, old_style);
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 34fa82f..1545441 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -16400,14 +16400,18 @@ gtk_widget_get_path (GtkWidget *widget)
 }
 
 void
-_gtk_widget_style_context_invalidated (GtkWidget *widget)
+gtk_widget_clear_path (GtkWidget *widget)
 {
   if (widget->priv->path)
     {
       gtk_widget_path_free (widget->priv->path);
       widget->priv->path = NULL;
     }
+}
 
+void
+_gtk_widget_style_context_invalidated (GtkWidget *widget)
+{
   if (gtk_widget_get_realized (widget))
     g_signal_emit (widget, widget_signals[STYLE_UPDATED], 0);
   else
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index c463a5b..95b7bb1 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -148,6 +148,7 @@ gboolean          _gtk_widget_captured_event               (GtkWidget *widget,
                                                             GdkEvent  *event);
 
 GtkWidgetPath *   _gtk_widget_create_path                  (GtkWidget    *widget);
+void              gtk_widget_clear_path                    (GtkWidget    *widget);
 void              _gtk_widget_invalidate_style_context     (GtkWidget    *widget,
                                                             GtkCssChange  change);
 void              _gtk_widget_style_context_invalidated    (GtkWidget    *widget);


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