[gtk/otte/for-master: 35/39] Remove GtkWidgetPath



commit d0066e76d7634282bc54bb1a875e2d5548f0c130
Author: Benjamin Otte <otte redhat com>
Date:   Thu Jan 23 00:45:27 2020 +0100

    Remove GtkWidgetPath
    
    ... and all associated demos and tests.

 demos/gtk-demo/demo.gresource.xml    |    1 -
 demos/gtk-demo/foreigndrawing.c      |  984 --------------------------------
 demos/gtk-demo/meson.build           |    1 -
 docs/reference/gtk/gtk4-docs.xml     |    1 -
 docs/reference/gtk/gtk4-sections.txt |   46 --
 gtk/gtk-autocleanups.h               |    1 -
 gtk/gtk.h                            |    1 -
 gtk/gtkcssmatcher.c                  |  181 ------
 gtk/gtkcssmatcherprivate.h           |   12 -
 gtk/gtkcssnodedeclaration.c          |   25 -
 gtk/gtkcssnodedeclarationprivate.h   |    5 -
 gtk/gtkcsspathnode.c                 |  153 -----
 gtk/gtkcsspathnodeprivate.h          |   61 --
 gtk/gtkstylecontext.c                |   83 +--
 gtk/gtkstylecontext.h                |    5 -
 gtk/gtkwidget.c                      |   41 --
 gtk/gtkwidgetpath.c                  | 1023 ----------------------------------
 gtk/gtkwidgetpath.h                  |  149 -----
 gtk/gtkwidgetpathprivate.h           |   31 --
 gtk/meson.build                      |    3 -
 testsuite/gtk/firefox-stylecontext.c |   62 ---
 testsuite/gtk/meson.build            |    1 -
 testsuite/gtk/stylecontext.c         |  404 --------------
 23 files changed, 5 insertions(+), 3269 deletions(-)
---
diff --git a/demos/gtk-demo/demo.gresource.xml b/demos/gtk-demo/demo.gresource.xml
index 3a58d42011..a60a21721b 100644
--- a/demos/gtk-demo/demo.gresource.xml
+++ b/demos/gtk-demo/demo.gresource.xml
@@ -173,7 +173,6 @@
     <file>fishbowl.c</file>
     <file>fixed.c</file>
     <file>flowbox.c</file>
-    <file>foreigndrawing.c</file>
     <file>font_features.c</file>
     <file>fontplane.c</file>
     <file>fontrendering.c</file>
diff --git a/demos/gtk-demo/meson.build b/demos/gtk-demo/meson.build
index 4f5209d6d9..eee93be78e 100644
--- a/demos/gtk-demo/meson.build
+++ b/demos/gtk-demo/meson.build
@@ -28,7 +28,6 @@ demos = files([
   'fishbowl.c',
   'fixed.c',
   'fontrendering.c',
-  'foreigndrawing.c',
   'gestures.c',
   'glarea.c',
   'headerbar.c',
diff --git a/docs/reference/gtk/gtk4-docs.xml b/docs/reference/gtk/gtk4-docs.xml
index 4b2625a7b5..a85bbd80e4 100644
--- a/docs/reference/gtk/gtk4-docs.xml
+++ b/docs/reference/gtk/gtk4-docs.xml
@@ -374,7 +374,6 @@
     <xi:include href="xml/gtkstylecontext.xml" />
     <xi:include href="xml/gtkcssprovider.xml" />
     <xi:include href="xml/gtkstyleprovider.xml" />
-    <xi:include href="xml/gtkwidgetpath.xml" />
     <xi:include href="xml/gtkicontheme.xml" />
   </part>
 
diff --git a/docs/reference/gtk/gtk4-sections.txt b/docs/reference/gtk/gtk4-sections.txt
index 7e5cf04421..690a822e6d 100644
--- a/docs/reference/gtk/gtk4-sections.txt
+++ b/docs/reference/gtk/gtk4-sections.txt
@@ -4689,50 +4689,6 @@ GTK_INTERFACE_AGE
 GTK_CHECK_VERSION
 </SECTION>
 
-<SECTION>
-<FILE>gtkwidgetpath</FILE>
-<TITLE>GtkWidgetPath</TITLE>
-GtkWidgetPath
-gtk_widget_path_append_type
-gtk_widget_path_append_with_siblings
-gtk_widget_path_append_for_widget
-gtk_widget_path_copy
-gtk_widget_path_ref
-gtk_widget_path_unref
-gtk_widget_path_free
-gtk_widget_path_get_object_type
-gtk_widget_path_has_parent
-gtk_widget_path_is_type
-gtk_widget_path_iter_add_class
-gtk_widget_path_iter_clear_classes
-gtk_widget_path_iter_get_name
-gtk_widget_path_iter_get_object_name
-gtk_widget_path_iter_get_object_type
-gtk_widget_path_iter_get_siblings
-gtk_widget_path_iter_get_sibling_index
-gtk_widget_path_iter_get_state
-gtk_widget_path_iter_has_class
-gtk_widget_path_iter_has_name
-gtk_widget_path_iter_has_qclass
-gtk_widget_path_iter_has_qname
-gtk_widget_path_iter_list_classes
-gtk_widget_path_iter_remove_class
-gtk_widget_path_iter_set_name
-gtk_widget_path_iter_set_object_name
-gtk_widget_path_iter_set_object_type
-gtk_widget_path_iter_set_state
-gtk_widget_path_length
-gtk_widget_path_new
-gtk_widget_path_prepend_type
-gtk_widget_path_to_string
-
-<SUBSECTION Standard>
-GTK_TYPE_WIDGET_PATH
-
-<SUBSECTION Private>
-gtk_widget_path_get_type
-</SECTION>
-
 <SECTION>
 <FILE>gtkstyleprovider</FILE>
 <TITLE>GtkStyleProvider</TITLE>
@@ -4857,7 +4813,6 @@ gtk_style_context_add_provider
 gtk_style_context_add_provider_for_display
 gtk_style_context_get
 gtk_style_context_get_parent
-gtk_style_context_get_path
 gtk_style_context_get_property
 gtk_style_context_get_display
 gtk_style_context_get_state
@@ -4874,7 +4829,6 @@ gtk_style_context_reset_widgets
 gtk_style_context_restore
 gtk_style_context_save
 gtk_style_context_set_parent
-gtk_style_context_set_path
 gtk_style_context_add_class
 gtk_style_context_remove_class
 gtk_style_context_has_class
diff --git a/gtk/gtk-autocleanups.h b/gtk/gtk-autocleanups.h
index 91889b0bdb..7c81374af0 100644
--- a/gtk/gtk-autocleanups.h
+++ b/gtk/gtk-autocleanups.h
@@ -178,6 +178,5 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTextIter, gtk_text_iter_free)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreeIter, gtk_tree_iter_free)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreePath, gtk_tree_path_free)
 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkTreeRowReference, gtk_tree_row_reference_free)
