Bug 614649, patch 2: Tweak/repurpose some existing svg-as-an-image reftests, in light of their (intentionally) different rendering as a result of this bug's patch. r=roc a=tests
authorDaniel Holbert <dholbert@cs.stanford.edu>
Wed, 09 Feb 2011 12:13:18 -0800
changeset 62245 21ee3d8dfada1e24fcc1490ae4b8e0a9fcb1db3d
parent 62244 78ca7c8ec7bd0c5d782dd2be6a35d2a56ecea9a4
child 62246 787ec4f8b8062d6a3800c470d7194c41f11d36fb
push idunknown
push userunknown
push dateunknown
reviewersroc, tests
bugs614649
milestone2.0b12pre
Bug 614649, patch 2: Tweak/repurpose some existing svg-as-an-image reftests, in light of their (intentionally) different rendering as a result of this bug's patch. r=roc a=tests
layout/reftests/svg/as-image/img-simple-3-ref.html
layout/reftests/svg/as-image/img-simple-3.html
layout/reftests/svg/as-image/img-simple-5-ref.html
layout/reftests/svg/as-image/img-simple-5.html
layout/reftests/svg/as-image/img-simple-7-ref.html
layout/reftests/svg/as-image/img-simple-7.html
layout/reftests/svg/as-image/lime50x25.svg
layout/reftests/svg/as-image/reftest.list
layout/reftests/svg/as-image/squaredCircle-100x100.svg
layout/reftests/svg/as-image/squaredCircle-100x50.svg
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/as-image/img-simple-3-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+  <svg style="width: 600px; height: 600px"
+       viewBox="0 0 100 100">
+    <rect x="2" y="2" height="96" width="96"
+          stroke-width="4" stroke="black" fill="yellow"/>
+    <circle cx="50" cy="50" r="46" style="fill: blue"/>
+  </svg>
+</body>
+</html>
--- a/layout/reftests/svg/as-image/img-simple-3.html
+++ b/layout/reftests/svg/as-image/img-simple-3.html
@@ -1,9 +1,9 @@
 <html>
 <body>
-  <!-- Note: Despite the large width here, the SVG content won't scale, because
-       it hasn't provided a viewbox. It renders at a 100% zoom-level (just as
-       it would in an <embed> tag, and just as it would if we viewed it in a
-       100x600-sized browser window. -->
-  <img src="lime100x100.svg" width="600px">
+  <!-- This image scales uniformly, preserving its aspect ratio, to be
+       600x600.  Though the SVG content doesn't have a viewBox, we behave as if
+       it did when it's used as an image, since it has non-percent-valued
+       height and width attributes on the root svg node. -->
+  <img src="squaredCircle-100x100.svg" width="600px">
 </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/as-image/img-simple-5-ref.html
@@ -0,0 +1,11 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+  <svg style="width: 200px; height: 600px"
+       viewBox="0 0 100 100" preserveAspectRatio="none">
+    <rect x="2" y="2" height="96" width="96"
+          stroke-width="4" stroke="black" fill="yellow"/>
+    <circle cx="50" cy="50" r="46" style="fill: blue"/>
+  </svg>
+</body>
+</html>
--- a/layout/reftests/svg/as-image/img-simple-5.html
+++ b/layout/reftests/svg/as-image/img-simple-5.html
@@ -1,5 +1,6 @@
 <html>
 <body>
-  <img src="lime100x100.svg" width="150px" height="600px">
+  <!-- Like img-simple-3, but with height != width on the img element. -->
+  <img src="squaredCircle-100x100.svg" width="200px" height="600px">
 </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/as-image/img-simple-7-ref.html
@@ -0,0 +1,10 @@
+<html>
+<body>
+  <svg style="width: 200px; height: 200px"
+       viewBox="0 0 100 50" preserveAspectRatio="none">
+    <rect x="2" y="2" height="96" width="96"
+          stroke-width="4" stroke="black" fill="yellow"/>
+    <circle cx="50" cy="50" r="46" style="fill: blue"/>
+  </svg>
+</body>
+</html>
--- a/layout/reftests/svg/as-image/img-simple-7.html
+++ b/layout/reftests/svg/as-image/img-simple-7.html
@@ -1,6 +1,6 @@
 <html>
 <body>
-  <!-- Like img-simple-6.html, but with an explicit 'height' on the <img> -->
-  <img src="lime200x100.svg" width="100px" height="100px">
+  <!-- Like img-simple-3, but with height != width on the root SVG node. -->
+  <img src="squaredCircle-100x50.svg" width="200px" height="200px">
 </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/as-image/lime50x25.svg
@@ -0,0 +1,4 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
+     width="50" height="25">
+  <rect width="100%" height="100%" fill="lime"/>
+</svg>
--- a/layout/reftests/svg/as-image/reftest.list
+++ b/layout/reftests/svg/as-image/reftest.list
@@ -39,21 +39,21 @@ fails == canvas-drawImage-scale-2a.html 
 fails == canvas-drawImage-scale-2b.html canvas-drawImage-scale-2-ref.html # XXX all edges fuzzy
 
 == canvas-drawImage-slice-1a.html lime100x100-ref.html
 fails == canvas-drawImage-slice-1b.html lime100x100-ref.html # XXX all edges fuzzy
 
 # Simple <img> tests
 == img-simple-1.html  lime100x100-ref.html
 == img-simple-2.html  lime100x100-ref.html
-== img-simple-3.html  lime100x100-ref.html
+fails-if(d2d) == img-simple-3.html  img-simple-3-ref.html
 == img-simple-4.html  lime100x100-ref.html
-== img-simple-5.html  lime100x100-ref.html
+fails-if(d2d) == img-simple-5.html  img-simple-5-ref.html
 == img-simple-6.html  lime100x100-ref.html
-== img-simple-7.html  lime100x100-ref.html
+fails-if(d2d) == img-simple-7.html  img-simple-7-ref.html
 
 # Test with mix of <html:img> and <svg:image> referring to the same images,
 # with a variety of preserveAspectRatio values in play.
 # NOTE: The reference cases in this test triggers 72 assertions (bug 563481)
 asserts(72) == img-and-image-1.html img-and-image-1-ref.svg
 
 # More complex <img> tests
 random-if(gtk2Widget) == img-anim-1.html  lime100x100-ref.html # bug 612214
copy from layout/reftests/svg/as-image/squaredCircle-viewBox-100x100.svg
copy to layout/reftests/svg/as-image/squaredCircle-100x100.svg
--- a/layout/reftests/svg/as-image/squaredCircle-viewBox-100x100.svg
+++ b/layout/reftests/svg/as-image/squaredCircle-100x100.svg
@@ -1,6 +1,6 @@
-<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100"
-     height="100" width="100" >
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
+     width="100" height="100">
   <rect x="2" y="2" height="96" width="96"
         stroke-width="4" stroke="black" fill="yellow"/>
   <circle cx="50" cy="50" r="46" style="fill: blue"/>
 </svg>
copy from layout/reftests/svg/as-image/squaredCircle-viewBox-100x100.svg
copy to layout/reftests/svg/as-image/squaredCircle-100x50.svg
--- a/layout/reftests/svg/as-image/squaredCircle-viewBox-100x100.svg
+++ b/layout/reftests/svg/as-image/squaredCircle-100x50.svg
@@ -1,6 +1,6 @@
-<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 100 100"
-     height="100" width="100" >
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
+     width="100" height="50">
   <rect x="2" y="2" height="96" width="96"
         stroke-width="4" stroke="black" fill="yellow"/>
   <circle cx="50" cy="50" r="46" style="fill: blue"/>
 </svg>