[gtk/matthiasc/for-master: 7/7] Refine the selector tree printing
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master: 7/7] Refine the selector tree printing
- Date: Sat, 18 Jan 2020 19:33:55 +0000 (UTC)
commit a463dccd81a0f542afd120e7feb48457663ae507
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jan 18 14:18:47 2020 -0500
Refine the selector tree printing
Also show which tree nodes have exact matches.
gtk/gtkcssselector.c | 11 +++++++++++
1 file changed, 11 insertions(+)
---
diff --git a/gtk/gtkcssselector.c b/gtk/gtkcssselector.c
index c83f42f419..dc35d839db 100644
--- a/gtk/gtkcssselector.c
+++ b/gtk/gtkcssselector.c
@@ -1970,6 +1970,7 @@ _gtk_css_selector_tree_print (const GtkCssSelectorTree *tree, GString *str, char
{
gboolean first = TRUE;
int len, i;
+ gpointer *matches;
for (; tree != NULL; tree = gtk_css_selector_tree_get_sibling (tree), first = FALSE)
{
@@ -1993,6 +1994,16 @@ _gtk_css_selector_tree_print (const GtkCssSelectorTree *tree, GString *str, char
len = str->len;
tree->selector.class->print (&tree->selector, str);
+ matches = gtk_css_selector_tree_get_matches (tree);
+ if (matches)
+ {
+ int n;
+ for (n = 0; matches[n] != NULL; n++) ;
+ if (n == 1)
+ g_string_append (str, " (1 match)");
+ else
+ g_string_append_printf (str, " (%d matches)", n);
+ }
len = str->len - len;
if (gtk_css_selector_tree_get_previous (tree))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]