Author: toad
Date: 2006-09-28 16:04:51 +0000 (Thu, 28 Sep 2006)
New Revision: 10543

Modified:
   trunk/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java
   trunk/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.jflex
Log:
Don't drop the space between an @import url and its media list.

Modified: trunk/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java       
2006-09-28 16:01:41 UTC (rev 10542)
+++ trunk/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.java       
2006-09-28 16:04:51 UTC (rev 10543)
@@ -1,4 +1,4 @@
-/* The following code was generated by JFlex 1.4.1 on 28/09/06 15:38 */
+/* The following code was generated by JFlex 1.4.1 on 28/09/06 16:00 */

 package freenet.clients.http.filter;
 import java.io.*;
@@ -11,7 +11,7 @@
 /**
  * This class is a scanner generated by 
  * <a href="http://www.jflex.de/";>JFlex</a> 1.4.1
- * on 28/09/06 15:38 from the specification file
+ * on 28/09/06 16:00 from the specification file
  * <tt>freenet/clients/http/filter/CSSTokenizerFilter.jflex</tt>
  */
 class CSSTokenizerFilter {
@@ -1100,7 +1100,7 @@
                        boolean justEscaping = false;
                        boolean stillEscaping = false;
                        StringBuffer hexEscape = new StringBuffer();
-                       while(x < s.length()-1) {
+                       while(x < s.length()) {
                                char c = s.charAt(x);
                                x++;
                                if(justEscaping) {
@@ -1165,8 +1165,8 @@
                                }
                        }
                        data = buffer.toString();
-                       if(s.length() > (x+1))
-                               suffix = s.substring(x+1);
+                       if(s.length() > x)
+                               suffix = s.substring(x);
                        else suffix = "";
                }

@@ -1603,12 +1603,33 @@
        w.write("/* Ignoring unmatchable URL */url()");
           }
         case 50: break;
+        case 28: 
+          { String s = yytext();
+       if(debug) log("Found @import: "+s);
+       s = s.substring("@import".length());
+       s = s.trim();
+       DecodedStringThingy dst = new DecodedStringThingy(s);
+       s = dst.data;
+       if(debug) log("URL: "+s);
+       s = processImportURL(s);
+       dst.data = s;
+       if(debug) log("Processed URL: "+s);
+       if(dst.quote == ' ') dst.quote = '\"';
+       if (!(s == null || s.equals(""))) {
+               if(debug) log("URL now: "+s);
+               s = "@import "+dst.toString();
+               if(debug) log("Writing: "+s);
+               w.write(s);
+       } else
+               if(debug) log("Dropped @import");
+          }
+        case 51: break;
         case 31: 
           { String s = yytext();
        w.write(s);
        if(debug) log("Matched important: "+s);
           }
-        case 51: break;
+        case 52: break;
         case 21: 
           { String s = yytext();
        StringBuffer sb = new StringBuffer(s.length());
@@ -1633,26 +1654,6 @@
        w.write(sb.toString());
        if(debug) log("Matched comment: "+s+" -> "+sb.toString());
           }
-        case 52: break;
-        case 28: 
-          { String s = yytext();
-       if(debug) log("Found @import: "+s);
-       s = s.substring("@import".length());
-       s = s.trim();
-       DecodedStringThingy dst = new DecodedStringThingy(s);
-       s = dst.data;
-       if(debug) log("URL: "+s);
-       s = processImportURL(s);
-       dst.data = s;
-       if(debug) log("Processed URL: "+s);
-       if (!(s == null || s.equals(""))) {
-               if(debug) log("URL now: "+s);
-               s = "@import "+dst.toString();
-               if(debug) log("Writing: "+s);
-               w.write(s);
-       } else
-               if(debug) log("Dropped @import");
-          }
         case 53: break;
         case 19: 
           { if(!deleteErrors) {

Modified: trunk/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.jflex
===================================================================
--- trunk/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.jflex      
2006-09-28 16:01:41 UTC (rev 10542)
+++ trunk/freenet/src/freenet/clients/http/filter/CSSTokenizerFilter.jflex      
2006-09-28 16:04:51 UTC (rev 10543)
@@ -91,7 +91,7 @@
                        boolean justEscaping = false;
                        boolean stillEscaping = false;
                        StringBuffer hexEscape = new StringBuffer();
-                       while(x < s.length()-1) {
+                       while(x < s.length()) {
                                char c = s.charAt(x);
                                x++;
                                if(justEscaping) {
@@ -156,8 +156,8 @@
                                }
                        }
                        data = buffer.toString();
-                       if(s.length() > (x+1))
-                               suffix = s.substring(x+1);
+                       if(s.length() > x)
+                               suffix = s.substring(x);
                        else suffix = "";
                }

@@ -272,6 +272,7 @@
        s = processImportURL(s);
        dst.data = s;
        if(debug) log("Processed URL: "+s);
+       if(dst.quote == ' ') dst.quote = '\"';
        if (!(s == null || s.equals(""))) {
                if(debug) log("URL now: "+s);
                s = "@import "+dst.toString();


Reply via email to