gtk-css-engine r93 - in branches/bzr: . libccd/ccd themes/Gilouche-CSS/gtk-2.0



Author: robsta
Date: Fri Sep  5 11:34:13 2008
New Revision: 93
URL: http://svn.gnome.org/viewvc/gtk-css-engine?rev=93&view=rev

Log:
Fix propagation of specificities.

Modified:
   branches/bzr/   (props changed)
   branches/bzr/libccd/ccd/ccd-selector-group.c
   branches/bzr/libccd/ccd/ccd-selector.c
   branches/bzr/themes/Gilouche-CSS/gtk-2.0/styles.css

Modified: branches/bzr/libccd/ccd/ccd-selector-group.c
==============================================================================
--- branches/bzr/libccd/ccd/ccd-selector-group.c	(original)
+++ branches/bzr/libccd/ccd/ccd-selector-group.c	Fri Sep  5 11:34:13 2008
@@ -33,6 +33,7 @@
  **/
 struct ccd_selector_group_ {
 	GTree		*sets;
+	unsigned int	 n_selectors;
 	unsigned int	 min_specificity_e;
 	GSList		*dangling_selectors;
 };
@@ -78,7 +79,7 @@
 	self = g_new0 (ccd_selector_group_t, 1);
 	self->sets = g_tree_new_full ((GCompareDataFunc) compare, NULL, NULL, 
 					(GDestroyNotify) free_set);
-
+	self->n_selectors = 0;
 	self->min_specificity_e = CCD_SELECTOR_MAX_SPECIFICITY;
 
 	return self;
@@ -153,6 +154,7 @@
 		g_tree_insert (self->sets, GSIZE_TO_POINTER (specificity), set);
 	}
 	set->selectors = g_slist_prepend (set->selectors, selector);
+	self->n_selectors++;
 }
 
 static unsigned int
@@ -232,7 +234,8 @@
 
 	info.self = self;
 	info.as_base = true;
-	info.specificity_e = calculate_min_specificity_e (self, g_tree_nnodes (group->sets));
+	info.specificity_e = calculate_min_specificity_e (self, 
+				self->n_selectors);
 
 	g_tree_foreach (group->sets, (GTraverseFunc) traverse_merge, &info);
 }
@@ -316,7 +319,7 @@
 	info.as_base = as_base;
 	if (as_base) {
 		info.specificity_e = calculate_min_specificity_e (result_group,
-					g_tree_nnodes (self->sets));
+					self->n_selectors);
 	}
 	info.ret = false;
 

Modified: branches/bzr/libccd/ccd/ccd-selector.c
==============================================================================
--- branches/bzr/libccd/ccd/ccd-selector.c	(original)
+++ branches/bzr/libccd/ccd/ccd-selector.c	Fri Sep  5 11:34:13 2008
@@ -469,6 +469,12 @@
 		}
 
 		if (original->e == 0) {
+#if DEBUG
+			if (specificity_e > CCD_SELECTOR_MAX_SPECIFICITY) {
+				//g_assert_not_reached ();
+				printf ("foo\n");
+			}
+#endif
 			g_assert (specificity_e <= CCD_SELECTOR_MAX_SPECIFICITY);
 			self->e = (unsigned) specificity_e;
 		} else {
@@ -540,7 +546,8 @@
 	self->b += selector->b;
 	self->c += selector->c;
 	self->d += selector->d;
-	self->e += selector->e;
+	/* `e' is not relevant for refinements.
+	 * self->e += selector->e; */
 }
 
 /*
@@ -556,7 +563,10 @@
 	selector->b += self->b;
 	selector->c += self->c;
 	selector->d += self->d;
-	selector->e += self->e;
+	/* TODO: invert the meaing of `e' and only apply
+	 * "MAX - e" when calculating specificity.
+	 * Will this let us propagate correctly?
+	 * selector->e += self->e; */
 
 	selector->container = self;
 

Modified: branches/bzr/themes/Gilouche-CSS/gtk-2.0/styles.css
==============================================================================
--- branches/bzr/themes/Gilouche-CSS/gtk-2.0/styles.css	(original)
+++ branches/bzr/themes/Gilouche-CSS/gtk-2.0/styles.css	Fri Sep  5 11:34:13 2008
@@ -177,4 +177,4 @@
 
 GtkEntry {
 background-color: #fff;
-}
\ No newline at end of file
+}



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