myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arobinso...@apache.org
Subject svn commit: r1227239 - /myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSUtils.java
Date Wed, 04 Jan 2012 17:53:05 GMT
Author: arobinson74
Date: Wed Jan  4 17:53:04 2012
New Revision: 1227239

URL: http://svn.apache.org/viewvc?rev=1227239&view=rev
Log:
Applying patch for TRINIDAD-2193

Thanks to Anand Nath

Modified:
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSUtils.java

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSUtils.java?rev=1227239&r1=1227238&r2=1227239&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSUtils.java
(original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSUtils.java
Wed Jan  4 17:53:04 2012
@@ -81,11 +81,21 @@ public class CSSUtils
     else 
     {
       if (_URI_PROPERTIES.contains(propertyName))
-      { 
+      {
+        // gradients are specified by syntax: gradient (color details)
+        // We cut the string to get the gradient part
+        String specialUriValue = propertyValue;
+        int parenthesesBeginIndex = specialUriValue.indexOf(_PARENTHESES_BEGIN);
+
+        if (parenthesesBeginIndex != -1)
+        {
+          specialUriValue = propertyValue.substring(0, parenthesesBeginIndex).trim();
+        }
+
         // Make sure it's a legit value for an URL
-        if (!_SPECIAL_URI_VALUES.contains(propertyValue))
+        if (!_SPECIAL_URI_VALUES.contains(specialUriValue))
         {
-          // TODO: Add a list of property names expecting an URL here, 
+          // TODO: Add a list of property names expecting an URL here,
           // "content" maybe?
           _LOG.warning("URL_VALUE_EXPECTED_FOR_PROPERTY_IN_STYLE_SHEET", new Object[]{propertyName,
styleSheetName, propertyValue});
         }
@@ -966,7 +976,8 @@ public class CSSUtils
     return value.indexOf("url(") >= 0;
   }  
   
-  
+
+  private static final String _PARENTHESES_BEGIN = "(";
 
   // CSS values
   private static final String _NORMAL_STYLE   = "normal";
@@ -1088,8 +1099,14 @@ public class CSSUtils
   {
     _SPECIAL_URI_VALUES.add("none");
     _SPECIAL_URI_VALUES.add("inherit");
-  }  
-  
+    _SPECIAL_URI_VALUES.add("-moz-linear-gradient");
+    _SPECIAL_URI_VALUES.add("-webkit-linear-gradient");
+    _SPECIAL_URI_VALUES.add("radial-gradient");
+    _SPECIAL_URI_VALUES.add("linear-gradient");
+    _SPECIAL_URI_VALUES.add("repeating-linear-gradient");
+    _SPECIAL_URI_VALUES.add("repeating-radial-gradient");
+  }
+
   private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(CSSUtils.class);
 
 }



Mime
View raw message