LayoutTests:
authorthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Sep 2006 15:35:26 +0000 (15:35 +0000)
committerthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Sep 2006 15:35:26 +0000 (15:35 +0000)
        Adds a test for the CSS URL quoting logic.

        * fast/inspector/cssURLQuotes-expected.txt: Added.
        * fast/inspector/cssURLQuotes.html: Added.

WebCore:

        Reviewed by Tim H.

        <rdar://problem/4699166> REGRESSION: Background images in Mail stationery do not load

        Fixes the quoting logic. The previous logic did not account for the
        CSS tokenizer's regex character range between * and ~ as valid in URL types.

        * css/CSSPrimitiveValue.cpp:
        (WebCore::isCSSTokenizerURL):

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

LayoutTests/ChangeLog
LayoutTests/fast/inspector/cssURLQuotes-expected.txt [new file with mode: 0644]
LayoutTests/fast/inspector/cssURLQuotes.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/css/CSSPrimitiveValue.cpp

index 69fd435a7508c09489a9ee09ad4bda42e9e05181..9fa50da9b2de22dc959bd7bec0082815bbb7642a 100644 (file)
@@ -1,3 +1,10 @@
+2006-09-08  Timothy Hatcher  <timothy@apple.com>
+
+        Adds a test for the CSS URL quoting logic.
+
+        * fast/inspector/cssURLQuotes-expected.txt: Added.
+        * fast/inspector/cssURLQuotes.html: Added.
+
 2006-09-09  Alexey Proskuryakov  <ap@nypop.com>
 
         Reviewed by Darin.
diff --git a/LayoutTests/fast/inspector/cssURLQuotes-expected.txt b/LayoutTests/fast/inspector/cssURLQuotes-expected.txt
new file mode 100644 (file)
index 0000000..2658d27
--- /dev/null
@@ -0,0 +1,4 @@
+ALERT: url(file:///unquoted) (URL should not be quoted)
+ALERT: url(file:///noQuotesNeeded) (URL should not be quoted)
+ALERT: url('file:///should(Quote)') (URL should be quoted)
+
diff --git a/LayoutTests/fast/inspector/cssURLQuotes.html b/LayoutTests/fast/inspector/cssURLQuotes.html
new file mode 100644 (file)
index 0000000..880b9a8
--- /dev/null
@@ -0,0 +1,13 @@
+<div id="testUnquoted" style="background-image: url(file:///unquoted)"></div>
+<div id="testNoQuotesNeeded" style="background-image: url('file:///noQuotesNeeded')"></div>
+<div id="testShouldQuote" style="background-image: url('file:///should(Quote)')"></div>
+<script>
+function test(id, reason) {
+    alert(document.getElementById(id).style.getPropertyValue("background-image") + " (" + reason + ")");
+}
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+test("testUnquoted", "URL should not be quoted");
+test("testNoQuotesNeeded", "URL should not be quoted");
+test("testShouldQuote", "URL should be quoted");
+</script>
index 43d47c4814b0c7f437d8c1ae0ce412aa19c240e6..37fd51dad47ba3a279783bc8de9a4fcf470fa7f5 100644 (file)
@@ -1,3 +1,15 @@
+2006-09-08  Darin Adler  <darin@apple.com>
+
+        Reviewed by Tim H.
+
+        <rdar://problem/4699166> REGRESSION: Background images in Mail stationery do not load
+        
+        Fixes the quoting logic. The previous logic did not account for the
+        CSS tokenizer's regex character range between * and ~ as valid in URL types.
+
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::isCSSTokenizerURL):
+
 2006-09-09  Alexey Proskuryakov  <ap@nypop.com>
 
         Reviewed by Darin.
index 6f83cd3d7fa702a41005cff0c352516b6a55b666..036cf106ae3f7a50e57197866c0646a32f716674 100644 (file)
@@ -63,21 +63,24 @@ static bool isCSSTokenizerURL(const String& string)
     const UChar* p = string.characters();
     const UChar* end = p + string.length();
 
-    for (; p != end; ++p)
-        switch (p[0]) {
+    for (; p != end; ++p) {
+        UChar c = p[0];
+        switch (c) {
             case '!':
             case '#':
             case '$':
             case '%':
             case '&':
-            case '*':
-            case '-':
-            case '~':
                 break;
             default:
-                if (p[0] < 128)
+                if (c < '*')
+                    return false;
+                if (c <= '~')
+                    break;
+                if (c < 128)
                     return false;
         }
+    }
 
     return true;
 }