Title: [156186] trunk
Revision
156186
Author
[email protected]
Date
2013-09-20 12:09:05 -0700 (Fri, 20 Sep 2013)

Log Message

Fixed img src URLS with multiple spaces
https://bugs.webkit.org/show_bug.cgi?id=121592

Patch by Yoav Weiss <[email protected]> on 2013-09-20
Reviewed by Darin Adler.

Source/WebCore:

Test: fast/loader/image-src-multiple-space.html

I've removed the simplifyWhiteSpace step from HTMLImageElement's src attribute during the srcset selection algorithm.
That step prevented URLs with multiple spaces from being loaded as images, minimizing the multiple spaces into a single one.

* html/parser/HTMLParserIdioms.cpp:
(WebCore::bestFitSourceForImageAttributes):

LayoutTests:

This test verifies that URLs with multiple spaces can be loaded as an image resource.

* fast/loader/image-src-multiple-space-expected.txt: Added.
* fast/loader/image-src-multiple-space.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (156185 => 156186)


--- trunk/LayoutTests/ChangeLog	2013-09-20 19:06:52 UTC (rev 156185)
+++ trunk/LayoutTests/ChangeLog	2013-09-20 19:09:05 UTC (rev 156186)
@@ -1,3 +1,15 @@
+2013-09-20  Yoav Weiss  <[email protected]>
+
+        Fixed img src URLS with multiple spaces
+        https://bugs.webkit.org/show_bug.cgi?id=121592
+
+        Reviewed by Darin Adler.
+
+        This test verifies that URLs with multiple spaces can be loaded as an image resource.
+
+        * fast/loader/image-src-multiple-space-expected.txt: Added.
+        * fast/loader/image-src-multiple-space.html: Added.
+
 2013-09-20  Arunprasad Rajkumar  <[email protected]>
 
         Hiding a focused element should unfocus it and fire a blur event

Added: trunk/LayoutTests/fast/loader/image-src-multiple-space-expected.txt (0 => 156186)


--- trunk/LayoutTests/fast/loader/image-src-multiple-space-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/loader/image-src-multiple-space-expected.txt	2013-09-20 19:09:05 UTC (rev 156186)
@@ -0,0 +1,3 @@
+PASS document.getElementById("foo").clientWidth==25 is true
+This test passes if the image below is displayed.
+

Added: trunk/LayoutTests/fast/loader/image-src-multiple-space.html (0 => 156186)


--- trunk/LayoutTests/fast/loader/image-src-multiple-space.html	                        (rev 0)
+++ trunk/LayoutTests/fast/loader/image-src-multiple-space.html	2013-09-20 19:09:05 UTC (rev 156186)
@@ -0,0 +1,15 @@
+<html>
+<head>
+<script src=""
+<script>
+    addEventListener("load", function() {
+        shouldBeTrue('document.getElementById("foo").clientWidth==25');
+    }, false);
+</script>
+</head>
+
+<body id="body">
+    <div>This test passes if the image below is displayed.</div>
+    <img id="foo" src=""  space.png">
+</body>
+</html>

Added: trunk/LayoutTests/fast/loader/resources/image space.png


(Binary files differ)
Property changes on: trunk/LayoutTests/fast/loader/resources/image space.png ___________________________________________________________________

Added: svn:mime-type

Modified: trunk/Source/WebCore/ChangeLog (156185 => 156186)


--- trunk/Source/WebCore/ChangeLog	2013-09-20 19:06:52 UTC (rev 156185)
+++ trunk/Source/WebCore/ChangeLog	2013-09-20 19:09:05 UTC (rev 156186)
@@ -1,3 +1,18 @@
+2013-09-20  Yoav Weiss  <[email protected]>
+
+        Fixed img src URLS with multiple spaces
+        https://bugs.webkit.org/show_bug.cgi?id=121592
+
+        Reviewed by Darin Adler.
+
+        Test: fast/loader/image-src-multiple-space.html
+
+        I've removed the simplifyWhiteSpace step from HTMLImageElement's src attribute during the srcset selection algorithm.
+        That step prevented URLs with multiple spaces from being loaded as images, minimizing the multiple spaces into a single one.
+
+        * html/parser/HTMLParserIdioms.cpp:
+        (WebCore::bestFitSourceForImageAttributes):
+
 2013-09-20  Arunprasad Rajkumar  <[email protected]>
 
         Hiding a focused element should unfocus it and fire a blur event

Modified: trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp (156185 => 156186)


--- trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp	2013-09-20 19:06:52 UTC (rev 156185)
+++ trunk/Source/WebCore/html/parser/HTMLParserIdioms.cpp	2013-09-20 19:09:05 UTC (rev 156186)
@@ -405,10 +405,9 @@
 
     parseImagesWithScaleFromSrcsetAttribute(srcsetAttribute, imageCandidates);
 
-    const String src =  ""
-    if (!src.isEmpty()) {
+    if (!srcAttribute.isEmpty()) {
         ImageWithScale image;
-        image.imageURL = src;
+        image.imageURL = srcAttribute;
         image.scaleFactor = 1.0;
 
         imageCandidates.append(image);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to