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 2007/07/17 01:05:50 UTC

svn commit: r556763 - /myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSGenerationUtils.java

Author: jwaldman
Date: Mon Jul 16 16:05:49 2007
New Revision: 556763

URL: http://svn.apache.org/viewvc?view=rev&rev=556763
Log:
TRINIDAD-81 https://issues.apache.org/jira/browse/TRINIDAD-81
Wrong converting of CSS pseudo classes
applied patch from Leonardo Uribe and tested to make sure skins' css gets generated correctly still.
Reformatted the braces to be on their own line and updated the comments a bit.

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

Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSGenerationUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSGenerationUtils.java?view=diff&rev=556763&r1=556762&r2=556763
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSGenerationUtils.java (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSGenerationUtils.java Mon Jul 16 16:05:49 2007
@@ -716,8 +716,8 @@
     return isShorter ? buffer.toString() : selector;
   }
   /**
-   * Runs a selector through a map. It returns the selector unchanged if
-   * there is no namespace in the selector.
+   * Runs a selector through a map. It returns the selector unchanged (except for converted
+   * pseudo-classes) if there is no namespace in the selector.
    * This could be a map to convert the
    * public no-html selector to an internal selector that has html-specifics
    * (e.g., 'af|menuPath::step:hover' -> 'af|menuPath A:hover')
@@ -761,8 +761,50 @@
     }
     else
     {
-      // there are no namespaces in this selector.
-      mappedSelector = _convertPseudoClassesInSelector(selector);
+      // there are no namespaces in this selector, but we still need to convert pseudo-classes.
+      /************************ TODO
+      //Separate pseudoclasses and then call it
+      int start = 0;
+      StringBuilder b = new StringBuilder();
+      for(int i = 0; i < selector.length(); i++)
+      {
+        char c = selector.charAt(i); 
+        if (c == ' ' )
+        {
+          if (start == i)
+          {
+            //group of spaces
+            start = i+1; //Skip space                       
+          } 
+          else
+          {
+            String subSelector = selector.substring(start,i);
+            subSelector = _convertPseudoClassesInSelector(subSelector);
+            start = i+1; //Skip space
+            b.append(subSelector);
+            b.append(' ');
+          }
+        }
+      } // end for loop
+      
+      // We reached the end of the selector, now convert the last bit
+      if (start == 0)
+      {
+        //there is no space in selector, but we still need to map pseudo-classes.
+        mappedSelector = _convertPseudoClassesInSelector(selector);
+      }
+      else
+      {
+        String subSelector = selector.substring(start);
+        subSelector = _convertPseudoClassesInSelector(subSelector);
+        b.append(subSelector);
+        mappedSelector = b.toString();
+      }
+       mappedSelector = _convertPseudoClassesInSelector(selector);
+
+      *****************/
+       mappedSelector = _convertPseudoClassesInSelector(selector);
+
     }
     return mappedSelector;
   }