gtk-css-engine r143 - trunk/libccss/ccss



Author: robsta
Date: Wed Oct  1 09:05:21 2008
New Revision: 143
URL: http://svn.gnome.org/viewvc/gtk-css-engine?rev=143&view=rev

Log:
* libccss/ccss/ccss-parser.c:
* libccss/ccss/ccss-selector.c:
Make parsing more robust, discard erroneous blocks instead of bailing.



Modified:
   trunk/libccss/ccss/ccss-parser.c
   trunk/libccss/ccss/ccss-selector.c

Modified: trunk/libccss/ccss/ccss-parser.c
==============================================================================
--- trunk/libccss/ccss/ccss-parser.c	(original)
+++ trunk/libccss/ccss/ccss-parser.c	Wed Oct  1 09:05:21 2008
@@ -156,7 +156,17 @@
 
 	info = HANDLER_GET_INFO (handler);
 
-	g_assert (info && info->block == NULL);
+	if (info && info->block) {
+		char *location;
+
+		location = cr_parsing_location_to_string (&cr_sel->location, DUMP_LINE);
+		g_warning ("Looks like there may be a problem in the block before %s, possibly a missing semicolon.", location);
+		g_free (location), location = NULL;
+
+		/* Discard what's been accumulated so far. */
+		ccss_block_free (info->block);
+		info->block = NULL;
+	}
 
 	info->block = ccss_block_new ();
 }

Modified: trunk/libccss/ccss/ccss-selector.c
==============================================================================
--- trunk/libccss/ccss/ccss-selector.c	(original)
+++ trunk/libccss/ccss/ccss-selector.c	Wed Oct  1 09:05:21 2008
@@ -497,8 +497,7 @@
 		if (original->e == 0) {
 #if DEBUG
 			if (specificity_e > CCSS_SELECTOR_MAX_SPECIFICITY) {
-				//g_assert_not_reached ();
-				printf ("foo\n");
+				g_assert_not_reached ();
 			}
 #endif
 			g_assert (specificity_e <= CCSS_SELECTOR_MAX_SPECIFICITY);
@@ -913,8 +912,6 @@
 	case CCSS_PROPERTY_SPEC_SET:
 		/* use */
 		style->bg_attachment = &self->block->background.bg_attachment;
-if (CCSS_BACKGROUND_FIXED == self->block->background.bg_attachment.attachment)
-	printf ("foo\n");
 		break;
 	}
 



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