[gtk+] css: Don't import CSS too early



commit 1b0231b743a28f2a4641247396d4459892dbcf17
Author: Benjamin Otte <otte redhat com>
Date:   Sun Jan 15 19:20:34 2012 +0100

    css: Don't import CSS too early
    
    First, finish parsing the import rule including the semicolon. Then try
    to actually import.
    
    test: css/parser/at-invalid-01.css

 gtk/gtkcssprovider.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkcssprovider.c b/gtk/gtkcssprovider.c
index 1aef911..462b551 100644
--- a/gtk/gtkcssprovider.c
+++ b/gtk/gtkcssprovider.c
@@ -1790,7 +1790,12 @@ parse_import (GtkCssScanner *scanner)
       return TRUE;
     }
 
-  if (gtk_css_scanner_would_recurse (scanner, file))
+  if (!_gtk_css_parser_try (scanner->parser, ";", TRUE))
+    {
+      gtk_css_provider_invalid_token (scanner->provider, scanner, "semicolon");
+      _gtk_css_parser_resync (scanner->parser, TRUE, 0);
+    }
+  else if (gtk_css_scanner_would_recurse (scanner, file))
     {
        char *path = g_file_get_path (file);
        gtk_css_provider_error (scanner->provider,
@@ -1810,12 +1815,6 @@ parse_import (GtkCssScanner *scanner)
                                       NULL);
     }
 
-  if (!_gtk_css_parser_try (scanner->parser, ";", TRUE))
-    {
-      gtk_css_provider_invalid_token (scanner->provider, scanner, "semicolon");
-      _gtk_css_parser_resync (scanner->parser, TRUE, 0);
-    }
-
   g_object_unref (file);
 
   gtk_css_scanner_pop_section (scanner, GTK_CSS_SECTION_IMPORT);



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