[gtk/wip/matthiasc/css-values: 1/5] Make the superset matcher more exact
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/css-values: 1/5] Make the superset matcher more exact
- Date: Wed, 15 Jan 2020 13:09:36 +0000 (UTC)
commit d3d5a03da55369920b8bac1905ed5f14a512a074
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 or previous matchers be 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 | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkcssmatcher.c b/gtk/gtkcssmatcher.c
index b12105f406..1bb168ab1b 100644
--- a/gtk/gtkcssmatcher.c
+++ b/gtk/gtkcssmatcher.c
@@ -469,18 +469,34 @@ 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
gtk_css_matcher_superset_get_previous (GtkCssMatcher *matcher,
const GtkCssMatcher *next)
{
- _gtk_css_matcher_any_init (matcher);
+ gboolean ret = TRUE;
- return TRUE;
+ if (next->klass->type == GTK_CSS_MATCHER_TYPE_NODE)
+ {
+ ret = gtk_css_matcher_node_get_previous (matcher, next);
+ matcher->klass = next->klass;
+ }
+ else
+ _gtk_css_matcher_any_init (matcher);
+
+ return ret;
}
static GtkStateFlags
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]