Make the superset matcher more exact

When the superset matcher is built from a node matcher,
we can make the parent matcher be a superset matchers for
the corresponding node, with the same relevant parts.
This is more precise than the ANY matcher that we were
returning previously.
This commit is contained in:
Matthias Clasen
2020-01-15 02:03:59 -05:00
parent e90d3173b9
commit 10ca79050f

View File

@@ -469,9 +469,17 @@ static gboolean
gtk_css_matcher_superset_get_parent (GtkCssMatcher *matcher,
const GtkCssMatcher *child)
{
_gtk_css_matcher_any_init (matcher);
gboolean ret = TRUE;
return TRUE;
if (child->klass->type == GTK_CSS_MATCHER_TYPE_NODE)
{
ret = gtk_css_matcher_node_get_parent (matcher, child);
matcher->klass = child->klass;
}
else
_gtk_css_matcher_any_init (matcher);
return ret;
}
static gboolean
@@ -571,6 +579,7 @@ _gtk_css_matcher_superset_init (GtkCssMatcher *matcher,
}
*klass = GTK_CSS_MATCHER_SUPERSET;
klass->type = subset->klass->type;
if (relevant & GTK_CSS_CHANGE_CLASS)
klass->has_class = subset->klass->has_class;