diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 6dc69b8c49..583e4c0e36 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -1853,7 +1853,7 @@ gtk_container_idle_sizer (GdkFrameClock *clock, current_time = g_get_monotonic_time (); container->priv->restyle_pending = FALSE; - gtk_css_node_validate (gtk_style_context_get_root (gtk_widget_get_style_context (GTK_WIDGET (container))), + gtk_css_node_validate (gtk_widget_get_css_node (GTK_WIDGET (container)), current_time, empty); diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index f7d9fd9ebb..19a057ee8f 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -181,6 +181,7 @@ static void gtk_style_context_impl_get_property (GObject *object, GValue *value, GParamSpec *pspec); +static GtkCssNode * gtk_style_context_get_root (GtkStyleContext *context); G_DEFINE_TYPE_WITH_PRIVATE (GtkStyleContext, gtk_style_context, G_TYPE_OBJECT) @@ -459,7 +460,7 @@ gtk_style_context_is_saved (GtkStyleContext *context) return context->priv->saved_nodes != NULL; } -GtkCssNode * +static GtkCssNode * gtk_style_context_get_root (GtkStyleContext *context) { GtkStyleContextPrivate *priv; diff --git a/gtk/gtkstylecontextprivate.h b/gtk/gtkstylecontextprivate.h index d849d14071..4a39275aa8 100644 --- a/gtk/gtkstylecontextprivate.h +++ b/gtk/gtkstylecontextprivate.h @@ -30,7 +30,6 @@ G_BEGIN_DECLS GtkStyleContext *gtk_style_context_new_for_node (GtkCssNode *node); -GtkCssNode * gtk_style_context_get_root (GtkStyleContext *context); void gtk_style_context_set_id (GtkStyleContext *context, const char *id); const char * gtk_style_context_get_id (GtkStyleContext *context); diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 7460cd256c..e13145ccfe 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -16413,6 +16413,12 @@ _gtk_widget_style_context_invalidated (GtkWidget *widget) } } +GtkCssNode * +gtk_widget_get_css_node (GtkWidget *widget) +{ + return widget->priv->cssnode; +} + /** * gtk_widget_get_style_context: * @widget: a #GtkWidget @@ -16466,10 +16472,7 @@ _gtk_widget_invalidate_style_context (GtkWidget *widget, priv = widget->priv; - if (priv->context == NULL) - return; - - gtk_css_node_invalidate (gtk_style_context_get_root (priv->context), change); + gtk_css_node_invalidate (priv->cssnode, change); } /** diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h index 7f121aa128..88af50c18f 100644 --- a/gtk/gtkwidgetprivate.h +++ b/gtk/gtkwidgetprivate.h @@ -32,6 +32,7 @@ G_BEGIN_DECLS +GtkCssNode * gtk_widget_get_css_node (GtkWidget *widget); void _gtk_widget_set_visible_flag (GtkWidget *widget, gboolean visible); gboolean _gtk_widget_get_in_reparent (GtkWidget *widget); diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 14d4723218..0a5202009f 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -5849,7 +5849,7 @@ 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_style_context_get_root (gtk_widget_get_style_context (widget)), + gtk_css_node_validate (gtk_widget_get_css_node (widget), g_get_monotonic_time (), empty); _gtk_bitmask_free (empty);