[gtk+/gtk-style-context: 167/540] GtkCssProvider: Don't jump too eagerly to the next element when comparing selectors.



commit e6b5397252da6d23001edfb35c96cc595ee32d82
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Aug 4 11:43:18 2010 +0200

    GtkCssProvider: Don't jump too eagerly to the next element when comparing selectors.

 gtk/gtkcssprovider.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 692de78..7f83d1b 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -442,7 +442,20 @@ compare_selector (GtkWidgetPath *path,
       elem = elements->data;
 
       match = compare_selector_element (path, i, elem, &elem_score);
-      i++;
+
+      /* Only move on to the next index if there is no match
+       * with the current element (whether to continue or not
+       * handled right after in the combinator check), or a
+       * GType or glob has just been matched.
+       *
+       * Region and widget names do not trigger this because
+       * the next element in the selector path could also be
+       * related to the same index.
+       */
+      if (!match ||
+          (elem->elem_type == SELECTOR_GTYPE ||
+           elem->elem_type == SELECTOR_GLOB))
+        i++;
 
       if (!match &&
           elem->elem_type != SELECTOR_TYPE_NAME &&



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]