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:
parent
3b4040d619
commit
16f2b20f96
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user