[gtk/matthiasc/css-change: 3/10] css: Share code between ANY and superset matcher



commit fdfb3e91770b8ab1fb81f79007b89b44be93ae6d
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Jan 15 17:35:24 2020 -0500

    css: Share code between ANY and superset matcher
    
    The superset matcher can just reuse the callbacks from
    the ANY matcher, avoiding a duplicated list of states
    that would only get out of sync too.

 gtk/gtkcssmatcher.c | 49 +++++--------------------------------------------
 1 file changed, 5 insertions(+), 44 deletions(-)
---
diff --git a/gtk/gtkcssmatcher.c b/gtk/gtkcssmatcher.c
index 5547e95fda..536adf8b6b 100644
--- a/gtk/gtkcssmatcher.c
+++ b/gtk/gtkcssmatcher.c
@@ -501,45 +501,6 @@ gtk_css_matcher_superset_get_previous (GtkCssMatcher       *matcher,
   return TRUE;
 }
 
-static GtkStateFlags
-gtk_css_matcher_superset_get_state (const GtkCssMatcher *matcher)
-{
-  return GTK_STATE_FLAG_ACTIVE | GTK_STATE_FLAG_PRELIGHT | GTK_STATE_FLAG_SELECTED
-      | GTK_STATE_FLAG_INSENSITIVE | GTK_STATE_FLAG_INCONSISTENT
-      | GTK_STATE_FLAG_FOCUSED | GTK_STATE_FLAG_BACKDROP | GTK_STATE_FLAG_LINK
-      | GTK_STATE_FLAG_VISITED;
-}
-
-static gboolean
-gtk_css_matcher_superset_has_name (const GtkCssMatcher     *matcher,
-                                   /*interned*/ const char *name)
-{
-  return TRUE;
-}
-
-static gboolean
-gtk_css_matcher_superset_has_class (const GtkCssMatcher *matcher,
-                                    GQuark               class_name)
-{
-  return TRUE;
-}
-
-static gboolean
-gtk_css_matcher_superset_has_id (const GtkCssMatcher *matcher,
-                                 const char          *id)
-{
-  return TRUE;
-}
-
-static gboolean
-gtk_css_matcher_superset_has_position (const GtkCssMatcher *matcher,
-                                       gboolean             forward,
-                                       int                  a,
-                                       int                  b)
-{
-  return TRUE;
-}
-
 static void
 gtk_css_matcher_superset_print (const GtkCssMatcher *matcher,
                                 GString             *string)
@@ -556,11 +517,11 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_SUPERSET = {
   0,
   gtk_css_matcher_superset_get_parent,
   gtk_css_matcher_superset_get_previous,
-  gtk_css_matcher_superset_get_state,
-  gtk_css_matcher_superset_has_name,
-  gtk_css_matcher_superset_has_class,
-  gtk_css_matcher_superset_has_id,
-  gtk_css_matcher_superset_has_position,
+  gtk_css_matcher_any_get_state,
+  gtk_css_matcher_any_has_name,
+  gtk_css_matcher_any_has_class,
+  gtk_css_matcher_any_has_id,
+  gtk_css_matcher_any_has_position,
   gtk_css_matcher_superset_print
 };
 


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