[gtk+/wip/cssnode3: 44/88] widget: Add gtk_widget_get_css_node()



commit 4932d5549bc4c6d506814790a388f7879f4a94fe
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 948deb1..537d943 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 3dc5bf0..83bb545 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 de52b1e..a37d8bd 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -16400,6 +16400,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
@@ -16453,10 +16459,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 48c9f8c..c6adae3 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 edce8f0..a19ffbe 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -5790,7 +5790,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]