[gtk/otte/for-master: 33/39] Revert "cssmatcher: Inline node values into matcher"



commit 96ffd6a923ad26dc9e7e475dfaa4083b33c7db60
Author: Benjamin Otte <otte redhat com>
Date:   Wed Jan 22 22:49:27 2020 +0100

    Revert "cssmatcher: Inline node values into matcher"
    
    This reverts commit a75529f3c00736856fa20f19e920614be5a48fbb.
    
    It just complicates code and there are no performance numbers that would
    warrant such a commit.

 gtk/gtkcssmatcher.c        | 39 ++++-----------------------------------
 gtk/gtkcssmatcherprivate.h |  5 -----
 2 files changed, 4 insertions(+), 40 deletions(-)
---
diff --git a/gtk/gtkcssmatcher.c b/gtk/gtkcssmatcher.c
index ea082b1408..9876747153 100644
--- a/gtk/gtkcssmatcher.c
+++ b/gtk/gtkcssmatcher.c
@@ -270,47 +270,21 @@ static gboolean
 gtk_css_matcher_node_has_state (const GtkCssMatcher *matcher,
                                 GtkStateFlags        state)
 {
-  return (matcher->node.node_state & state) == state;
+  return (gtk_css_node_get_state (matcher->node.node) & state) == state;
 }
 
 static gboolean
 gtk_css_matcher_node_has_name (const GtkCssMatcher     *matcher,
                                /*interned*/ const char *name)
 {
-  return matcher->node.node_name == name;
+  return gtk_css_node_get_name (matcher->node.node) == name;
 }
 
 static gboolean
 gtk_css_matcher_node_has_class (const GtkCssMatcher *matcher,
                                 GQuark               class_name)
 {
-  const GQuark *classes = matcher->node.classes;
-
-  switch (matcher->node.n_classes)
-    {
-    case 3:
-      if (classes[2] == class_name)
-        return TRUE;
-      G_GNUC_FALLTHROUGH;
-
-    case 2:
-      if (classes[1] == class_name)
-        return TRUE;
-      G_GNUC_FALLTHROUGH;
-
-    case 1:
-      if (classes[0] == class_name)
-        return TRUE;
-      G_GNUC_FALLTHROUGH;
-
-    case 0:
-      return FALSE;
-
-    default:
-      return gtk_css_node_has_class (matcher->node.node, class_name);
-    }
-
-  return FALSE;
+  return gtk_css_node_has_class (matcher->node.node, class_name);
 }
 
 static gboolean
@@ -318,7 +292,7 @@ gtk_css_matcher_node_has_id (const GtkCssMatcher *matcher,
                              const char          *id)
 {
   /* assume all callers pass an interned string */
-  return matcher->node.node_id == id;
+  return gtk_css_node_get_id (matcher->node.node) == id;
 }
 
 static gboolean
@@ -392,9 +366,4 @@ _gtk_css_matcher_node_init (GtkCssMatcher *matcher,
 {
   matcher->node.klass = &GTK_CSS_MATCHER_NODE;
   matcher->node.node = node;
-  matcher->node.node_state = gtk_css_node_get_state (node);
-  matcher->node.node_name = gtk_css_node_get_name (node);
-  matcher->node.node_id = gtk_css_node_get_id (node);
-  matcher->node.classes = gtk_css_node_declaration_get_classes (gtk_css_node_get_declaration (node),
-                                                                &matcher->node.n_classes);
 }
diff --git a/gtk/gtkcssmatcherprivate.h b/gtk/gtkcssmatcherprivate.h
index 69b4f0e2e4..ca9d34c8fc 100644
--- a/gtk/gtkcssmatcherprivate.h
+++ b/gtk/gtkcssmatcherprivate.h
@@ -68,11 +68,6 @@ struct _GtkCssMatcherWidgetPath {
 struct _GtkCssMatcherNode {
   const GtkCssMatcherClass *klass;
   GtkCssNode               *node;
-  GtkStateFlags             node_state;
-  const char               *node_name;
-  const char               *node_id;
-  const GQuark             *classes;
-  guint                     n_classes;
 };
 
 union _GtkCssMatcher {


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