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/07/23 02:36:48 UTC

svn commit: r966914 - in /myfaces/trinidad/trunk: trinidad-examples/trinidad-demo/src/main/webapp/skins/purple/purpleSkin.css trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java

Author: jwaldman
Date: Fri Jul 23 00:36:48 2010
New Revision: 966914

URL: http://svn.apache.org/viewvc?rev=966914&view=rev
Log:
TRINIDAD-1862 warn if a style selector ends in 'icon' to prevent this from happening
This is the simplest use case:
no content and no includes.
TODO - handle the case where we resolved the includes and there still is no content.

Modified:
    myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/skins/purple/purpleSkin.css
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java

Modified: myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/skins/purple/purpleSkin.css
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/skins/purple/purpleSkin.css?rev=966914&r1=966913&r2=966914&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/skins/purple/purpleSkin.css (original)
+++ myfaces/trinidad/trunk/trinidad-examples/trinidad-demo/src/main/webapp/skins/purple/purpleSkin.css Fri Jul 23 00:36:48 2010
@@ -954,6 +954,9 @@ af|tree {
 .second {-tr-rule-ref:selector(".first"); color: red}
 .third {color: red; -tr-rule-ref:selector(".first");}
 
+/* test what happens if someone screw ups and creates a style selector 
+with a name that ends in 'icon'. Should see a warning logged. */
+af|style-not-icon {color: red; background-color:Lime;}
 
 
 

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java?rev=966914&r1=966913&r2=966914&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleSheetParserUtils.java Fri Jul 23 00:36:48 2010
@@ -231,13 +231,19 @@ class SkinStyleSheetParserUtils
                                               noTrPropertyList,
                                               resolvedProperties.getTrRuleRefList(),
                                               iconNodeList);
-          // TODO
-          // Log a warning that you should not have your style
-          // selectors end in 'icon' or 'Icon:alias" because in the skinning framework this denotes
-          // icons. We really should have used an @icon {} or somehow change icons... put it in a 
-          // different file or something.
+
           if (!hasContentProperty)
           {
+            // if it doesn't have any includes AND it doesn't have properties, it shouldn't pass
+            // the _isIcon test, so log a warning. This means the developer used the wrong 
+            // selector name. It should end in 'icon-style' instead of 'icon', for example.
+            
+            if (resolvedProperties.getTrRuleRefList() == null || 
+                resolvedProperties.getTrRuleRefList().isEmpty())
+            {
+              if (_LOG.isWarning())
+                _LOG.warning("SELECTOR_SHOULD_NOT_END_IN_ICON", selectorName);
+            }
             _addStyleNode(selectorName,
                           noTrPropertyList,
                           resolvedProperties.getTrRuleRefList(),