-G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkWidgetPath, gtk_widget_path_unref)
 
 #endif
diff --git a/gtk/gtk.h b/gtk/gtk.h
index f6f2030833..8205a19622 100644
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -253,7 +253,6 @@
 #include <gtk/gtkvolumebutton.h>
 #include <gtk/gtkwidget.h>
 #include <gtk/gtkwidgetpaintable.h>
-#include <gtk/gtkwidgetpath.h>
 #include <gtk/gtkwindow.h>
 #include <gtk/gtkwindowgroup.h>
 
diff --git a/gtk/gtkcssmatcher.c b/gtk/gtkcssmatcher.c
index 9876747153..b1fb4fe404 100644
--- a/gtk/gtkcssmatcher.c
+++ b/gtk/gtkcssmatcher.c
@@ -21,7 +21,6 @@
 
 #include "gtkcssnodedeclarationprivate.h"
 #include "gtkcssnodeprivate.h"
-#include "gtkwidgetpath.h"
 
 void
 gtk_css_matcher_print (const GtkCssMatcher *matcher,
@@ -38,186 +37,6 @@ gtk_css_matcher_to_string (const GtkCssMatcher *matcher)
   return g_string_free (string, FALSE);
 }
 
-/* GTK_CSS_MATCHER_WIDGET_PATH */
-
-static gboolean
-gtk_css_matcher_widget_path_get_parent (GtkCssMatcher       *matcher,
-                                        const GtkCssMatcher *child)
-{
-  if (child->path.index == 0)
-    return FALSE;
-
-  matcher->path.klass = child->path.klass;
-  matcher->path.decl = NULL;
-  matcher->path.path = child->path.path;
-  matcher->path.index = child->path.index - 1;
-  matcher->path.sibling_index = gtk_widget_path_iter_get_sibling_index (matcher->path.path, 
matcher->path.index);
-
-  return TRUE;
-}
-
-static gboolean
-gtk_css_matcher_widget_path_get_previous (GtkCssMatcher       *matcher,
-                                          const GtkCssMatcher *next)
-{
-  if (next->path.sibling_index == 0)
-    return FALSE;
-
-  matcher->path.klass = next->path.klass;
-  matcher->path.decl = NULL;
-  matcher->path.path = next->path.path;
-  matcher->path.index = next->path.index;
-  matcher->path.sibling_index = next->path.sibling_index - 1;
-
-  return TRUE;
-}
-
-static gboolean
-gtk_css_matcher_widget_path_has_state (const GtkCssMatcher *matcher,
-                                       GtkStateFlags        state)
-{
-  GtkStateFlags path_state;
-  
-  if (matcher->path.decl)
-    path_state = gtk_css_node_declaration_get_state (matcher->path.decl);
-  else
-    {
-      const GtkWidgetPath *siblings;
-
-      siblings = gtk_widget_path_iter_get_siblings (matcher->path.path, matcher->path.index);
-      if (siblings && matcher->path.sibling_index != gtk_widget_path_iter_get_sibling_index 
(matcher->path.path, matcher->path.index))
-        path_state = gtk_widget_path_iter_get_state (siblings, matcher->path.sibling_index);
-      else
-        path_state = gtk_widget_path_iter_get_state (matcher->path.path, matcher->path.index);
-    }
-
-  return (path_state & state) == state;
-}
-
-static gboolean
-gtk_css_matcher_widget_path_has_name (const GtkCssMatcher     *matcher,
-                                      /*interned*/ const char *name)
-{
-  const GtkWidgetPath *siblings;
-
-  siblings = gtk_widget_path_iter_get_siblings (matcher->path.path, matcher->path.index);
-  if (siblings && matcher->path.sibling_index != gtk_widget_path_iter_get_sibling_index (matcher->path.path, 
matcher->path.index))
-    {
-      const char *path_name = gtk_widget_path_iter_get_object_name (siblings, matcher->path.sibling_index);
-
-      if (path_name == NULL)
-        path_name = g_type_name (gtk_widget_path_iter_get_object_type (siblings, 
matcher->path.sibling_index));
-
-      return path_name == name;
-    }
-  else
-    {
-      const char *path_name = gtk_widget_path_iter_get_object_name (matcher->path.path, matcher->path.index);
-
-      if (path_name == NULL)
-        path_name = g_type_name (gtk_widget_path_iter_get_object_type (matcher->path.path, 
matcher->path.index));
-
-      return path_name == name;
-    }
-}
-
-static gboolean
-gtk_css_matcher_widget_path_has_class (const GtkCssMatcher *matcher,
-                                       GQuark               class_name)
-{
-  const GtkWidgetPath *siblings;
-  
-  if (matcher->path.decl &&
-      gtk_css_node_declaration_has_class (matcher->path.decl, class_name))
-    return TRUE;
-
-  siblings = gtk_widget_path_iter_get_siblings (matcher->path.path, matcher->path.index);
-  if (siblings && matcher->path.sibling_index != gtk_widget_path_iter_get_sibling_index (matcher->path.path, 
matcher->path.index))
-    return gtk_widget_path_iter_has_qclass (siblings, matcher->path.sibling_index, class_name);
-  else
-    return gtk_widget_path_iter_has_qclass (matcher->path.path, matcher->path.index, class_name);
-}
-
-static gboolean
-gtk_css_matcher_widget_path_has_id (const GtkCssMatcher *matcher,
-                                    const char          *id)
-{
-  const GtkWidgetPath *siblings;
-  
-  siblings = gtk_widget_path_iter_get_siblings (matcher->path.path, matcher->path.index);
-  if (siblings && matcher->path.sibling_index != gtk_widget_path_iter_get_sibling_index (matcher->path.path, 
matcher->path.index))
-    return gtk_widget_path_iter_has_name (siblings, matcher->path.sibling_index, id);
-  else
-    return gtk_widget_path_iter_has_name (matcher->path.path, matcher->path.index, id);
-}
-
-static gboolean
-gtk_css_matcher_widget_path_has_position (const GtkCssMatcher *matcher,
-                                          gboolean             forward,
-                                          int                  a,
-                                          int                  b)
-{
-  const GtkWidgetPath *siblings;
-  int x;
-
-  siblings = gtk_widget_path_iter_get_siblings (matcher->path.path, matcher->path.index);
-  if (!siblings)
-    return FALSE;
-
-  if (forward)
-    x = matcher->path.sibling_index + 1;
-  else
-    x = gtk_widget_path_length (siblings) - matcher->path.sibling_index;
-
-  x -= b;
-
-  if (a == 0)
-    return x == 0;
-
-  if (x % a)
-    return FALSE;
-
-  return x / a >= 0;
-}
-
-static void
-gtk_css_matcher_widget_path_print (const GtkCssMatcher *matcher,
-                                   GString             *string)
-{
-  char *s = gtk_widget_path_to_string (matcher->path.path);
-  g_string_append (string, s);
-  g_free (s);
-}
-
-static const GtkCssMatcherClass GTK_CSS_MATCHER_WIDGET_PATH = {
-  GTK_CSS_MATCHER_TYPE_WIDGET_PATH,
-  gtk_css_matcher_widget_path_get_parent,
-  gtk_css_matcher_widget_path_get_previous,
-  gtk_css_matcher_widget_path_has_state,
-  gtk_css_matcher_widget_path_has_name,
-  gtk_css_matcher_widget_path_has_class,
-  gtk_css_matcher_widget_path_has_id,
-  gtk_css_matcher_widget_path_has_position,
-  gtk_css_matcher_widget_path_print
-};
-
-gboolean
-_gtk_css_matcher_init (GtkCssMatcher               *matcher,
-                       const GtkWidgetPath         *path,
-                       const GtkCssNodeDeclaration *decl)
-{
-  if (gtk_widget_path_length (path) == 0)
-    return FALSE;
-
-  matcher->path.klass = &GTK_CSS_MATCHER_WIDGET_PATH;
-  matcher->path.decl = decl;
-  matcher->path.path = path;
-  matcher->path.index = gtk_widget_path_length (path) - 1;
-  matcher->path.sibling_index = gtk_widget_path_iter_get_sibling_index (path, matcher->path.index);
-
-  return TRUE;
-}
-
 /* GTK_CSS_MATCHER_NODE */
 
 static gboolean
