You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gc...@apache.org on 2013/10/09 03:22:53 UTC

svn commit: r1530476 - in /myfaces/trinidad/trunk/trinidad-impl/src/main: java/org/apache/myfaces/trinidadinternal/skin/SkinCSSDocumentHandler.java xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts

Author: gcrawford
Date: Wed Oct  9 01:22:53 2013
New Revision: 1530476

URL: http://svn.apache.org/r1530476
Log:
TRINIDAD-2399 support css client side rules in skinning framework

thanks to Anand

Modified:
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinCSSDocumentHandler.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinCSSDocumentHandler.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinCSSDocumentHandler.java?rev=1530476&r1=1530475&r2=1530476&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinCSSDocumentHandler.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinCSSDocumentHandler.java Wed Oct  9 01:22:53 2013
@@ -255,7 +255,7 @@ public class SkinCSSDocumentHandler
       {
         _parseCustomAtRule(_AT_MODE, atRule);
       }
-      else if (atRule.startsWith(_AT))
+      else if (atRule.startsWith(_AT) && !charsetRule)
       {
         // for all other rules that does not belong to server side
         // assume that they are client rules
@@ -462,16 +462,24 @@ public class SkinCSSDocumentHandler
     // save the atRule type, so the document handler code can get to it.
     // run this through parser again
     String content = _getAtRuleContent(atRule);
-    _initAtRuleTargetTypes(type, atRule);
-    
-    // use this current DocumentHandler. This way we can add to the
-    // CompleteSelectorNode list with agent information.
-    SkinCSSParser parser = new SkinCSSParser();
-    parser.parseCSSDocument(new StringReader(content), this);
-    
-    // reset
-    _resetAtRuleTargetTypes(type);
 
+    // skip incorrect rules. otherwise following valid styles in css file also will not be loaded.
+    if (content != null)
+    {
+      _initAtRuleTargetTypes(type, atRule);
+
+      // use this current DocumentHandler. This way we can add to the
+      // CompleteSelectorNode list with agent information.
+      SkinCSSParser parser = new SkinCSSParser();
+      parser.parseCSSDocument(new StringReader(content), this);
+
+      // reset
+      _resetAtRuleTargetTypes(type);
+    }
+    else
+    {
+      _LOG.warning("UNSUPPORTED_AT_RULE", atRule);
+    }
   }
 
   private void _resetAtRuleTargetTypes(

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts?rev=1530476&r1=1530475&r2=1530476&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/xrts/org/apache/myfaces/trinidadinternal/resource/LoggerBundle.xrts Wed Oct  9 01:22:53 2013
@@ -503,6 +503,9 @@ The skin {0} specified on the requestMap
 <!-- AT_IMPORT_NOT_FIRST -->
 <resource key="AT_IMPORT_NOT_FIRST">{0} must come before all other rules.</resource>
 
+<!-- UNSUPPORTED_AT_RULE -->
+<resource key="UNSUPPORTED_AT_RULE">Encountered unsupported at rule {0}. Ignoring this rule.</resource>
+
 <!-- CIRCULAR_EXTENDED_OR_NONEXIST_SKIN -->
 <resource key="CIRCULAR_EXTENDED_OR_NONEXIST_SKIN">The following skins extend each other in a circular fashion or the skin they extend does not exist:{0}</resource>