Remove no longer needed code

We no longer use superset or any matchers to find changes.
This commit is contained in:
Matthias Clasen 2020-01-17 11:12:13 -05:00
parent 2a919a4d4f
commit b4a9cf2bfb
3 changed files with 1 additions and 198 deletions

View File

@ -398,173 +398,3 @@ _gtk_css_matcher_node_init (GtkCssMatcher *matcher,
matcher->node.classes = gtk_css_node_declaration_get_classes (gtk_css_node_get_declaration (node),
&matcher->node.n_classes);
}
/* GTK_CSS_MATCHER_ANY */
static gboolean
gtk_css_matcher_any_get_parent (GtkCssMatcher *matcher,
const GtkCssMatcher *child)
{
_gtk_css_matcher_any_init (matcher);
return TRUE;
}
static gboolean
gtk_css_matcher_any_get_previous (GtkCssMatcher *matcher,
const GtkCssMatcher *next)
{
_gtk_css_matcher_any_init (matcher);
return TRUE;
}
static gboolean
gtk_css_matcher_any_has_state (const GtkCssMatcher *matcher,
GtkStateFlags state)
{
return TRUE;
}
static gboolean
gtk_css_matcher_any_has_name (const GtkCssMatcher *matcher,
/*interned*/ const char *name)
{
return TRUE;
}
static gboolean
gtk_css_matcher_any_has_class (const GtkCssMatcher *matcher,
GQuark class_name)
{
return TRUE;
}
static gboolean
gtk_css_matcher_any_has_id (const GtkCssMatcher *matcher,
const char *id)
{
return TRUE;
}
static gboolean
gtk_css_matcher_any_has_position (const GtkCssMatcher *matcher,
gboolean forward,
int a,
int b)
{
return TRUE;
}
static void
gtk_css_matcher_any_print (const GtkCssMatcher *matcher,
GString *string)
{
g_string_append (string, "ANY");
}
static const GtkCssMatcherClass GTK_CSS_MATCHER_ANY = {
GTK_CSS_MATCHER_TYPE_ANY,
gtk_css_matcher_any_get_parent,
gtk_css_matcher_any_get_previous,
gtk_css_matcher_any_has_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_any_print
};
void
_gtk_css_matcher_any_init (GtkCssMatcher *matcher)
{
matcher->klass = &GTK_CSS_MATCHER_ANY;
}
/* GTK_CSS_MATCHER_SUPERSET */
static gboolean
gtk_css_matcher_superset_get_parent (GtkCssMatcher *matcher,
const GtkCssMatcher *child)
{
_gtk_css_matcher_any_init (matcher);
return TRUE;
}
static gboolean
gtk_css_matcher_superset_get_previous (GtkCssMatcher *matcher,
const GtkCssMatcher *next)
{
_gtk_css_matcher_any_init (matcher);
return TRUE;
}
static gboolean
gtk_css_matcher_superset_has_state (const GtkCssMatcher *matcher,
GtkStateFlags state)
{
return TRUE;
}
static gboolean
gtk_css_matcher_superset_has_name (const GtkCssMatcher *matcher,
/*interned*/ const char *name)
{
return _gtk_css_matcher_has_name (matcher->superset.subset, name);
}
static gboolean
gtk_css_matcher_superset_has_class (const GtkCssMatcher *matcher,
GQuark class_name)
{
return _gtk_css_matcher_has_class (matcher->superset.subset, class_name);
}
static gboolean
gtk_css_matcher_superset_has_id (const GtkCssMatcher *matcher,
const char *id)
{
return _gtk_css_matcher_has_id (matcher->superset.subset, id);
}
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)
{
g_string_append (string, "SUPERSET(");
gtk_css_matcher_print (matcher->superset.subset, string);
g_string_append (string, ")");
}
static const GtkCssMatcherClass GTK_CSS_MATCHER_SUPERSET = {
GTK_CSS_MATCHER_TYPE_SUPERSET,
gtk_css_matcher_superset_get_parent,
gtk_css_matcher_superset_get_previous,
gtk_css_matcher_superset_has_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_superset_print
};
void
_gtk_css_matcher_superset_init (GtkCssMatcher *matcher,
const GtkCssMatcher *subset)
{
g_return_if_fail (subset != NULL);
matcher->superset.klass = &GTK_CSS_MATCHER_SUPERSET;
matcher->superset.subset = subset;
}

View File

@ -31,9 +31,7 @@ typedef struct _GtkCssMatcherClass GtkCssMatcherClass;
typedef enum {
GTK_CSS_MATCHER_TYPE_NODE,
GTK_CSS_MATCHER_TYPE_WIDGET_PATH,
GTK_CSS_MATCHER_TYPE_ANY,
GTK_CSS_MATCHER_TYPE_SUPERSET
GTK_CSS_MATCHER_TYPE_WIDGET_PATH
} GtkCssMatcherType;
struct _GtkCssMatcherClass {
@ -77,16 +75,10 @@ struct _GtkCssMatcherNode {
guint n_classes;
};
struct _GtkCssMatcherSuperset {
const GtkCssMatcherClass *klass;
const GtkCssMatcher *subset;
};
union _GtkCssMatcher {
const GtkCssMatcherClass *klass;
GtkCssMatcherWidgetPath path;
GtkCssMatcherNode node;
GtkCssMatcherSuperset superset;
};
gboolean _gtk_css_matcher_init (GtkCssMatcher *matcher,
@ -94,9 +86,6 @@ gboolean _gtk_css_matcher_init (GtkCssMatcher *match
const GtkCssNodeDeclaration *decl) G_GNUC_WARN_UNUSED_RESULT;
void _gtk_css_matcher_node_init (GtkCssMatcher *matcher,
GtkCssNode *node);
void _gtk_css_matcher_any_init (GtkCssMatcher *matcher);
void _gtk_css_matcher_superset_init (GtkCssMatcher *matcher,
const GtkCssMatcher *subset);
void gtk_css_matcher_print (const GtkCssMatcher *matcher,
GString *string);
@ -154,12 +143,6 @@ _gtk_css_matcher_has_position (const GtkCssMatcher *matcher,
return matcher->klass->has_position (matcher, forward, a, b);
}
static inline gboolean
_gtk_css_matcher_matches_any (const GtkCssMatcher *matcher)
{
return matcher->klass->type == GTK_CSS_MATCHER_TYPE_ANY;
}
G_END_DECLS
#endif /* __GTK_CSS_MATCHER_PRIVATE_H__ */

View File

@ -295,11 +295,6 @@ gtk_css_selector_descendant_foreach_matcher (const GtkCssSelector *selector
if (func (selector, &ancestor, data))
return TRUE;
/* any matchers are dangerous here, as we may loop forever, but
we can terminate now as all possible matches have already been added */
if (_gtk_css_matcher_matches_any (matcher))
break;
}
return FALSE;
@ -389,11 +384,6 @@ gtk_css_selector_sibling_foreach_matcher (const GtkCssSelector *selector,
if (func (selector, matcher, data))
return TRUE;
/* any matchers are dangerous here, as we may loop forever, but
we can terminate now as all possible matches have already been added */
if (_gtk_css_matcher_matches_any (matcher))
break;
}
return FALSE;