Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1204)

Unified Diff: third_party/WebKit/LayoutTests/svg/custom/svg-intrinsic-size-with-cssstyle-auto.html

Issue 2230963002: SVG Image intrinsic size should be used if css style size is 'auto' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Align with review comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/svg/custom/svg-intrinsic-size-with-cssstyle-auto.html
diff --git a/third_party/WebKit/LayoutTests/svg/custom/svg-intrinsic-size-with-cssstyle-auto.html b/third_party/WebKit/LayoutTests/svg/custom/svg-intrinsic-size-with-cssstyle-auto.html
new file mode 100644
index 0000000000000000000000000000000000000000..292fa7e533fb1cba29b4f078868699899a29ce3c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/svg/custom/svg-intrinsic-size-with-cssstyle-auto.html
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
fs 2016/08/16 12:43:07 I'd suggest adding a <title> ("<svg:image> 'auto'
Shanmuga Pandi 2016/08/19 07:20:28 Done.
+<script src="../../resources/testharnessreport.js"></script>
+<svg height="0">
+ <image width="100" height="100" xlink:href="resources/square-green-checker.png" />
+ <image width="100" height="100" xlink:href="resources/square-green-checker.png" style="width:auto"/>
+ <image width="100" height="100" 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="200" height="200"
+ xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>"/>
+ <image width="200" height="200"
+ xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'></svg>" style='width:auto; height:auto'/>
+ <image width="200" height="200"
+ xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'></svg>" style='width:auto;'/>
+ <image xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'></svg>" style='width:auto;'/>
+ <image x="100" height="200"
+ xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'></svg>" style='width:auto;'/>
+ <image y="100" width="200"
+ xlink:href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100' 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>"/>
+</svg>
+<script>
+BBox = function(x,y,w,h) {
+ this.x = x;
+ this.y = y;
+ this.width = w;
+ this.height = h;
+};
+BBox.prototype.toString = function() {
+ return this.x + "," + this.y + "," + this.width + "," + this.height;
+};
+// The order of expected sizes should equal the document order of the images.
+var expectedBoxes = [
+ new BBox(0, 0, 100, 100),
fs 2016/08/16 12:43:08 Should probably add a description (string) as well
Shanmuga Pandi 2016/08/19 07:20:28 Done.
+ new BBox(0, 0, 400, 100),
+ new BBox(0, 0, 100, 400),
+ new BBox(0, 0, 400, 400),
+ new BBox(0, 0, 200, 200),
+ new BBox(0, 0, 100, 100),
+ new BBox(0, 0, 100, 200),
+ new BBox(0, 0, 100, 100),
+ new BBox(100, 0, 100, 200),
+ new BBox(0, 100, 200, 100),
+ new BBox(0, 0, 300, 150),
+ new BBox(0, 0, 300, 150),
+ new BBox(0, 0, 300, 150),
+ new BBox(0, 0, 300, 150),
+];
+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.x, image.expectedBox.x);
+ assert_equals(rectBBox.y, image.expectedBox.y);
+ assert_equals(rectBBox.width, image.expectedBox.width);
+ assert_equals(rectBBox.height, image.expectedBox.height);
+ });
+ }, 'Bounding box size ' + expectedBoxes[i]);
+}
+</script>

Powered by Google App Engine
This is Rietveld 408576698