[gtk+] widget: Add gtk_widget_get_css_node()



commit b92fe2fa851b5ef61ad3d87fac1cd24babaf216e
Author: Benjamin Otte <otte redhat com>
Date:   Mon Feb 9 22:27:44 2015 +0100

    widget: Add gtk_widget_get_css_node()
    
    and replace gtk_style_context_get_root() with it.

 gtk/gtkcontainer.c           |    2 +-
 gtk/gtkstylecontext.c        |    3 ++-
 gtk/gtkstylecontextprivate.h |    1 -
 gtk/gtkwidget.c              |   11 +++++++----
 gtk/gtkwidgetprivate.h       |    1 +
 gtk/gtkwindow.c              |    2 +-
 6 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 6dc69b8..583e4c0 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 f7d9fd9..19a057e 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 d849d14..4a39275 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 7460cd2..e13145c 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 7f121aa..88af50c 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 14d4723..0a52020 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);


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