Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/svg/custom/svg-image-intrinsic-size-with-cssstyle-auto.html |
| diff --git a/third_party/WebKit/LayoutTests/svg/custom/svg-image-intrinsic-size-with-cssstyle-auto.html b/third_party/WebKit/LayoutTests/svg/custom/svg-image-intrinsic-size-with-cssstyle-auto.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6c5da315194ebf51e696c53290d447d0060a0991 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/svg/custom/svg-image-intrinsic-size-with-cssstyle-auto.html |
| @@ -0,0 +1,91 @@ |
| +<!DOCTYPE html> |
| +<title><svg:image> 'auto' sizing </title> |
| +<script src="../../resources/testharness.js"></script> |
| +<script src="../../resources/testharnessreport.js"></script> |
| +<svg height="0"> |
| + <image width="100" height="100" xlink:href="resources/square-green-checker.png" /> |
| + <image width="200" height="100" xlink:href="resources/square-green-checker.png" style="width:auto"/> |
| + <image width="100" height="200" xlink:href="resources/square-green-checker.png" style="height:auto"/> |
| + <image width="100" height="100" xlink:href="resources/square-green-checker.png" style="width:auto; height:auto"/> |
| + <image width="50" height="50" |
| + xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>"/> |
| + <image width="50" height="50" |
| + xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='100'></svg>" style='width:auto; height:auto'/> |
| + <image width="50" height="50" |
| + xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='100'></svg>" style='width:auto;'/> |
| + <image xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='100'></svg>" style='width:auto;'/> |
| + <image height="50" |
| + xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='100'></svg>" style='width:auto;'/> |
| + <image width="50" |
| + xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='100'></svg>" style='height:auto;'/> |
| + <image width="200" height="200" |
| + xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>" style='width:auto; height:auto'/> |
| + <image height="200" |
| + xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>" style='width:auto; height:auto'/> |
| + <image width="200" |
| + xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>" style='width:auto; height:auto'/> |
| + <image xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>"/> |
| + <image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 100'></svg>"/> |
| + <image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 100'></svg>" style='width:auto'/> |
| + <image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 100'></svg>" style='height:auto'/> |
| + <image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 100'></svg>" style='width:auto; height:auto'/> |
| + <image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' viewBox='0 0 400 100'></svg>"/> |
| + <image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' viewBox='0 0 400 100'></svg>" style='width:auto'/> |
| + <image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' viewBox='0 0 400 100'></svg>" style='height:auto'/> |
| + <image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' viewBox='0 0 400 100'></svg>" style='width:auto; height:auto'/> |
| + <image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' height='100' viewBox='0 0 400 100'></svg>"/> |
| + <image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' height='100' viewBox='0 0 400 100'></svg>" style='width:auto'/> |
| + <image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' height='100' viewBox='0 0 400 100'></svg>" style='height:auto'/> |
| + <image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' height='100' viewBox='0 0 400 100'></svg>" style='width:auto; height:auto'/> |
| + <image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='100' viewBox='0 0 400 100'></svg>"/> |
| + <image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='100' viewBox='0 0 400 100'></svg>" style='width:auto'/> |
| + <image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='100' viewBox='0 0 400 100'></svg>" style='height:auto'/> |
| + <image width="60" height="60" xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='100' viewBox='0 0 400 100'></svg>" style='width:auto; height:auto'/> |
| +</svg> |
| +<script> |
| +var expectedBoxes = [ |
| + { dimensions: [100, 100], description: "400x400 png image, with attributes width='100' height='100'"}, |
|
fs
2016/09/14 11:31:52
I think we could drop all the instances of "with"
Shanmuga Pandi
2016/09/14 13:15:36
Done.
|
| + { dimensions: [100, 100], description: "400x400 png image, with attributes width='200' height='100', and with CSS 'width:auto'"}, |
| + { dimensions: [100, 100], description: "400x400 png image, with attributes width='100' height='200', and with CSS 'height:auto'"}, |
| + { dimensions: [400, 400], description: "400x400 png image, with attributes width='100' height='100', and with CSS 'width:auto; height:auto'"}, |
| + { dimensions: [50, 50], description: "default sized svg image, with attributes width='50' height='50'"}, |
| + { dimensions: [200, 100], description: "200x100 svg image, with attributes width='50' height='50', and with CSS 'width:auto; height:auto'"}, |
| + { dimensions: [100, 50], description: "200x100 svg image, with attributes width='50' height='50', and with CSS 'width:auto'"}, |
| + { dimensions: [200, 100], description: "200x100 svg image, without attributes width and height, and with CSS 'width:auto'"}, |
| + { dimensions: [100, 50], description: "200x100 svg image, with attributes height='50', and with 'width:auto'"}, |
| + { dimensions: [50, 25], description: "200x100 svg image, with attributes width='50', and with CSS height:auto"}, |
| + { dimensions: [300, 150], description: "default sized svg image, with attributes width='200' height='200', and with CSS 'width:auto; height:auto'"}, |
| + { dimensions: [300, 150], description: "default sized svg image, with attributes height='200', and with CSS 'width:auto; height:auto'"}, |
| + { dimensions: [300, 150], description: "default sized svg image, with attributes width='200', and with CSS 'width:auto; height:auto'"}, |
| + { dimensions: [300, 150], description: "default sized svg image, without attributes width and height, no css width/height specified"}, |
| + { dimensions: [60, 60], description: "default sized svg image with viewBox='0 0 400 100', with attributes width='60' height='60', no css width/height specified"}, |
| + { dimensions: [240, 60], description: "default sized svg image with viewBox='0 0 400 100', with attributes width='60' height='60', and with CSS 'width:auto'"}, |
| + { dimensions: [60, 15], description: "default sized svg image with viewBox='0 0 400 100', with attributes width='60' height='60', and with CSS 'height:auto'"}, |
| + { dimensions: [300, 75], description: "default sized svg image with viewBox='0 0 400 100', with attributes width='60' height='60', and with CSS 'width:auto; height:auto'"}, |
| + { dimensions: [60, 60], description: "svg image with width='200' viewBox='0 0 400 100', with attributes width='60' height='60', no css width/height specified"}, |
| + { dimensions: [240, 60], description: "svg image with width='200' viewBox='0 0 400 100', with attributes width='60' height='60', and with CSS 'width:auto'"}, |
| + { dimensions: [60, 15], description: "svg image with width='200' viewBox='0 0 400 100', with attributes width='60' height='60', and with CSS 'height:auto'"}, |
| + { dimensions: [200, 50], description: "svg image with width='200' viewBox='0 0 400 100', with attributes width='60' height='60', and with CSS 'width:auto; height:auto'"}, |
| + { dimensions: [60, 60], description: "svg image with height='100' viewBox='0 0 400 100', with attributes width='60' height='60', no css width/height specified"}, |
| + { dimensions: [240, 60], description: "svg image with height='100' viewBox='0 0 400 100', with attributes width='60' height='60', and with CSS 'width:auto'"}, |
| + { dimensions: [60, 15], description: "svg image with height='100' viewBox='0 0 400 100', with attributes width='60' height='60', and with CSS 'height:auto'"}, |
| + { dimensions: [400, 100], description: "svg image with height='100' viewBox='0 0 400 100', with attributes width='60' height='60', and with CSS 'width:auto; height:auto'"}, |
| + { dimensions: [60, 60], description: "200x100 svg image with viewBox='0 0 400 100', with attributes width='60' height='60', no css width/height specified"}, |
| + { dimensions: [120, 60], description: "200x100 svg image with viewBox='0 0 400 100', with attributes width='60' height='60', and with CSS 'width:auto'"}, |
| + { dimensions: [60, 30], description: "200x100 svg image with viewBox='0 0 400 100', with attributes width='60' height='60', and with CSS 'height:auto'"}, |
| + { dimensions: [200, 100], description: "200x100 svg image with viewBox='0 0 400 100', with attributes width='60' height='60', and with CSS 'width:auto; height:auto'"}, |
| +]; |
| + |
| +var images = document.getElementsByTagName('image'); |
| +for (var i = 0, length = images.length; i < length; ++i) { |
| + async_test(function(t) { |
| + var image = images[i]; |
| + image.expectedBox = expectedBoxes[i]; |
| + image.onload = t.step_func_done(function() { |
| + var rectBBox = image.getBBox(); |
| + assert_equals(rectBBox.width, image.expectedBox.dimensions[0]); |
| + assert_equals(rectBBox.height, image.expectedBox.dimensions[1]); |
| + }); |
| + }, document.title + ' with ' + expectedBoxes[i].description); |
| +} |
| +</script> |