You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by jw...@apache.org on 2010/12/09 01:29:49 UTC
svn commit: r1043800 - 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: jwaldman
Date: Thu Dec 9 00:29:49 2010
New Revision: 1043800
URL: http://svn.apache.org/viewvc?rev=1043800&view=rev
Log:
TRINIDAD-1973 any '@import' rules must precede all other rules
(except @charset) This is according to the CSS spec, so I'm making the skinning framework work the same way.
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=1043800&r1=1043799&r2=1043800&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 Thu Dec 9 00:29:49 2010
@@ -77,8 +77,7 @@ public class SkinCSSDocumentHandler
// Then we create a list of SkinStyleSheetNodes.
List <SkinStyleSheetNode> skinStyleSheetNodes =
_createSkinStyleSheetNodes(_completeSelectorNodeList, _namespaceMap);
-
-
+
List<SkinStyleSheetNode> allSkinStyleSheetNodes = new ArrayList<SkinStyleSheetNode>();
// TODO Do we need to protect against concurrent access?
@@ -131,6 +130,8 @@ public class SkinCSSDocumentHandler
public void startSelector()
{
_inStyleRule = true;
+ // CSS spec says to ignore all @import rules after any other rules are processed.
+ _ignoreImports = true;
_propertyNodeList = new ArrayList<PropertyNode>();
}
@@ -204,11 +205,21 @@ public class SkinCSSDocumentHandler
public void atRule(String atRule)
{
// parse the atRule further here.
+ boolean importRule = atRule.startsWith(_AT_IMPORT);
+ boolean charsetRule = atRule.startsWith(_AT_CHARSET);
+
if (atRule != null)
{
- if (atRule.startsWith(_AT_IMPORT))
+ if (importRule)
{
- _parseImport(atRule);
+ if (_ignoreImports)
+ {
+ // according to the css spec, @imports must come before all other rules (except @charset).
+ if (_LOG.isWarning())
+ _LOG.warning("AT_IMPORT_NOT_FIRST", atRule);
+ }
+ else
+ _parseImport(atRule);
}
else if (atRule.startsWith(_AT_NAMESPACE))
{
@@ -236,6 +247,13 @@ public class SkinCSSDocumentHandler
}
// for now, ignore other atRules in a skinning css file
+ // CSS spec says you ignore all @import rules after any other rules are processed
+ // (except for @charset).
+ if(!importRule && !charsetRule)
+ {
+ _ignoreImports = true;
+ }
+
}
}
@@ -830,6 +848,7 @@ public class SkinCSSDocumentHandler
private static final String _AT_MODE = "@mode";
private static final String _AT_IMPORT = "@import";
private static final String _AT_NAMESPACE = "@namespace";
+ private static final String _AT_CHARSET = "@charset";
// below are properties that we set and reset
@@ -862,6 +881,7 @@ public class SkinCSSDocumentHandler
private Map<String, String> _namespaceMap = new HashMap<String, String>();
private ParseContext _parseContext;
private List<List <SkinStyleSheetNode>> _imports;
+ private boolean _ignoreImports = false;
// Perhaps move to ShareConstants
static private final String _SHARE_NAMESPACE =
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=1043800&r1=1043799&r2=1043800&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 Thu Dec 9 00:29:49 2010
@@ -482,6 +482,9 @@ The skin {0} specified on the requestMap
<!-- SELECTOR_SHOULD_NOT_END_IN_ICON -->
<resource key="SELECTOR_SHOULD_NOT_END_IN_ICON">The skin selector {0} is not a Skin Icon Object since it does not have a content attribute. If you created this selector, please rename it to end with "style" instead of "icon" so that the Skinning Framework will treat it as a style, not an icon.</resource>
+<!-- AT_IMPORT_NOT_FIRST -->
+<resource key="AT_IMPORT_NOT_FIRST">{0} must come before all other rules.</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>