diff --git a/gtk/gtkcssmatcherprivate.h b/gtk/gtkcssmatcherprivate.h
index ca9d34c8fc..c5744dc469 100644
--- a/gtk/gtkcssmatcherprivate.h
+++ b/gtk/gtkcssmatcherprivate.h
@@ -57,14 +57,6 @@ struct _GtkCssMatcherClass {
                                                    GString               *string);
 };
 
-struct _GtkCssMatcherWidgetPath {
-  const GtkCssMatcherClass *klass;
-  const GtkCssNodeDeclaration *decl;
-  const GtkWidgetPath      *path;
-  guint                     index;
-  guint                     sibling_index;
-};
-
 struct _GtkCssMatcherNode {
   const GtkCssMatcherClass *klass;
   GtkCssNode               *node;
@@ -72,13 +64,9 @@ struct _GtkCssMatcherNode {
 
 union _GtkCssMatcher {
   const GtkCssMatcherClass *klass;
-  GtkCssMatcherWidgetPath   path;
   GtkCssMatcherNode         node;
 };
 
-gboolean          _gtk_css_matcher_init           (GtkCssMatcher          *matcher,
-                                                   const GtkWidgetPath    *path,
-                                                   const GtkCssNodeDeclaration *decl) 
G_GNUC_WARN_UNUSED_RESULT;
 void              _gtk_css_matcher_node_init      (GtkCssMatcher          *matcher,
                                                    GtkCssNode             *node);
 
diff --git a/gtk/gtkcssnodedeclaration.c b/gtk/gtkcssnodedeclaration.c
index 0d9a28154d..49b2820e6b 100644
--- a/gtk/gtkcssnodedeclaration.c
+++ b/gtk/gtkcssnodedeclaration.c
@@ -18,7 +18,6 @@
 #include "config.h"
 
 #include "gtkcssnodedeclarationprivate.h"
-#include "gtkwidgetpathprivate.h"
 
 #include <string.h>
 
@@ -407,30 +406,6 @@ gtk_css_node_declaration_equal (gconstpointer elem1,
   return TRUE;
 }
 
-void
-gtk_css_node_declaration_add_to_widget_path (const GtkCssNodeDeclaration *decl,
-                                             GtkWidgetPath               *path,
-                                             guint                        pos)
-{
-  GQuark *classes;
-  guint i;
-
-  /* Set name and id */
-  gtk_widget_path_iter_set_object_name (path, pos, decl->name);
-  if (decl->id)
-    gtk_widget_path_iter_set_name (path, pos, decl->id);
-
-  /* Set widget classes */
-  classes = get_classes (decl);
-  for (i = 0; i < decl->n_classes; i++)
-    {
-      gtk_widget_path_iter_add_qclass (path, pos, classes[i]);
-    }
-
-  /* Set widget state */
-  gtk_widget_path_iter_set_state (path, pos, decl->state);
-}
-
 static int
 cmpstr (gconstpointer a,
         gconstpointer b,
diff --git a/gtk/gtkcssnodedeclarationprivate.h b/gtk/gtkcssnodedeclarationprivate.h
index 79c000fcb6..de79209052 100644
--- a/gtk/gtkcssnodedeclarationprivate.h
+++ b/gtk/gtkcssnodedeclarationprivate.h
@@ -20,7 +20,6 @@
 
 #include "gtkcsstypesprivate.h"
 #include "gtkenums.h"
-#include "gtkwidgetpath.h"
 
 G_BEGIN_DECLS
 
@@ -55,10 +54,6 @@ guint                   gtk_css_node_declaration_hash                   (gconstp
 gboolean                gtk_css_node_declaration_equal                  (gconstpointer                  
elem1,
                                                                          gconstpointer                  
elem2);
 
-void                    gtk_css_node_declaration_add_to_widget_path     (const GtkCssNodeDeclaration   *decl,
-                                                                         GtkWidgetPath                 *path,
-                                                                         guint                          pos);
-
 void                    gtk_css_node_declaration_print                  (const GtkCssNodeDeclaration   *decl,
                                                                          GString                       
*string);
 
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 717dce8437..11134cf6fc 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -30,7 +30,6 @@
 #include "gtkcssnodedeclarationprivate.h"
 #include "gtkcssnodeprivate.h"
 #include "gtkcssnumbervalueprivate.h"
-#include "gtkcsspathnodeprivate.h"
 #include "gtkcsscolorvalueprivate.h"
 #include "gtkcsscolorvalueprivate.h"
 #include "gtkcssstylepropertyprivate.h"
@@ -46,7 +45,6 @@
 #include "gtkstylecascadeprivate.h"
 #include "gtkstyleproviderprivate.h"
 #include "gtktypebuiltins.h"
-#include "gtkwidgetpath.h"
 #include "gtkwidgetprivate.h"
 
 
@@ -56,7 +54,7 @@
  * @Title: GtkStyleContext
  *
  * #GtkStyleContext is an object that stores styling information affecting
- * a widget defined by #GtkWidgetPath.
+ * a widget.
  *
  * In order to construct the final style information, #GtkStyleContext
  * queries information from all attached #GtkStyleProviders. Style providers
@@ -66,9 +64,9 @@
  * combination of all providers’ information in priority order.
  *
  * For GTK+ widgets, any #GtkStyleContext returned by
- * gtk_widget_get_style_context() will already have a #GtkWidgetPath, a
- * #GdkDisplay and RTL/LTR information set. The style context will also be
- * updated automatically if any of these settings change on the widget.
+ * gtk_widget_get_style_context() will already have a #GdkDisplay and
+ * RTL/LTR information set. The style context will also be updated
+ * automatically if any of these settings change on the widget.
  *
  * If you are using the theming layer standalone, you will need to set a
  * widget path and a display yourself to the created style context through
@@ -308,9 +306,6 @@ gtk_style_context_finalize (GObject *object)
   while (priv->saved_nodes)
     gtk_style_context_pop_style_node (context);
 
-  if (GTK_IS_CSS_PATH_NODE (priv->cssnode))
-    gtk_css_path_node_unset_context (GTK_CSS_PATH_NODE (priv->cssnode));
-
   gtk_style_context_clear_parent (context);
   gtk_style_context_set_cascade (context, NULL);
 
@@ -445,7 +440,7 @@ gtk_style_context_new (void)
 
 
   /* Create default info store */
-  priv->cssnode = gtk_css_path_node_new (context);
+  priv->cssnode = gtk_css_node_new ();
   gtk_css_node_set_state (priv->cssnode, GTK_STATE_FLAG_DIR_LTR);
 
   return context;
@@ -924,74 +919,6 @@ gtk_style_context_get_scale (GtkStyleContext *context)
   return _gtk_style_cascade_get_scale (priv->cascade);
 }
 
-/**
- * gtk_style_context_set_path:
- * @context: a #GtkStyleContext
- * @path: a #GtkWidgetPath
- *
- * Sets the #GtkWidgetPath used for style matching. As a
- * consequence, the style will be regenerated to match
- * the new given path.
- *
- * If you are using a #GtkStyleContext returned from
- * gtk_widget_get_style_context(), you do not need to call
- * this yourself.
- **/
-void
-gtk_style_context_set_path (GtkStyleContext *context,
-                            GtkWidgetPath   *path)
-{
-  GtkCssNode *root;
-
-  g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
-  g_return_if_fail (path != NULL);
-
-  root = gtk_style_context_get_root (context);
-  g_return_if_fail (GTK_IS_CSS_PATH_NODE (root));
-
-  if (path && gtk_widget_path_length (path) > 0)
-    {
-      GtkWidgetPath *copy = gtk_widget_path_copy (path);
-      gtk_css_path_node_set_widget_path (GTK_CSS_PATH_NODE (root), copy);
-      gtk_css_node_set_widget_type (root,
-                                    gtk_widget_path_iter_get_object_type (copy, -1));
-      gtk_css_node_set_name (root, gtk_widget_path_iter_get_object_name (copy, -1));
-      gtk_widget_path_unref (copy);
-    }
-  else
-    {
-      gtk_css_path_node_set_widget_path (GTK_CSS_PATH_NODE (root), NULL);
-      gtk_css_node_set_widget_type (root, G_TYPE_NONE);
-      gtk_css_node_set_name (root, NULL);
-    }
-}
-
-/**
- * gtk_style_context_get_path:
- * @context: a #GtkStyleContext
- *
- * Returns the widget path used for style matching set via
- * gtk_style_context_set_path().
- *
- * If no path has been set - in particular if this style context
- * was returned from a #GtkWidget - this function returns %NULL.
- *
- * Returns: (transfer none) (nullable): A #GtkWidgetPath or %NULL
- **/
-const GtkWidgetPath *
-gtk_style_context_get_path (GtkStyleContext *context)
-{
-  GtkCssNode *root;
-
-  g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
-
-  root = gtk_style_context_get_root (context);
-  if (!GTK_IS_CSS_PATH_NODE (root))
-    return NULL;
-
-  return gtk_css_path_node_get_widget_path (GTK_CSS_PATH_NODE (root));
-}
-
 /**
  * gtk_style_context_set_parent:
  * @context: a #GtkStyleContext
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index c7c5b78c59..66544ccab6 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -988,11 +988,6 @@ void          gtk_style_context_set_scale    (GtkStyleContext *context,
 GDK_AVAILABLE_IN_ALL
 gint          gtk_style_context_get_scale    (GtkStyleContext *context);
 
-GDK_AVAILABLE_IN_ALL
-void          gtk_style_context_set_path     (GtkStyleContext *context,
-                                              GtkWidgetPath   *path);
-GDK_AVAILABLE_IN_ALL
-const GtkWidgetPath * gtk_style_context_get_path (GtkStyleContext *context);
 GDK_AVAILABLE_IN_ALL
 void          gtk_style_context_set_parent   (GtkStyleContext *context,
                                               GtkStyleContext *parent);
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index f3224d2cb6..e1a3fe1a8e 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -67,7 +67,6 @@
 #include "gtktypebuiltins.h"
 #include "gtkversion.h"
 #include "gtkwidgetpaintableprivate.h"
-#include "gtkwidgetpathprivate.h"
 #include "gtkwindowgroup.h"
 #include "gtkwindowprivate.h"
 #include "gtknativeprivate.h"
@@ -11179,46 +11178,6 @@ _gtk_widget_remove_attached_window (GtkWidget    *widget,
   priv->attached_windows = g_list_remove (priv->attached_windows, window);
 }
 
-/**
- * gtk_widget_path_append_for_widget:
- * @path: a widget path
- * @widget: the widget to append to the widget path
- *
- * Appends the data from @widget to the widget hierarchy represented
- * by @path. This function is a shortcut for adding information from
- * @widget to the given @path. This includes setting the name or
- * adding the style classes from @widget.
- *
- * Returns: the position where the data was inserted
- */
-gint
-gtk_widget_path_append_for_widget (GtkWidgetPath *path,
-                                   GtkWidget     *widget)
-{
-  GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
-  const GQuark *classes;
-  guint n_classes, i;
-  gint pos;
-
-  g_return_val_if_fail (path != NULL, 0);
-  g_return_val_if_fail (GTK_IS_WIDGET (widget), 0);
-
-  pos = gtk_widget_path_append_type (path, gtk_css_node_get_widget_type (priv->cssnode));
-  gtk_widget_path_iter_set_object_name (path, pos, gtk_css_node_get_name (priv->cssnode));
-
-  if (priv->name)
-    gtk_widget_path_iter_set_name (path, pos, priv->name);
-
-  gtk_widget_path_iter_set_state (path, pos, priv->state_flags);
-
-  classes = gtk_css_node_list_classes (priv->cssnode, &n_classes);
-
-  for (i = n_classes; i-- > 0;)
-    gtk_widget_path_iter_add_qclass (path, pos, classes[i]);
-
-  return pos;
-}
-
 /**
  * gtk_widget_class_set_css_name:
  * @widget_class: class to set the name on
diff --git a/gtk/meson.build b/gtk/meson.build
index 000bbb0dcd..0d3151296a 100644
--- a/gtk/meson.build
+++ b/gtk/meson.build
@@ -79,7 +79,6 @@ gtk_private_sources = files([
   'gtkcssnumbervalue.c',
   'gtkcsspalettevalue.c',
   'gtkcssparser.c',
-  'gtkcsspathnode.c',
   'gtkcsspositionvalue.c',
   'gtkcssrepeatvalue.c',
   'gtkcssselector.c',
@@ -398,7 +397,6 @@ gtk_public_sources = files([
   'gtkwidget.c',
   'gtkwidgetfocus.c',
   'gtkwidgetpaintable.c',
-  'gtkwidgetpath.c',
   'gtkwindow.c',
   'gtkwindowgroup.c',
 ])
@@ -631,7 +629,6 @@ gtk_public_headers = files([
   'gtkvolumebutton.h',
   'gtkwidget.h',
   'gtkwidgetpaintable.h',
-  'gtkwidgetpath.h',
   'gtkwindow.h',
   'gtkwindowgroup.h',
   'gtk-a11y.h',
diff --git a/testsuite/gtk/meson.build b/testsuite/gtk/meson.build
index 416b087c12..16eac58543 100644
--- a/testsuite/gtk/meson.build
+++ b/testsuite/gtk/meson.build
@@ -28,7 +28,6 @@ tests = [
   ['entry'],
   ['filterlistmodel'],
   ['flattenlistmodel'],
-  ['firefox-stylecontext'],
   ['floating'],
   ['focus'],
   ['gestures'],
diff --git a/testsuite/gtk/stylecontext.c b/testsuite/gtk/stylecontext.c
index 5bdfadfc56..a4d4d44435 100644
--- a/testsuite/gtk/stylecontext.c
+++ b/testsuite/gtk/stylecontext.c
@@ -64,198 +64,6 @@ test_parse_selectors (void)
    }
 }
 
-static void
-test_path (void)
-{
-  GtkWidgetPath *path;
-  GtkWidgetPath *path2;
-  gint pos;
-
-  path = gtk_widget_path_new ();
-  g_assert_cmpint (gtk_widget_path_length (path), ==, 0);
-
-  pos = gtk_widget_path_append_type (path, GTK_TYPE_WINDOW);
-  g_assert_cmpint (pos, ==, 0);
-  g_assert_cmpint (gtk_widget_path_length (path), ==, 1);
-  g_assert (gtk_widget_path_iter_get_object_type (path, 0) == GTK_TYPE_WINDOW);
-  g_assert (gtk_widget_path_is_type (path, GTK_TYPE_WIDGET));
-  g_assert (gtk_widget_path_iter_get_name (path, 0) == NULL);
-
-  pos = gtk_widget_path_append_type (path, GTK_TYPE_WIDGET);
-  g_assert_cmpint (pos, ==, 1);
-  g_assert_cmpint (gtk_widget_path_length (path), ==, 2);
-  gtk_widget_path_iter_set_object_type (path, pos, GTK_TYPE_BUTTON);
-  g_assert (gtk_widget_path_is_type (path, GTK_TYPE_BUTTON));
-  g_assert (gtk_widget_path_has_parent (path, GTK_TYPE_WIDGET));
-  g_assert (gtk_widget_path_has_parent (path, GTK_TYPE_WINDOW));
-  g_assert (!gtk_widget_path_has_parent (path, GTK_TYPE_DIALOG));
-  g_assert (gtk_widget_path_iter_get_name (path, 1) == NULL);
-
-  gtk_widget_path_iter_set_name (path, 1, "name");
-  g_assert (gtk_widget_path_iter_has_name (path, 1, "name"));
-
-  gtk_widget_path_iter_add_class (path, 1, "class1");
-  gtk_widget_path_iter_add_class (path, 1, "class2");
-  g_assert (gtk_widget_path_iter_has_class (path, 1, "class1"));
-  g_assert (gtk_widget_path_iter_has_class (path, 1, "class2"));
-  g_assert (!gtk_widget_path_iter_has_class (path, 1, "class3"));
-
-  path2 = gtk_widget_path_copy (path);
-  g_assert (gtk_widget_path_iter_has_class (path2, 1, "class1"));
-  g_assert (gtk_widget_path_iter_has_class (path2, 1, "class2"));
-  g_assert (!gtk_widget_path_iter_has_class (path2, 1, "class3"));
-  gtk_widget_path_free (path2);
-
-  gtk_widget_path_iter_remove_class (path, 1, "class2");
-  g_assert (gtk_widget_path_iter_has_class (path, 1, "class1"));
-  g_assert (!gtk_widget_path_iter_has_class (path, 1, "class2"));
-  gtk_widget_path_iter_clear_classes (path, 1);
-  g_assert (!gtk_widget_path_iter_has_class (path, 1, "class1"));
-
-
-  gtk_widget_path_free (path);
-}
-
-static void
-test_match (void)
-{
-  GtkStyleContext *context;
-  GtkWidgetPath *path;
-  GtkCssProvider *provider;
-  const gchar *data;
-  GdkRGBA color;
-  GdkRGBA expected;
-
-  provider = gtk_css_provider_new ();
-
-  gdk_rgba_parse (&expected, "#fff");
-
-  context = gtk_style_context_new ();
-
-  path = gtk_widget_path_new ();
-  gtk_widget_path_append_type (path, GTK_TYPE_WINDOW);
-  gtk_widget_path_append_type (path, GTK_TYPE_BOX);
-  gtk_widget_path_append_type (path, GTK_TYPE_BUTTON);
-  gtk_widget_path_iter_set_object_name (path, 0, "window");
-  gtk_widget_path_iter_set_name (path, 0, "mywindow");
-  gtk_widget_path_iter_set_object_name (path, 2, "button");
-  gtk_widget_path_iter_add_class (path, 2, "button");
-  gtk_widget_path_iter_set_state (path, 0, GTK_STATE_FLAG_ACTIVE);
-  gtk_style_context_set_path (context, path);
-  gtk_widget_path_free (path);
-
-  gtk_style_context_add_provider (context,
-                                  GTK_STYLE_PROVIDER (provider),
-                                  GTK_STYLE_PROVIDER_PRIORITY_USER);
-
-  data = "* { color: #fff; }";
-  gtk_css_provider_load_from_data (provider, data, -1);
-  gtk_style_context_get_color (context, &color);
-  g_assert (gdk_rgba_equal (&color, &expected));
-
-  data = "* { color: #f00; }\n"
-         "button { color: #fff; }";
-  gtk_css_provider_load_from_data (provider, data, -1);
-  gtk_style_context_get_color (context, &color);
-  g_assert (gdk_rgba_equal (&color, &expected));
-
-  data = "* { color: #f00; }\n"
-         "button { color: #fff; }\n"
-         "window > button { color: #000; }";
-  gtk_css_provider_load_from_data (provider, data, -1);
-  gtk_style_context_get_color (context, &color);
-  g_assert (gdk_rgba_equal (&color, &expected));
-
-  data = "* { color: #f00; }\n"
-         ".button { color: #fff; }";
-  gtk_css_provider_load_from_data (provider, data, -1);
-  gtk_style_context_get_color (context, &color);
-  g_assert (gdk_rgba_equal (&color, &expected));
-
-  data = "* { color: #f00; }\n"
-         "button { color: #000; }\n"
-         ".button { color: #fff; }";
-  gtk_css_provider_load_from_data (provider, data, -1);
-  gtk_style_context_get_color (context, &color);
-  g_assert (gdk_rgba_equal (&color, &expected));
-
-  data = "* { color: #f00; }\n"
-         "button { color: #000; }\n"
-         "window button { color: #fff; }";
-  gtk_css_provider_load_from_data (provider, data, -1);
-  gtk_style_context_get_color (context, &color);
-  g_assert (gdk_rgba_equal (&color, &expected));
-
-  data = "* { color: #f00; }\n"
-         ".button { color: #000; }\n"
-         "window .button { color: #fff; }";
-  gtk_css_provider_load_from_data (provider, data, -1);
-  gtk_style_context_get_color (context, &color);
-  g_assert (gdk_rgba_equal (&color, &expected));
-
-  data = "* { color: #f00; }\n"
-         "* .button { color: #000; }\n"
-         "#mywindow .button { color: #fff; }";
-  gtk_css_provider_load_from_data (provider, data, -1);
-  gtk_style_context_get_color (context, &color);
-  g_assert (gdk_rgba_equal (&color, &expected));
-
-  data = "* { color: #f00; }\n"
-         "window .button { color: #000; }\n"
-         "window#mywindow .button { color: #fff; }";
-  gtk_css_provider_load_from_data (provider, data, -1);
-  gtk_style_context_get_color (context, &color);
-  g_assert (gdk_rgba_equal (&color, &expected));
-
-  data = "* { color: #f00; }\n"
-         "window .button { color: #000; }\n"
-         "window button.button { color: #fff; }";
-  gtk_css_provider_load_from_data (provider, data, -1);
-  gtk_style_context_get_color (context, &color);
-  g_assert (gdk_rgba_equal (&color, &expected));
-
-  data = "* { color: #f00; }\n"
-         "window:backdrop .button { color: #000; }\n"
-         "window .button { color: #111; }\n"
-         "window:active .button { color: #fff; }";
-  gtk_css_provider_load_from_data (provider, data, -1);
-  gtk_style_context_get_color (context, &color);
-  g_assert (gdk_rgba_equal (&color, &expected));
-
-  g_object_unref (provider);
-  g_object_unref (context);
-}
-
-static void
-test_basic_properties (void)
-{
-  GtkStyleContext *context;
-  GtkWidgetPath *path;
-  GdkRGBA *color;
-  GdkRGBA *bg_color;
-  PangoFontDescription *font;
-
-  context = gtk_style_context_new ();
-  path = gtk_widget_path_new ();
-  gtk_style_context_set_path (context, path);
-  gtk_widget_path_free (path);
-
-  gtk_style_context_get (context,
-                         "color", &color,
-                         "background-color", &bg_color,
-                         "font", &font,
-                         NULL);
-  g_assert (color != NULL);
-  g_assert (bg_color != NULL);
-  g_assert (font != NULL);
-
-  gdk_rgba_free (color);
-  gdk_rgba_free (bg_color);
-  pango_font_description_free (font);
-
-  g_object_unref (context);
-}
-
 void
 test_widget_path_parent (void)
 {
@@ -310,200 +118,6 @@ test_style_classes (void)
   g_object_unref (context);
 }
 
-static void
-test_style_priorities_setup (PrioritiesFixture *f,
-                             gconstpointer      unused)
-{
-  f->blue_provider = gtk_css_provider_new ();
-  f->red_provider = gtk_css_provider_new ();
-  f->green_provider = gtk_css_provider_new ();
-  f->context = gtk_style_context_new ();
-  GtkWidgetPath *path = gtk_widget_path_new ();
-
-  gtk_css_provider_load_from_data (f->blue_provider, "* { color: blue; }", -1);
-  gtk_css_provider_load_from_data (f->red_provider, "* { color: red; }", -1);
-  gtk_css_provider_load_from_data (f->green_provider, "* { color: green; }", -1);
-
-  gtk_widget_path_append_type (path, GTK_TYPE_WINDOW);
-  gtk_style_context_set_path (f->context, path);
-
-  gtk_widget_path_free (path);
-}
-
-static void
-test_style_priorities_teardown (PrioritiesFixture *f,
-                                gconstpointer      unused)
-{
-  g_object_unref (f->blue_provider);
-  g_object_unref (f->red_provider);
-  g_object_unref (f->green_provider);
-  g_object_unref (f->context);
-}
-
-static void
-test_style_priorities_equal (PrioritiesFixture *f,
-                             gconstpointer      unused)
-{
-  GdkRGBA color, ref_color;
-
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (f->blue_provider),
-                                              GTK_STYLE_PROVIDER_PRIORITY_USER);
-  gtk_style_context_add_provider (f->context, GTK_STYLE_PROVIDER (f->red_provider),
-                                  GTK_STYLE_PROVIDER_PRIORITY_USER);
-
-  /* When style providers are added to the display as well as the style context
-  the one specific to the style context should take priority */
-  gdk_rgba_parse (&ref_color, "red");
-  gtk_style_context_get_color (f->context, &color);
-
-  g_assert_true (gdk_rgba_equal (&ref_color, &color));
-}
-
-static void
-test_style_priorities_display_only (PrioritiesFixture *f,
-                                    gconstpointer      unused)
-{
-  GdkRGBA color, ref_color;
-
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (f->blue_provider),
-                                              GTK_STYLE_PROVIDER_PRIORITY_USER);
-
-  gdk_rgba_parse (&ref_color, "blue");
-  gtk_style_context_get_color (f->context, &color);
-
-  g_assert_true (gdk_rgba_equal (&ref_color, &color));
-}
-
-static void
-test_style_priorities_context_only (PrioritiesFixture *f,
-                                    gconstpointer      unused)
-{
-  GdkRGBA color, ref_color;
-
-  gtk_style_context_add_provider (f->context, GTK_STYLE_PROVIDER (f->red_provider),
-                                  GTK_STYLE_PROVIDER_PRIORITY_USER);
-
-  gdk_rgba_parse (&ref_color, "red");
-  gtk_style_context_get_color (f->context, &color);
-
-  g_assert_true (gdk_rgba_equal (&ref_color, &color));
-}
-
-static void
-test_style_priorities_display_higher (PrioritiesFixture *f,
-                                      gconstpointer      unused)
-{
-  GdkRGBA color, ref_color;
-
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (f->blue_provider),
-                                              GTK_STYLE_PROVIDER_PRIORITY_USER + 1);
-  gtk_style_context_add_provider (f->context, GTK_STYLE_PROVIDER (f->red_provider),
-                                  GTK_STYLE_PROVIDER_PRIORITY_USER);
-
-  gdk_rgba_parse (&ref_color, "blue");
-  gtk_style_context_get_color (f->context, &color);
-
-  g_assert_true (gdk_rgba_equal (&ref_color, &color));
-}
-
-static void
-test_style_priorities_context_higher (PrioritiesFixture *f,
-                                      gconstpointer      unused)
-{
-  GdkRGBA color, ref_color;
-
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (f->blue_provider),
-                                              GTK_STYLE_PROVIDER_PRIORITY_USER);
-  gtk_style_context_add_provider (f->context, GTK_STYLE_PROVIDER (f->red_provider),
-                                  GTK_STYLE_PROVIDER_PRIORITY_USER + 1);
-
-  gdk_rgba_parse (&ref_color, "red");
-  gtk_style_context_get_color (f->context, &color);
-
-  g_assert_true (gdk_rgba_equal (&ref_color, &color));
-}
-
-static void
-test_style_priorities_two_display (PrioritiesFixture *f,
-                                   gconstpointer      unused)
-{
-  GdkRGBA color, ref_color;
-
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (f->blue_provider),
-                                              GTK_STYLE_PROVIDER_PRIORITY_USER);
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (f->red_provider),
-                                              GTK_STYLE_PROVIDER_PRIORITY_USER + 1);
-
-  gdk_rgba_parse (&ref_color, "red");
-  gtk_style_context_get_color (f->context, &color);
-
-  g_assert_true (gdk_rgba_equal (&ref_color, &color));
-}
-
-static void
-test_style_priorities_two_context (PrioritiesFixture *f,
-                                   gconstpointer      unused)
-{
-  GdkRGBA color, ref_color;
-
-  gtk_style_context_add_provider (f->context, GTK_STYLE_PROVIDER (f->blue_provider),
-                                  GTK_STYLE_PROVIDER_PRIORITY_USER);
-  gtk_style_context_add_provider (f->context, GTK_STYLE_PROVIDER (f->red_provider),
-                                  GTK_STYLE_PROVIDER_PRIORITY_USER + 1);
-
-  gdk_rgba_parse (&ref_color, "red");
-  gtk_style_context_get_color (f->context, &color);
-
-  g_assert_true (gdk_rgba_equal (&ref_color, &color));
-}
-
-static void
-test_style_priorities_three_display_higher (PrioritiesFixture *f,
-                                            gconstpointer      unused)
-{
-  GdkRGBA color, ref_color;
-
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (f->blue_provider),
-                                              GTK_STYLE_PROVIDER_PRIORITY_USER);
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (f->green_provider),
-                                              GTK_STYLE_PROVIDER_PRIORITY_USER + 1);
-  gtk_style_context_add_provider (f->context, GTK_STYLE_PROVIDER (f->red_provider),
-                                  GTK_STYLE_PROVIDER_PRIORITY_USER);
-
-  gdk_rgba_parse (&ref_color, "green");
-  gtk_style_context_get_color (f->context, &color);
-
-  g_assert_true (gdk_rgba_equal (&ref_color, &color));
-}
-
-static void
-test_style_priorities_three_context_higher (PrioritiesFixture *f,
-                                            gconstpointer      unused)
-{
-  GdkRGBA color, ref_color;
-
-  gtk_style_context_add_provider_for_display (gdk_display_get_default (),
-                                              GTK_STYLE_PROVIDER (f->blue_provider),
-                                              GTK_STYLE_PROVIDER_PRIORITY_USER);
-  gtk_style_context_add_provider (f->context, GTK_STYLE_PROVIDER (f->red_provider),
-                                  GTK_STYLE_PROVIDER_PRIORITY_USER);
-  gtk_style_context_add_provider (f->context, GTK_STYLE_PROVIDER (f->green_provider),
-                                  GTK_STYLE_PROVIDER_PRIORITY_USER + 1);
-
-  gdk_rgba_parse (&ref_color, "green");
-  gtk_style_context_get_color (f->context, &color);
-
-  g_assert_true (gdk_rgba_equal (&ref_color, &color));
-}
-
 int
 main (int argc, char *argv[])
 {
@@ -511,26 +125,8 @@ main (int argc, char *argv[])
   g_test_init (&argc, &argv, NULL);
 
   g_test_add_func ("/style/parse/selectors", test_parse_selectors);
-  g_test_add_func ("/style/path", test_path);
-  g_test_add_func ("/style/match", test_match);
-  g_test_add_func ("/style/basic", test_basic_properties);
   g_test_add_func ("/style/widget-path-parent", test_widget_path_parent);
   g_test_add_func ("/style/classes", test_style_classes);
 
-#define ADD_PRIORITIES_TEST(path, func) \
-  g_test_add ("/style/priorities/" path, PrioritiesFixture, NULL, test_style_priorities_setup, \
-              (func), test_style_priorities_teardown)
-
-  ADD_PRIORITIES_TEST ("equal", test_style_priorities_equal);
-  ADD_PRIORITIES_TEST ("display-only", test_style_priorities_display_only);
-  ADD_PRIORITIES_TEST ("context-only", test_style_priorities_context_only);
-  ADD_PRIORITIES_TEST ("display-higher", test_style_priorities_display_higher);
-  ADD_PRIORITIES_TEST ("context-higher", test_style_priorities_context_higher);
-  ADD_PRIORITIES_TEST ("two-display", test_style_priorities_two_display);
-  ADD_PRIORITIES_TEST ("two-context", test_style_priorities_two_context);
-  ADD_PRIORITIES_TEST ("three-display-higher", test_style_priorities_three_display_higher);
-  ADD_PRIORITIES_TEST ("three-context-higher", test_style_priorities_three_context_higher);
-
-#undef ADD_PRIORITIES_TEST
   return g_test_run ();
 }



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