RenderImage ignores its percent width/height when setContainerSizeForRenderer
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Apr 2012 20:08:02 +0000 (20:08 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 16 Apr 2012 20:08:02 +0000 (20:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=80431

Add a test case for Bug 80431. It renders a 1x1 svg as an image with percent
width/height specified.

Patch by Yong Li <yoli@rim.com> on 2012-04-16
Reviewed by Nikolas Zimmermann.

* svg/as-image/resources/rect-1x1.svg: Added.
* svg/as-image/svg-as-image-with-relative-size-expected.html: Added.
* svg/as-image/svg-as-image-with-relative-size.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/svg/as-image/resources/rect-1x1.svg [new file with mode: 0644]
LayoutTests/svg/as-image/svg-as-image-with-relative-size-expected.html [new file with mode: 0644]
LayoutTests/svg/as-image/svg-as-image-with-relative-size.html [new file with mode: 0644]

index 99a981b..5b08743 100644 (file)
@@ -1,3 +1,17 @@
+2012-04-16  Yong Li  <yoli@rim.com>
+
+        RenderImage ignores its percent width/height when setContainerSizeForRenderer
+        https://bugs.webkit.org/show_bug.cgi?id=80431
+
+        Add a test case for Bug 80431. It renders a 1x1 svg as an image with percent
+        width/height specified.
+
+        Reviewed by Nikolas Zimmermann.
+
+        * svg/as-image/resources/rect-1x1.svg: Added.
+        * svg/as-image/svg-as-image-with-relative-size-expected.html: Added.
+        * svg/as-image/svg-as-image-with-relative-size.html: Added.
+
 2012-04-16  Vincent Scheib  <scheib@chromium.org>
 
         Reverting shader-precision-format.html reftest fix - it only fixed some DBG builders. Marking test failing for those.
diff --git a/LayoutTests/svg/as-image/resources/rect-1x1.svg b/LayoutTests/svg/as-image/resources/rect-1x1.svg
new file mode 100644 (file)
index 0000000..38c4efd
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
+              "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1">
+    <rect x="0.2" y="0.2" width="0.6" height="0.6" fill="green" />
+</svg>
diff --git a/LayoutTests/svg/as-image/svg-as-image-with-relative-size-expected.html b/LayoutTests/svg/as-image/svg-as-image-with-relative-size-expected.html
new file mode 100644 (file)
index 0000000..08d4594
--- /dev/null
@@ -0,0 +1,16 @@
+<html>
+  <head>
+    <title>svg-as-image-with-relative-size-expected</title>
+    <style>
+      body {margin: 0px;}
+    </style>
+  </head>
+  <body>
+    <div style="width: 400px; height: 400px; border: 1px solid black;">
+        <svg xmlns="http://www.w3.org/2000/svg">
+            <rect x="40" y="40" width="120" height="120" fill="green"/>
+        </svg>
+    </div>
+  </body>
+</html>
+
diff --git a/LayoutTests/svg/as-image/svg-as-image-with-relative-size.html b/LayoutTests/svg/as-image/svg-as-image-with-relative-size.html
new file mode 100644 (file)
index 0000000..6cfc2c5
--- /dev/null
@@ -0,0 +1,16 @@
+<html>
+  <head>
+    <title>svg-as-image-with-relative-size</title>
+    <style>
+      body {margin: 0px;}
+    </style>
+  </head>
+  <body>
+    <div style="width: 400px; height: 400px; border: 1px solid black;">
+        <!-- The following svg has a width of 1px and a height of 1px and draws a rect inside.
+        The rect should still be painted with correct size on the page. -->
+        <img width=50% height=50% src='resources/rect-1x1.svg' />
+    </div>
+  </body>
+</html>
+