Hi Thomas -
  We considered the more comprehensive fixes (updating SAC, as well as fully
updating the entire tree to better understand CSS3) and decided that we
don't have the resources to do so at this time.  So right now, we're looking
to do the bare minimum fix that would allow people to use syntax like
"foo::-webkit-scroll" without breaking existing users.  You're right about
the new pseudo classes though - although only CSS 2 is officially supported,
using something like foo:enabled is probably working for people right now
and will probably break with this change.  Ray and I just discussed another
potential hack that should keep the : or :: without patching SAC - will send
the updated patch in a little bit.

Thanks for the catch!
- Unnur




On Tue, May 3, 2011 at 5:55 PM, Thomas Broyer <[email protected]> wrote:

> 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 List<String> 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)
>



-- 
DO NOT FORWARD

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

Reply via email to