incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r432026 - /incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSGenerationUtils.java
Date Wed, 16 Aug 2006 20:36:56 GMT
Author: jwaldman
Date: Wed Aug 16 13:36:55 2006
New Revision: 432026

URL: http://svn.apache.org/viewvc?rev=432026&view=rev
Log:
fix for ADFFACES-136 skinning css generator fails to generate "af|foo::pseudo-element.StyleClass"
css style correctly

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

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSGenerationUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSGenerationUtils.java?rev=432026&r1=432025&r2=432026&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSGenerationUtils.java
(original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSGenerationUtils.java
Wed Aug 16 13:36:55 2006
@@ -834,6 +834,8 @@
    * if I see this: af|foo:p-class.StyleClass::element, return this:
    * 'af|foo:p-class.StyleClass' 'af|foo::element'
    * af|foo.StyleClass::element -> 'af|foo.StyleClass' 'af|foo::element'
+   * If I see thiss: af|foo::p-element.StyleClass, return this
+   * af|foo::p-element.StyleClass (leave alone).
    */
   private static String[]  _orderPseudoElementsAndClasses(
     String[] input,
@@ -854,29 +856,34 @@
         int indexOfDoubleColon = input[i].indexOf("::");         
         if (indexOfDoubleColon == -1)
         {
-          // no double colon
+          // no double colon (aka pseudo-element)
           output.add(input[i]);
         }
         else
         {
-          // you have a double colon.
-          int indexOfColon = input[i].indexOf(':');
-          if (indexOfColon == indexOfDoubleColon)
-            indexOfColon = -1;
+          // you have a double colon index. Now look to see if we need to 
+          // reorder. We have to reorder if the pseudo-element comes after
+          // the pseudo-class or composite style classes.
+          int indexOfFirstColon = input[i].indexOf(':');
           int indexOfDot = input[i].indexOf('.');
-          if ((indexOfColon >= indexOfDoubleColon && 
-              indexOfDot >= indexOfDoubleColon) || 
-              (indexOfColon == -1 && indexOfDot == -1))
+
+          boolean pseudoClassBeforePseudoElement = 
+            (indexOfFirstColon < indexOfDoubleColon);
+          boolean styleClassBeforePseudoElement =
+            (indexOfDot != -1 && indexOfDot < indexOfDoubleColon);
+            
+          if (!(pseudoClassBeforePseudoElement ||
+                styleClassBeforePseudoElement))
           {
-            // colon and styleClasses are after double colon
-            // OR there are no colons and styleClasses.
-            output.add(input[i]);
-          }          
+            output.add(input[i]);  
+          }
           else
           {
-            int indexOfClass = Math.min(indexOfColon, indexOfDot);
+            if (indexOfFirstColon == indexOfDoubleColon)
+              indexOfFirstColon = -1;
+            int indexOfClass = Math.min(indexOfFirstColon, indexOfDot);
             if (indexOfClass == -1)
-              indexOfClass = Math.max(indexOfColon, indexOfDot);
+              indexOfClass = Math.max(indexOfFirstColon, indexOfDot);
 
             // we have the condition where pseudo-class or styleClass is before
             // pseudo-element: af|foo:psdo-class::psdo-element



Mime
View raw message