[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

hyatt at apple.com hyatt at apple.com
Thu Apr 8 00:11:42 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit d140c8586be492d2cdcea26c82b912ddda85d9bd
Author: hyatt at apple.com <hyatt at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 2 15:33:31 2009 +0000

    https://bugs.webkit.org/show_bug.cgi?id=32045, make sure escape sequences work with
    all the @-rules we support.  When escape sequences are present, the lexical scanner
    just returns a generic token name: ATKEYWORD.  We have to process the escape sequences
    and then recheck against the rules we support with the final processed name.  If we
    find a match, we mutate the token value to the appropriate rule name token, e.g.,
    NAMESPACE_SYM.
    
    Reviewed by Dan Bernstein.
    
    Added fast/css/namespaces/namespaces-escapes.xml
    
    * css/CSSParser.cpp:
    (WebCore::CSSParser::lex):
    (WebCore::CSSParser::recheckAtKeyword):
    (WebCore::CSSParser::text):
    * css/CSSParser.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51600 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/fast/css/namespaces/namespaces-escapes.xml b/LayoutTests/fast/css/namespaces/namespaces-escapes.xml
new file mode 100644
index 0000000..5373d5f
--- /dev/null
+++ b/LayoutTests/fast/css/namespaces/namespaces-escapes.xml
@@ -0,0 +1,15 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+  <link rel="author" title="Anne van Kesteren" href="http://annevankesteren.nl/"/>
+  <link rel="author" title="Opera Software ASA" href="http://opera.com/"/>
+  <link rel="help" href="http://www.w3.org/TR/css3-namespace/#syntax"/>
+  <title>CSS Namespaces Test Suite: @namespace syntax with escapes</title>
+  <style>
+   @\N\000041 mes\pac\65  x "http://www.w3.org/1999/xhtml";
+   x|p { background: lime }
+  </style>
+ </head>
+ <body>
+  <p>This sentence should have a green background.</p>
+ </body>
+</html>
diff --git a/LayoutTests/platform/mac/fast/css/namespaces/namespaces-escapes-expected.checksum b/LayoutTests/platform/mac/fast/css/namespaces/namespaces-escapes-expected.checksum
new file mode 100644
index 0000000..bf938d0
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/css/namespaces/namespaces-escapes-expected.checksum
@@ -0,0 +1 @@
+4ba94e8aae64ab0d60dba2ccc018dfd5
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/css/namespaces/namespaces-escapes-expected.png b/LayoutTests/platform/mac/fast/css/namespaces/namespaces-escapes-expected.png
new file mode 100644
index 0000000..42deb24
Binary files /dev/null and b/LayoutTests/platform/mac/fast/css/namespaces/namespaces-escapes-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/css/namespaces/namespaces-escapes-expected.txt b/LayoutTests/platform/mac/fast/css/namespaces/namespaces-escapes-expected.txt
new file mode 100644
index 0000000..9dfb876
--- /dev/null
+++ b/LayoutTests/platform/mac/fast/css/namespaces/namespaces-escapes-expected.txt
@@ -0,0 +1,8 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x50
+  RenderBlock {html} at (0,0) size 800x50
+    RenderBody {body} at (8,16) size 784x18
+      RenderBlock {p} at (0,0) size 784x18 [bgcolor=#00FF00]
+        RenderText {#text} at (0,0) size 299x18
+          text run at (0,0) width 299: "This sentence should have a green background."
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index f951780..fd2e0c4 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,22 @@
+2009-12-01  Dave Hyatt  <hyatt at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        https://bugs.webkit.org/show_bug.cgi?id=32045, make sure escape sequences work with
+        all the @-rules we support.  When escape sequences are present, the lexical scanner
+        just returns a generic token name: ATKEYWORD.  We have to process the escape sequences
+        and then recheck against the rules we support with the final processed name.  If we
+        find a match, we mutate the token value to the appropriate rule name token, e.g.,
+        NAMESPACE_SYM.
+
+        Added fast/css/namespaces/namespaces-escapes.xml
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::lex):
+        (WebCore::CSSParser::recheckAtKeyword):
+        (WebCore::CSSParser::text):
+        * css/CSSParser.h:
+
 2009-12-02  Anton Muhin  <antonm at chromium.org>
 
         Reviewed by Adam Barth.:w
diff --git a/WebCore/css/CSSParser.cpp b/WebCore/css/CSSParser.cpp
index 878d61c..8408b7d 100644
--- a/WebCore/css/CSSParser.cpp
+++ b/WebCore/css/CSSParser.cpp
@@ -4618,11 +4618,13 @@ static inline int yyerror(const char*) { return 1; }
 int CSSParser::lex(void* yylvalWithoutType)
 {
     YYSTYPE* yylval = static_cast<YYSTYPE*>(yylvalWithoutType);
-    int token = lex();
     int length;
+    
+    lex();
+
     UChar* t = text(&length);
 
-    switch (token) {
+    switch (token()) {
     case WHITESPACE:
     case SGML_CD:
     case INCLUDES:
@@ -4688,7 +4690,7 @@ int CSSParser::lex(void* yylvalWithoutType)
         break;
     }
 
-    return token;
+    return token();
 }
 
 static inline bool isCSSWhitespace(UChar c)
@@ -4696,6 +4698,28 @@ static inline bool isCSSWhitespace(UChar c)
     return c == ' ' || c == '\t' || c == '\r' || c == '\n' || c == '\f';
 }
 
+void CSSParser::recheckAtKeyword(const UChar* str, int len)
+{
+    String ruleName(str, len);
+    if (equalIgnoringCase(ruleName, "@import"))
+        yyTok = IMPORT_SYM;
+    else if (equalIgnoringCase(ruleName, "@page"))
+        yyTok = PAGE_SYM;
+    else if (equalIgnoringCase(ruleName, "@media"))
+        yyTok = MEDIA_SYM;
+    else if (equalIgnoringCase(ruleName, "@font-face"))
+        yyTok = FONT_FACE_SYM;
+    else if (equalIgnoringCase(ruleName, "@charset"))
+        yyTok = CHARSET_SYM;
+    else if (equalIgnoringCase(ruleName, "@namespace"))
+        yyTok = NAMESPACE_SYM;
+    else if (equalIgnoringCase(ruleName, "@-webkit-keyframes"))
+        yyTok = WEBKIT_KEYFRAMES_SYM;
+    else if (equalIgnoringCase(ruleName, "@-webkit-mediaquery"))
+        yyTok = WEBKIT_MEDIAQUERY_SYM;
+    // FIXME: Add CSS Variables if we ever decide to turn it back on.
+}
+
 UChar* CSSParser::text(int *length)
 {
     UChar* start = yytext;
@@ -4749,6 +4773,8 @@ UChar* CSSParser::text(int *length)
     UChar* out = start;
     UChar* escape = 0;
 
+    bool sawEscape = false;
+
     for (int i = 0; i < l; i++) {
         UChar* current = start + i;
         if (escape == current - 1) {
@@ -4793,6 +4819,7 @@ UChar* CSSParser::text(int *length)
         }
         if (!escape && *current == '\\') {
             escape = current;
+            sawEscape = true;
             continue;
         }
         *out++ = *current;
@@ -4813,6 +4840,12 @@ UChar* CSSParser::text(int *length)
     }
     
     *length = out - start;
+    
+    // If we have an unrecognized @-keyword, and if we handled any escapes at all, then
+    // we should attempt to adjust yyTok to the correct type.
+    if (yyTok == ATKEYWORD && sawEscape)
+        recheckAtKeyword(start, *length);
+
     return start;
 }
 
diff --git a/WebCore/css/CSSParser.h b/WebCore/css/CSSParser.h
index ace2fbd..e6e2868 100644
--- a/WebCore/css/CSSParser.h
+++ b/WebCore/css/CSSParser.h
@@ -225,6 +225,8 @@ namespace WebCore {
         int lex();
         
     private:
+        void recheckAtKeyword(const UChar* str, int len);
+    
         void clearProperties();
 
         void setupParser(const char* prefix, const String&, const char* suffix);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list