LayoutTests:
authorweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Feb 2007 04:26:51 +0000 (04:26 +0000)
committerweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Feb 2007 04:26:51 +0000 (04:26 +0000)
        Reviewed by Darin.

        http://bugs.webkit.org/show_bug.cgi?id=12506
        REGRESSION: Safari doesn't display hebrew text on a web page,
        displayed correctly on Tiger

        * fast/encoding/pseudo-tags-in-attributes-expected.txt: Added.
        * fast/encoding/pseudo-tags-in-attributes.html: Added.

WebCore:

        Reviewed by Darin.

        http://bugs.webkit.org/show_bug.cgi?id=12506
        REGRESSION: Safari doesn't display hebrew text on a web page,
        displayed correctly on Tiger

        * loader/TextResourceDecoder.cpp:
        (WebCore::TextResourceDecoder::checkForHeadCharset): Skip over
        quoted attributes.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@19324 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/encoding/pseudo-tags-in-attributes-expected.txt [new file with mode: 0644]
LayoutTests/fast/encoding/pseudo-tags-in-attributes.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/loader/TextResourceDecoder.cpp

index d9c34fe..fdb6799 100644 (file)
@@ -1,3 +1,14 @@
+2007-01-31  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Darin.
+
+        http://bugs.webkit.org/show_bug.cgi?id=12506
+        REGRESSION: Safari doesn't display hebrew text on a web page,
+        displayed correctly on Tiger
+
+        * fast/encoding/pseudo-tags-in-attributes-expected.txt: Added.
+        * fast/encoding/pseudo-tags-in-attributes.html: Added.
+
 2007-01-31  Anders Carlsson  <acarlsson@apple.com>
 
         Reviewed by Maciej.
diff --git a/LayoutTests/fast/encoding/pseudo-tags-in-attributes-expected.txt b/LayoutTests/fast/encoding/pseudo-tags-in-attributes-expected.txt
new file mode 100644 (file)
index 0000000..c1ee8f4
--- /dev/null
@@ -0,0 +1,7 @@
+Test for bug 12506: REGRESSION: Safari doesn't display hebrew text on a web page, displayed correctly on Tiger.
+
+SUССЕSS
+
+Charset: UTF-8
+
+
diff --git a/LayoutTests/fast/encoding/pseudo-tags-in-attributes.html b/LayoutTests/fast/encoding/pseudo-tags-in-attributes.html
new file mode 100644 (file)
index 0000000..2e6e015
--- /dev/null
@@ -0,0 +1,20 @@
+<HTML>
+  <HEAD>
+    <TITLE></TITLE>
+    <LINK rel="stylesheet" type="<foobar><>" href="">
+    <meta name="keywords" content="<body>, <foobar>, <>">
+    <META HTTP-EQUIV="Content-Type" CONTENT="text/html" charset="utf-8">
+
+  </HEAD>
+  <BODY>
+  <P>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=12506">bug 12506</a>:
+  REGRESSION: Safari doesn't display hebrew text on a web page, displayed correctly on Tiger.</P>
+  <P>SUССЕSS</P>
+  
+  <SCRIPT>
+  document.write("<p>Charset: " + document.inputEncoding + "</p>");
+  if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+  </SCRIPT>
+  </BODY>
+</HTML>
index 7c76fb6..643f62a 100644 (file)
@@ -1,3 +1,15 @@
+2007-01-31  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Darin.
+
+        http://bugs.webkit.org/show_bug.cgi?id=12506
+        REGRESSION: Safari doesn't display hebrew text on a web page,
+        displayed correctly on Tiger
+
+        * loader/TextResourceDecoder.cpp:
+        (WebCore::TextResourceDecoder::checkForHeadCharset): Skip over 
+        quoted attributes.
+
 2007-01-31  David Carson  <dacarson@gmail.com>
 
         Reviewed by Darin.
index 2c07e05..44d57fb 100644 (file)
@@ -559,13 +559,26 @@ bool TextResourceDecoder::checkForHeadCharset(const char* data, size_t len, bool
                     enclosingTagName = noscriptTag.localName().impl();
             }
             
+            // Find where the opening tag ends.
+            const char* tagContentStart = ptr;
+            if (!end) {
+                while (*ptr != '>') {
+                    if (*ptr == '\0')
+                        return false;
+                    if (*ptr == '\'' || *ptr == '"') {
+                        char quoteMark = *ptr;
+                        while (*ptr != quoteMark) {
+                            if (*ptr == '\0')
+                                return false;
+                            ++ptr;
+                        }
+                    }
+                    ++ptr;
+                }
+            }
+            
             if (!end && tag == metaTag) {
-                const char* end = ptr;
-                while (*end != '>' && *end != '\0')
-                    end++;
-                if (*end == '\0')
-                    break;
-                DeprecatedCString str(ptr, (end-ptr)+1);
+                DeprecatedCString str(tagContentStart, tagContentStart - ptr);
                 str = str.lower();
                 int pos = 0;
                 while (pos < (int)str.length()) {