[gwt-contrib] Re : Update the flute jar to accept double colon notation in css selectors, rename (issue1431801)

2011-05-03 Thread Thomas Broyer
Rietveld is down atm (giving 500 errors) so i'll comment here: 

Le mercredi 4 mai 2011 02:21:56 UTC+2, unnurg a écrit :

 Index: user/src/com/google/gwt/resources/css/GenerateCssAst.java
 ===
 --- user/src/com/google/gwt/resources/css/GenerateCssAst.java (revision  
 10132)
 +++ user/src/com/google/gwt/resources/css/GenerateCssAst.java (working 
 copy)
 @@ -92,6 +92,10 @@
   @SuppressWarnings(unused)
   public class GenerateCssAst {

 +  private static ListString validPseudoClasses = Arrays.asList(
 +link, visited, active, hover, focus, first-letter, 
 first-line,
 +first-child, before, after);
 +


There are a number of pseudo classes not covered here:
http://www.w3.org/TR/css3-selectors/#pseudo-classes
Those would all be treated as pseudo elements instead (using the :: 
notation) and could very well fail in browsers (not tested though), because 
only one pseudo-element may appear per selector 
http://www.w3.org/TR/css3-selectors/#pseudo-elements
The real fix would be to distinguish pseudo classes and pseudo-elements at 
parse time and emit them the same as what they were parsed from; but this 
probably means updating SAC.

(btw, there are a bunch CSS3 selectors I would have liked to use with 
CssResource and couldn't because the parser only understands CSS2, namely 
:nth-child(-n+4) and :not([someattribute]), so maybe Flute/SAC/whatever 
should instead be updated to allow roundtripping unknown constructs, 
rather than discarding them)
 

 /**
  * Maps SAC CSSParseExceptions into a TreeLogger. All parsing errors  
 will be
  * recorded in a single TreeLogger branch, which will be created only 
 if  
 a
 @@ -937,7 +941,11 @@
   case Condition.SAC_CLASS_CONDITION:
 return . + c.getValue();
   case Condition.SAC_PSEUDO_CLASS_CONDITION:
 -  return : + c.getValue();
 +  if (validPseudoClasses.contains(c.getValue().toLowerCase())) {
 +return : + c.getValue();
 +  } else {
 +return :: + c.getValue();
 +  }
 }

   } else if (condition instanceof CombinatorCondition) {



Beware of the turkish bug with toLowerCase/toUpperCase, you should use 
toLowerCase(Locale.ENGLISH) (see the javadoc for the rationale) 

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

[gwt-contrib] Re: Update the flute jar to accept double colon notation in css selectors, rename (issue1431801)

2011-05-03 Thread unnurg

http://gwt-code-reviews.appspot.com/1431801/

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors


[gwt-contrib] Re: Update the flute jar to accept double colon notation in css selectors, rename (issue1431801)

2011-05-03 Thread unnurg

http://gwt-code-reviews.appspot.com/1431801/

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors