Changeset 51600 in webkit
- Timestamp:
- Dec 2, 2009 7:33:31 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r51599 r51600 1 2009-12-01 Dave Hyatt <hyatt@apple.com> 2 3 Reviewed by Dan Bernstein. 4 5 https://bugs.webkit.org/show_bug.cgi?id=32045, make sure escape sequences work with 6 all the @-rules we support. When escape sequences are present, the lexical scanner 7 just returns a generic token name: ATKEYWORD. We have to process the escape sequences 8 and then recheck against the rules we support with the final processed name. If we 9 find a match, we mutate the token value to the appropriate rule name token, e.g., 10 NAMESPACE_SYM. 11 12 Added fast/css/namespaces/namespaces-escapes.xml 13 14 * css/CSSParser.cpp: 15 (WebCore::CSSParser::lex): 16 (WebCore::CSSParser::recheckAtKeyword): 17 (WebCore::CSSParser::text): 18 * css/CSSParser.h: 19 1 20 2009-12-02 Anton Muhin <antonm@chromium.org> 2 21 -
trunk/WebCore/css/CSSParser.cpp
r50998 r51600 4619 4619 { 4620 4620 YYSTYPE* yylval = static_cast<YYSTYPE*>(yylvalWithoutType); 4621 int token = lex();4622 4621 int length; 4622 4623 lex(); 4624 4623 4625 UChar* t = text(&length); 4624 4626 4625 switch (token ) {4627 switch (token()) { 4626 4628 case WHITESPACE: 4627 4629 case SGML_CD: … … 4689 4691 } 4690 4692 4691 return token ;4693 return token(); 4692 4694 } 4693 4695 … … 4695 4697 { 4696 4698 return c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\f'; 4699 } 4700 4701 void CSSParser::recheckAtKeyword(const UChar* str, int len) 4702 { 4703 String ruleName(str, len); 4704 if (equalIgnoringCase(ruleName, "@import")) 4705 yyTok = IMPORT_SYM; 4706 else if (equalIgnoringCase(ruleName, "@page")) 4707 yyTok = PAGE_SYM; 4708 else if (equalIgnoringCase(ruleName, "@media")) 4709 yyTok = MEDIA_SYM; 4710 else if (equalIgnoringCase(ruleName, "@font-face")) 4711 yyTok = FONT_FACE_SYM; 4712 else if (equalIgnoringCase(ruleName, "@charset")) 4713 yyTok = CHARSET_SYM; 4714 else if (equalIgnoringCase(ruleName, "@namespace")) 4715 yyTok = NAMESPACE_SYM; 4716 else if (equalIgnoringCase(ruleName, "@-webkit-keyframes")) 4717 yyTok = WEBKIT_KEYFRAMES_SYM; 4718 else if (equalIgnoringCase(ruleName, "@-webkit-mediaquery")) 4719 yyTok = WEBKIT_MEDIAQUERY_SYM; 4720 // FIXME: Add CSS Variables if we ever decide to turn it back on. 4697 4721 } 4698 4722 … … 4749 4773 UChar* out = start; 4750 4774 UChar* escape = 0; 4775 4776 bool sawEscape = false; 4751 4777 4752 4778 for (int i = 0; i < l; i++) { … … 4794 4820 if (!escape && *current == '\\') { 4795 4821 escape = current; 4822 sawEscape = true; 4796 4823 continue; 4797 4824 } … … 4814 4841 4815 4842 *length = out - start; 4843 4844 // If we have an unrecognized @-keyword, and if we handled any escapes at all, then 4845 // we should attempt to adjust yyTok to the correct type. 4846 if (yyTok == ATKEYWORD && sawEscape) 4847 recheckAtKeyword(start, *length); 4848 4816 4849 return start; 4817 4850 } -
trunk/WebCore/css/CSSParser.h
r50273 r51600 226 226 227 227 private: 228 void recheckAtKeyword(const UChar* str, int len); 229 228 230 void clearProperties(); 229 231
Note: See TracChangeset
for help on using the changeset viewer.