[gtk/matthiasc/css-change: 8/15] Make the superset matcher more exact
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/css-change: 8/15] Make the superset matcher more exact
- Date: Wed, 15 Jan 2020 22:59:33 +0000 (UTC)
commit 10ca79050f2b51001947c1514bba30fd4864a8bc
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jan 15 02:03:59 2020 -0500
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.
gtk/gtkcssmatcher.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkcssmatcher.c b/gtk/gtkcssmatcher.c
index b12105f406..86448d4618 100644
--- a/gtk/gtkcssmatcher.c
+++ b/gtk/gtkcssmatcher.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]