css: Add _gtk_css_matcher_matches_any()

This returns true if the matcher matches *anything*. We need
to check this later, because such matchers are dangerous in loops
that iterate over all parents/siblings since such loops would not
terminate.
This commit is contained in:
Alexander Larsson 2012-11-28 11:07:52 +01:00
parent 3b4040d619
commit 16f2b20f96
2 changed files with 10 additions and 0 deletions

View File

@ -185,6 +185,7 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_WIDGET_PATH = {
gtk_css_matcher_widget_path_has_regions,
gtk_css_matcher_widget_path_has_region,
gtk_css_matcher_widget_path_has_position,
FALSE
};
gboolean
@ -288,6 +289,7 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_ANY = {
gtk_css_matcher_any_has_regions,
gtk_css_matcher_any_has_region,
gtk_css_matcher_any_has_position,
TRUE
};
void
@ -406,6 +408,7 @@ static const GtkCssMatcherClass GTK_CSS_MATCHER_SUPERSET = {
gtk_css_matcher_superset_has_regions,
gtk_css_matcher_superset_has_region,
gtk_css_matcher_superset_has_position,
FALSE
};
void

View File

@ -50,6 +50,7 @@ struct _GtkCssMatcherClass {
gboolean forward,
int a,
int b);
gboolean is_any;
};
struct _GtkCssMatcherWidgetPath {
@ -146,6 +147,12 @@ _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->is_any;
}
G_END_DECLS