summaryrefslogtreecommitdiffstats
path: root/image/test/reftest/downscaling
diff options
context:
space:
mode:
Diffstat (limited to 'image/test/reftest/downscaling')
-rw-r--r--image/test/reftest/downscaling/black-border-bottom.pngbin0 -> 4094 bytes
-rw-r--r--image/test/reftest/downscaling/black-border-left.pngbin0 -> 4176 bytes
-rw-r--r--image/test/reftest/downscaling/black-border-rect.svg3
-rw-r--r--image/test/reftest/downscaling/black-border-right.pngbin0 -> 4097 bytes
-rw-r--r--image/test/reftest/downscaling/black-border-top.pngbin0 -> 4144 bytes
-rw-r--r--image/test/reftest/downscaling/bmp-size-16x16-24bpp.pngbin0 -> 879 bytes
-rw-r--r--image/test/reftest/downscaling/downscale-1-bigimage.pngbin0 -> 195 bytes
-rw-r--r--image/test/reftest/downscaling/downscale-1-ref.html8
-rw-r--r--image/test/reftest/downscaling/downscale-1-smallimage.pngbin0 -> 88 bytes
-rw-r--r--image/test/reftest/downscaling/downscale-1.html24
-rw-r--r--image/test/reftest/downscaling/downscale-16px.html28
-rw-r--r--image/test/reftest/downscaling/downscale-2a.html31
-rw-r--r--image/test/reftest/downscaling/downscale-2b.html31
-rw-r--r--image/test/reftest/downscaling/downscale-2c.html31
-rw-r--r--image/test/reftest/downscaling/downscale-2d.html31
-rw-r--r--image/test/reftest/downscaling/downscale-2e.html31
-rw-r--r--image/test/reftest/downscaling/downscale-2f.html31
-rw-r--r--image/test/reftest/downscaling/downscale-32px-ref.html8
-rw-r--r--image/test/reftest/downscaling/downscale-32px.html31
-rw-r--r--image/test/reftest/downscaling/downscale-8px.html27
-rw-r--r--image/test/reftest/downscaling/downscale-moz-icon-1-ref.html37
-rw-r--r--image/test/reftest/downscaling/downscale-moz-icon-1.html19
-rw-r--r--image/test/reftest/downscaling/downscale-png.html31
-rw-r--r--image/test/reftest/downscaling/downscale-svg-1-ref.html13
-rw-r--r--image/test/reftest/downscaling/downscale-svg-1a.html8
-rw-r--r--image/test/reftest/downscaling/downscale-svg-1b.html8
-rw-r--r--image/test/reftest/downscaling/downscale-svg-1c.html8
-rw-r--r--image/test/reftest/downscaling/downscale-svg-1d.html8
-rw-r--r--image/test/reftest/downscaling/downscale-svg-1e.html8
-rw-r--r--image/test/reftest/downscaling/downscale-svg-1f.html8
-rw-r--r--image/test/reftest/downscaling/ff-0RGB.icobin0 -> 4286 bytes
-rw-r--r--image/test/reftest/downscaling/ff-0RGB.pngbin0 -> 2515 bytes
-rw-r--r--image/test/reftest/downscaling/ff-ARGB.icobin0 -> 4286 bytes
-rw-r--r--image/test/reftest/downscaling/ff-ARGB.pngbin0 -> 115 bytes
-rw-r--r--image/test/reftest/downscaling/lime-red-256px-bmp-in.icobin0 -> 74814 bytes
-rw-r--r--image/test/reftest/downscaling/lime-red-256px-png-in.icobin0 -> 881 bytes
-rw-r--r--image/test/reftest/downscaling/lime-red-256px.bmpbin0 -> 196730 bytes
-rw-r--r--image/test/reftest/downscaling/lime-red-256px.gifbin0 -> 873 bytes
-rw-r--r--image/test/reftest/downscaling/lime-red-256px.jpgbin0 -> 2865 bytes
-rw-r--r--image/test/reftest/downscaling/lime-red-256px.pngbin0 -> 568 bytes
-rw-r--r--image/test/reftest/downscaling/lime-red-256px.svg5
-rw-r--r--image/test/reftest/downscaling/lime-red-32px.pngbin0 -> 103 bytes
-rw-r--r--image/test/reftest/downscaling/png-interlaced.pngbin0 -> 806 bytes
-rw-r--r--image/test/reftest/downscaling/png-normal.pngbin0 -> 421 bytes
-rw-r--r--image/test/reftest/downscaling/reftest-stylo.list195
-rw-r--r--image/test/reftest/downscaling/reftest.list193
-rw-r--r--image/test/reftest/downscaling/top-to-bottom-16x16-24bpp.bmpbin0 -> 822 bytes
47 files changed, 856 insertions, 0 deletions
diff --git a/image/test/reftest/downscaling/black-border-bottom.png b/image/test/reftest/downscaling/black-border-bottom.png
new file mode 100644
index 000000000..efa7ce2dc
--- /dev/null
+++ b/image/test/reftest/downscaling/black-border-bottom.png
Binary files differ
diff --git a/image/test/reftest/downscaling/black-border-left.png b/image/test/reftest/downscaling/black-border-left.png
new file mode 100644
index 000000000..11bc67e98
--- /dev/null
+++ b/image/test/reftest/downscaling/black-border-left.png
Binary files differ
diff --git a/image/test/reftest/downscaling/black-border-rect.svg b/image/test/reftest/downscaling/black-border-rect.svg
new file mode 100644
index 000000000..0fa01a0a6
--- /dev/null
+++ b/image/test/reftest/downscaling/black-border-rect.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="-0.5 -0.5 53 43" stroke="#000000">
+ <rect x="0" y="7" width="52" height="35" fill="#ffffff"/>
+</svg>
diff --git a/image/test/reftest/downscaling/black-border-right.png b/image/test/reftest/downscaling/black-border-right.png
new file mode 100644
index 000000000..081c52d5b
--- /dev/null
+++ b/image/test/reftest/downscaling/black-border-right.png
Binary files differ
diff --git a/image/test/reftest/downscaling/black-border-top.png b/image/test/reftest/downscaling/black-border-top.png
new file mode 100644
index 000000000..fc6e69e02
--- /dev/null
+++ b/image/test/reftest/downscaling/black-border-top.png
Binary files differ
diff --git a/image/test/reftest/downscaling/bmp-size-16x16-24bpp.png b/image/test/reftest/downscaling/bmp-size-16x16-24bpp.png
new file mode 100644
index 000000000..c04869e72
--- /dev/null
+++ b/image/test/reftest/downscaling/bmp-size-16x16-24bpp.png
Binary files differ
diff --git a/image/test/reftest/downscaling/downscale-1-bigimage.png b/image/test/reftest/downscaling/downscale-1-bigimage.png
new file mode 100644
index 000000000..5e018590c
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-1-bigimage.png
Binary files differ
diff --git a/image/test/reftest/downscaling/downscale-1-ref.html b/image/test/reftest/downscaling/downscale-1-ref.html
new file mode 100644
index 000000000..63ec56ef7
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-1-ref.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html>
+<body>
+ <img src="downscale-1-smallimage.png">
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-1-smallimage.png b/image/test/reftest/downscaling/downscale-1-smallimage.png
new file mode 100644
index 000000000..588e6b78d
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-1-smallimage.png
Binary files differ
diff --git a/image/test/reftest/downscaling/downscale-1.html b/image/test/reftest/downscaling/downscale-1.html
new file mode 100644
index 000000000..a9629ef85
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-1.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html class="reftest-wait">
+<head>
+ <script>
+ function snapshot() {
+ document.documentElement.removeAttribute('class');
+ }
+ </script>
+</head>
+<!-- NOTE: Using setTimeout to wait for high-quality downscaled version of
+ image to be ready, because there's nothing better we can do. If we fix
+ Bug 1006883, we can do away with this setTimeout.
+
+ For now, the setTimeout is just here to increase the likelihood that we
+ actually test the high-quality downscaled version of the image. If the
+ setTimeout happens to fire before the high-quality downscaled rendering is
+ ready, then this the test will pass without testing what it's trying to
+ test, which is fine as long as that's rare. -->
+<body onload="setTimeout(snapshot, 50)">
+ <img src="downscale-1-bigimage.png" style="height: 20px; width: 20px">
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-16px.html b/image/test/reftest/downscaling/downscale-16px.html
new file mode 100644
index 000000000..b34adb93d
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-16px.html
@@ -0,0 +1,28 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<head>
+<title>Image reftest wrapper</title>
+<style type="text/css">
+ #image1 { background-color: rgb(10, 250, 100); }
+</style>
+<script>
+ // The image is loaded async after the page loads.
+ // Wait for it to finish loading.
+ function onImageLoad() {
+ document.documentElement.removeAttribute("class");
+ };
+</script>
+</head>
+<body>
+<img width="16px" height="16px" id="image1">
+<script>
+ // Use as "wrapper.html?image.png"
+ var imgURL = document.location.search.substr(1);
+ document.images[0].onload = onImageLoad;
+ document.images[0].onerror = onImageLoad;
+ document.images[0].alt = "";
+ document.images[0].src = imgURL;
+</script>
+</body>
+</html>
+
diff --git a/image/test/reftest/downscaling/downscale-2a.html b/image/test/reftest/downscaling/downscale-2a.html
new file mode 100644
index 000000000..fac11ccee
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-2a.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html reftest-zoom="1.0" class="reftest-wait">
+<head>
+ <script>
+ function snapshot() {
+ document.documentElement.removeAttribute('class');
+ }
+ </script>
+</head>
+<!-- NOTE: Using setTimeout to wait for high-quality downscaled version of
+ image to be ready, because there's nothing better we can do. If we fix
+ Bug 1006883, we can do away with this setTimeout.
+
+ For now, the setTimeout is just here to increase the likelihood that we
+ actually test the high-quality downscaled version of the image. If the
+ setTimeout happens to fire before the high-quality downscaled rendering is
+ ready, then this the test will pass without testing what it's trying to
+ test, which is fine as long as that's rare. -->
+<body style="margin: 0px" onload="setTimeout(snapshot, 50)">
+ <script>
+ var args = location.search.substring(1).split(',');
+ var image = document.createElement('img');
+ image.width = args[0];
+ image.height = args[1];
+ image.src = 'black-border-' + args[2] + '.png';
+ document.body.appendChild(image);
+ </script>
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-2b.html b/image/test/reftest/downscaling/downscale-2b.html
new file mode 100644
index 000000000..af7ecbff3
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-2b.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html reftest-zoom="0.9" class="reftest-wait">
+<head>
+ <script>
+ function snapshot() {
+ document.documentElement.removeAttribute('class');
+ }
+ </script>
+</head>
+<!-- NOTE: Using setTimeout to wait for high-quality downscaled version of
+ image to be ready, because there's nothing better we can do. If we fix
+ Bug 1006883, we can do away with this setTimeout.
+
+ For now, the setTimeout is just here to increase the likelihood that we
+ actually test the high-quality downscaled version of the image. If the
+ setTimeout happens to fire before the high-quality downscaled rendering is
+ ready, then this the test will pass without testing what it's trying to
+ test, which is fine as long as that's rare. -->
+<body style="margin: 0px" onload="setTimeout(snapshot, 50)">
+ <script>
+ var args = location.search.substring(1).split(',');
+ var image = document.createElement('img');
+ image.width = args[0];
+ image.height = args[1];
+ image.src = 'black-border-' + args[2] + '.png';
+ document.body.appendChild(image);
+ </script>
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-2c.html b/image/test/reftest/downscaling/downscale-2c.html
new file mode 100644
index 000000000..18f70456b
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-2c.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html reftest-zoom="0.8" class="reftest-wait">
+<head>
+ <script>
+ function snapshot() {
+ document.documentElement.removeAttribute('class');
+ }
+ </script>
+</head>
+<!-- NOTE: Using setTimeout to wait for high-quality downscaled version of
+ image to be ready, because there's nothing better we can do. If we fix
+ Bug 1006883, we can do away with this setTimeout.
+
+ For now, the setTimeout is just here to increase the likelihood that we
+ actually test the high-quality downscaled version of the image. If the
+ setTimeout happens to fire before the high-quality downscaled rendering is
+ ready, then this the test will pass without testing what it's trying to
+ test, which is fine as long as that's rare. -->
+<body style="margin: 0px" onload="setTimeout(snapshot, 50)">
+ <script>
+ var args = location.search.substring(1).split(',');
+ var image = document.createElement('img');
+ image.width = args[0];
+ image.height = args[1];
+ image.src = 'black-border-' + args[2] + '.png';
+ document.body.appendChild(image);
+ </script>
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-2d.html b/image/test/reftest/downscaling/downscale-2d.html
new file mode 100644
index 000000000..8d9547b73
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-2d.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html reftest-zoom="0.67" class="reftest-wait">
+<head>
+ <script>
+ function snapshot() {
+ document.documentElement.removeAttribute('class');
+ }
+ </script>
+</head>
+<!-- NOTE: Using setTimeout to wait for high-quality downscaled version of
+ image to be ready, because there's nothing better we can do. If we fix
+ Bug 1006883, we can do away with this setTimeout.
+
+ For now, the setTimeout is just here to increase the likelihood that we
+ actually test the high-quality downscaled version of the image. If the
+ setTimeout happens to fire before the high-quality downscaled rendering is
+ ready, then this the test will pass without testing what it's trying to
+ test, which is fine as long as that's rare. -->
+<body style="margin: 0px" onload="setTimeout(snapshot, 50)">
+ <script>
+ var args = location.search.substring(1).split(',');
+ var image = document.createElement('img');
+ image.width = args[0];
+ image.height = args[1];
+ image.src = 'black-border-' + args[2] + '.png';
+ document.body.appendChild(image);
+ </script>
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-2e.html b/image/test/reftest/downscaling/downscale-2e.html
new file mode 100644
index 000000000..c3d0d771f
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-2e.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html reftest-zoom="0.5" class="reftest-wait">
+<head>
+ <script>
+ function snapshot() {
+ document.documentElement.removeAttribute('class');
+ }
+ </script>
+</head>
+<!-- NOTE: Using setTimeout to wait for high-quality downscaled version of
+ image to be ready, because there's nothing better we can do. If we fix
+ Bug 1006883, we can do away with this setTimeout.
+
+ For now, the setTimeout is just here to increase the likelihood that we
+ actually test the high-quality downscaled version of the image. If the
+ setTimeout happens to fire before the high-quality downscaled rendering is
+ ready, then this the test will pass without testing what it's trying to
+ test, which is fine as long as that's rare. -->
+<body style="margin: 0px" onload="setTimeout(snapshot, 50)">
+ <script>
+ var args = location.search.substring(1).split(',');
+ var image = document.createElement('img');
+ image.width = args[0];
+ image.height = args[1];
+ image.src = 'black-border-' + args[2] + '.png';
+ document.body.appendChild(image);
+ </script>
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-2f.html b/image/test/reftest/downscaling/downscale-2f.html
new file mode 100644
index 000000000..42cfad1f5
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-2f.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html reftest-zoom="0.3" class="reftest-wait">
+<head>
+ <script>
+ function snapshot() {
+ document.documentElement.removeAttribute('class');
+ }
+ </script>
+</head>
+<!-- NOTE: Using setTimeout to wait for high-quality downscaled version of
+ image to be ready, because there's nothing better we can do. If we fix
+ Bug 1006883, we can do away with this setTimeout.
+
+ For now, the setTimeout is just here to increase the likelihood that we
+ actually test the high-quality downscaled version of the image. If the
+ setTimeout happens to fire before the high-quality downscaled rendering is
+ ready, then this the test will pass without testing what it's trying to
+ test, which is fine as long as that's rare. -->
+<body style="margin: 0px" onload="setTimeout(snapshot, 50)">
+ <script>
+ var args = location.search.substring(1).split(',');
+ var image = document.createElement('img');
+ image.width = args[0];
+ image.height = args[1];
+ image.src = 'black-border-' + args[2] + '.png';
+ document.body.appendChild(image);
+ </script>
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-32px-ref.html b/image/test/reftest/downscaling/downscale-32px-ref.html
new file mode 100644
index 000000000..1caf3c73b
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-32px-ref.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html>
+<body style="margin: 0px">
+ <img src="lime-red-32px.png">
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-32px.html b/image/test/reftest/downscaling/downscale-32px.html
new file mode 100644
index 000000000..f5fce324d
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-32px.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html class="reftest-wait">
+<head>
+ <script>
+ function snapshot() {
+ document.documentElement.removeAttribute('class');
+ }
+ </script>
+</head>
+<!-- NOTE: Using setTimeout to wait for high-quality downscaled version of
+ image to be ready, because there's nothing better we can do. If we fix
+ Bug 1006883, we can do away with this setTimeout.
+
+ For now, the setTimeout is just here to increase the likelihood that we
+ actually test the high-quality downscaled version of the image. If the
+ setTimeout happens to fire before the high-quality downscaled rendering is
+ ready, then this the test will pass without testing what it's trying to
+ test, which is fine as long as that's rare. -->
+<body style="margin: 0px" onload="setTimeout(snapshot, 50)">
+ <script>
+ var args = location.search.substring(1).split(',');
+ var image = document.createElement('img');
+ image.width = "32";
+ image.height = "32";
+ image.src = 'lime-red-256px' + location.search.substring(1);
+ document.body.appendChild(image);
+ </script>
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-8px.html b/image/test/reftest/downscaling/downscale-8px.html
new file mode 100644
index 000000000..32cb1b211
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-8px.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait">
+<head>
+<title>Image reftest wrapper</title>
+<style type="text/css">
+ #image1 { background-color: rgb(10, 250, 100); }
+</style>
+<script>
+ // The image is loaded async after the page loads.
+ // Wait for it to finish loading.
+ function onImageLoad() {
+ document.documentElement.removeAttribute("class");
+ };
+</script>
+</head>
+<body>
+<img width="8px" id="image1">
+<script>
+ // Use as "wrapper.html?image.png"
+ var imgURL = document.location.search.substr(1);
+ document.images[0].onload = onImageLoad;
+ document.images[0].onerror = onImageLoad;
+ document.images[0].alt = "";
+ document.images[0].src = imgURL;
+</script>
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-moz-icon-1-ref.html b/image/test/reftest/downscaling/downscale-moz-icon-1-ref.html
new file mode 100644
index 000000000..ade5e2192
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-moz-icon-1-ref.html
@@ -0,0 +1,37 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html class="reftest-wait">
+<head>
+ <meta charset="utf-8" />
+ <title>Reference for downscaling moz-icon images (bug 1261964)</title>
+ <script>
+ function beginTest() {
+ var canvas = document.getElementById("canvas");
+ var ctx = canvas.getContext("2d");
+ var image = new Image();
+
+ image.onload = function() {
+ // When image loads: draw it to canvas, scale down the canvas, and
+ // then let the reftest snapshot happen.
+ ctx.drawImage(image, 0, 0);
+ canvas.setAttribute("class", "downscale");
+ document.documentElement.removeAttribute("class");
+ }
+
+ // Kick off the image load:
+ image.src = "moz-icon://bogus-unrecognized-icon?size=100";
+ }
+ </script>
+ <style>
+ body { margin: 0; }
+ .downscale {
+ transform-origin: 0 0;
+ transform: scale(0.9);
+ }
+ </style>
+</head>
+<body onload="beginTest()">
+ <canvas id="canvas" height="100px" width="100px"></canvas>
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-moz-icon-1.html b/image/test/reftest/downscaling/downscale-moz-icon-1.html
new file mode 100644
index 000000000..ba3795127
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-moz-icon-1.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html>
+<head>
+ <meta charset="utf-8" />
+ <title>Testcase for downscaling moz-icon images (bug 1261964)</title>
+ <style>
+ body { margin: 0; }
+ .downscale {
+ transform-origin: 0 0;
+ transform: scale(0.9);
+ }
+ </style>
+</head>
+<body>
+ <img class="downscale" src="moz-icon://bogus-unrecognized-icon?size=100">
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-png.html b/image/test/reftest/downscaling/downscale-png.html
new file mode 100644
index 000000000..4752b2155
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-png.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html reftest-zoom="1.0" class="reftest-wait">
+<head>
+ <script>
+ function snapshot() {
+ document.documentElement.removeAttribute('class');
+ }
+ </script>
+</head>
+<!-- NOTE: Using setTimeout to wait for high-quality downscaled version of
+ image to be ready, because there's nothing better we can do. If we fix
+ Bug 1006883, we can do away with this setTimeout.
+
+ For now, the setTimeout is just here to increase the likelihood that we
+ actually test the high-quality downscaled version of the image. If the
+ setTimeout happens to fire before the high-quality downscaled rendering is
+ ready, then this the test will pass without testing what it's trying to
+ test, which is fine as long as that's rare. -->
+<body style="margin: 0px" onload="setTimeout(snapshot, 50)">
+ <script>
+ var args = location.search.substring(1).split(',');
+ var image = document.createElement('img');
+ image.width = args[0];
+ image.height = args[1];
+ image.src = 'png-' + args[2] + '.png';
+ document.body.appendChild(image);
+ </script>
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-svg-1-ref.html b/image/test/reftest/downscaling/downscale-svg-1-ref.html
new file mode 100644
index 000000000..8935619eb
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-svg-1-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html>
+<body style="margin: 0px">
+ <embed src="black-border-rect.svg" style="display: block">
+ <script>
+ var width = location.search.substring(1).split("&");
+ var embedElem = document.getElementsByTagName('embed')[0];
+ embedElem.style.width = width + 'px';
+ </script>
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-svg-1a.html b/image/test/reftest/downscaling/downscale-svg-1a.html
new file mode 100644
index 000000000..2263cc998
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-svg-1a.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html reftest-zoom="1.0">
+<body style="margin: 0px">
+ <div style="width: 80px; height: 80px; background: url(black-border-rect.svg) no-repeat"></div>
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-svg-1b.html b/image/test/reftest/downscaling/downscale-svg-1b.html
new file mode 100644
index 000000000..9db239c7c
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-svg-1b.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html reftest-zoom="0.9">
+<body style="margin: 0px">
+ <div style="width: 80px; height: 80px; background: url(black-border-rect.svg) no-repeat"></div>
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-svg-1c.html b/image/test/reftest/downscaling/downscale-svg-1c.html
new file mode 100644
index 000000000..f8babf026
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-svg-1c.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html reftest-zoom="0.8">
+<body style="margin: 0px">
+ <div style="width: 80px; height: 80px; background: url(black-border-rect.svg) no-repeat"></div>
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-svg-1d.html b/image/test/reftest/downscaling/downscale-svg-1d.html
new file mode 100644
index 000000000..9a56a51de
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-svg-1d.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html reftest-zoom="0.67">
+<body style="margin: 0px">
+ <div style="width: 80px; height: 80px; background: url(black-border-rect.svg) no-repeat"></div>
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-svg-1e.html b/image/test/reftest/downscaling/downscale-svg-1e.html
new file mode 100644
index 000000000..732ac22c9
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-svg-1e.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html reftest-zoom="0.5">
+<body style="margin: 0px">
+ <div style="width: 80px; height: 80px; background: url(black-border-rect.svg) no-repeat"></div>
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-svg-1f.html b/image/test/reftest/downscaling/downscale-svg-1f.html
new file mode 100644
index 000000000..0124682c7
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-svg-1f.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<html reftest-zoom="0.3">
+<body style="margin: 0px">
+ <div style="width: 80px; height: 80px; background: url(black-border-rect.svg) no-repeat"></div>
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/ff-0RGB.ico b/image/test/reftest/downscaling/ff-0RGB.ico
new file mode 100644
index 000000000..56116b9f6
--- /dev/null
+++ b/image/test/reftest/downscaling/ff-0RGB.ico
Binary files differ
diff --git a/image/test/reftest/downscaling/ff-0RGB.png b/image/test/reftest/downscaling/ff-0RGB.png
new file mode 100644
index 000000000..749ffcdfb
--- /dev/null
+++ b/image/test/reftest/downscaling/ff-0RGB.png
Binary files differ
diff --git a/image/test/reftest/downscaling/ff-ARGB.ico b/image/test/reftest/downscaling/ff-ARGB.ico
new file mode 100644
index 000000000..4681dc649
--- /dev/null
+++ b/image/test/reftest/downscaling/ff-ARGB.ico
Binary files differ
diff --git a/image/test/reftest/downscaling/ff-ARGB.png b/image/test/reftest/downscaling/ff-ARGB.png
new file mode 100644
index 000000000..74ea0e2f3
--- /dev/null
+++ b/image/test/reftest/downscaling/ff-ARGB.png
Binary files differ
diff --git a/image/test/reftest/downscaling/lime-red-256px-bmp-in.ico b/image/test/reftest/downscaling/lime-red-256px-bmp-in.ico
new file mode 100644
index 000000000..b372cba4a
--- /dev/null
+++ b/image/test/reftest/downscaling/lime-red-256px-bmp-in.ico
Binary files differ
diff --git a/image/test/reftest/downscaling/lime-red-256px-png-in.ico b/image/test/reftest/downscaling/lime-red-256px-png-in.ico
new file mode 100644
index 000000000..e8578d293
--- /dev/null
+++ b/image/test/reftest/downscaling/lime-red-256px-png-in.ico
Binary files differ
diff --git a/image/test/reftest/downscaling/lime-red-256px.bmp b/image/test/reftest/downscaling/lime-red-256px.bmp
new file mode 100644
index 000000000..3dc808970
--- /dev/null
+++ b/image/test/reftest/downscaling/lime-red-256px.bmp
Binary files differ
diff --git a/image/test/reftest/downscaling/lime-red-256px.gif b/image/test/reftest/downscaling/lime-red-256px.gif
new file mode 100644
index 000000000..f9f669aa4
--- /dev/null
+++ b/image/test/reftest/downscaling/lime-red-256px.gif
Binary files differ
diff --git a/image/test/reftest/downscaling/lime-red-256px.jpg b/image/test/reftest/downscaling/lime-red-256px.jpg
new file mode 100644
index 000000000..ac8efdf36
--- /dev/null
+++ b/image/test/reftest/downscaling/lime-red-256px.jpg
Binary files differ
diff --git a/image/test/reftest/downscaling/lime-red-256px.png b/image/test/reftest/downscaling/lime-red-256px.png
new file mode 100644
index 000000000..2be2e05a5
--- /dev/null
+++ b/image/test/reftest/downscaling/lime-red-256px.png
Binary files differ
diff --git a/image/test/reftest/downscaling/lime-red-256px.svg b/image/test/reftest/downscaling/lime-red-256px.svg
new file mode 100644
index 000000000..530ae6d6d
--- /dev/null
+++ b/image/test/reftest/downscaling/lime-red-256px.svg
@@ -0,0 +1,5 @@
+<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
+ width="256" height="256">
+ <rect width="50%" height="100%" fill="lime"/>
+ <rect x="50%" width="50%" height="100%" fill="red"/>
+</svg>
diff --git a/image/test/reftest/downscaling/lime-red-32px.png b/image/test/reftest/downscaling/lime-red-32px.png
new file mode 100644
index 000000000..bfa2e7b73
--- /dev/null
+++ b/image/test/reftest/downscaling/lime-red-32px.png
Binary files differ
diff --git a/image/test/reftest/downscaling/png-interlaced.png b/image/test/reftest/downscaling/png-interlaced.png
new file mode 100644
index 000000000..a938d0bd6
--- /dev/null
+++ b/image/test/reftest/downscaling/png-interlaced.png
Binary files differ
diff --git a/image/test/reftest/downscaling/png-normal.png b/image/test/reftest/downscaling/png-normal.png
new file mode 100644
index 000000000..c2780fdd9
--- /dev/null
+++ b/image/test/reftest/downscaling/png-normal.png
Binary files differ
diff --git a/image/test/reftest/downscaling/reftest-stylo.list b/image/test/reftest/downscaling/reftest-stylo.list
new file mode 100644
index 000000000..6feb9080b
--- /dev/null
+++ b/image/test/reftest/downscaling/reftest-stylo.list
@@ -0,0 +1,195 @@
+# DO NOT EDIT! This is a auto-generated temporary list for Stylo testing
+# Reftests for downscaling
+#
+# Downscaling can be a lossy process, so a bit of mismatch is acceptable here,
+# as long as it's barely noticable visually. When necessary, this can be
+# explicitly allowed via 'fuzzy'/'fuzzy-if' annotations.
+#
+# Many of these tests check primarily that we don't lose rows or columns of
+# pixels when downscaling by making sure that the result isn't too similar to
+# about:blank. A small amount of fuzziness is used to ensure that the tests
+# don't pass because of very slight deviations; passing tests should be
+# substantially different from about:blank. This fuzziness should *not* be
+# removed as doing so would make the tests pass in situations where they
+# shouldn't.
+#
+# IMPORTANT: For robustness, each test should be listed *twice* in this
+# manifest -- once with the high quality downscaling pref disabled, and once
+# with this pref enabled. The pref is set via "default-preferences", so
+# simply appending a new test to the lists below each of those lines should be
+# sufficient.
+#
+# Also note that Mac OS X has its own system-level downscaling algorithm, so
+# tests here may need Mac-specific "fuzzy-if(cocoaWidget,...)" annotations.
+# Similarly, modern versions of Windows have slightly different downscaling
+# behavior than other platforms, and may require "fuzzy-if(winWidget,...)".
+
+
+# RUN TESTS NOT AFFECTED BY DOWNSCALE-DURING-DECODE:
+# #
+fails fuzzy-if(skiaContent,14,416) == downscale-svg-1a.html downscale-svg-1a.html
+== downscale-svg-1b.html downscale-svg-1b.html
+fails fuzzy-if(skiaContent,8,292) == downscale-svg-1c.html downscale-svg-1c.html
+fuzzy-if(B2G,255,207) == downscale-svg-1d.html downscale-svg-1d.html
+# right side is 1 pixel off for B2G, probably regression from 974242
+fails fuzzy-if(skiaContent,110,181) == downscale-svg-1e.html downscale-svg-1e.html
+fails fuzzy-if(skiaContent,142,77) == downscale-svg-1f.html downscale-svg-1f.html
+
+# RUN TESTS WITH DOWNSCALE-DURING-DECODE DISABLED:
+# #
+default-preferences pref(image.downscale-during-decode.enabled,false)
+
+fuzzy-if(winWidget,16,20) fuzzy-if(cocoaWidget,106,31) == downscale-1.html downscale-1.html
+
+== downscale-2a.html?203,52,left downscale-2a.html?203,52,left
+== downscale-2b.html?203,52,left downscale-2b.html?203,52,left
+skip == downscale-2c.html?203,52,left downscale-2c.html?203,52,left
+== downscale-2d.html?203,52,left downscale-2d.html?203,52,left
+== downscale-2e.html?203,52,left downscale-2e.html?203,52,left
+
+== downscale-2a.html?205,53,left downscale-2a.html?205,53,left
+== downscale-2b.html?205,53,left downscale-2b.html?205,53,left
+== downscale-2c.html?205,53,left downscale-2c.html?205,53,left
+skip == downscale-2d.html?205,53,left downscale-2d.html?205,53,left
+== downscale-2e.html?205,53,left downscale-2e.html?205,53,left
+
+== downscale-2a.html?203,52,right downscale-2a.html?203,52,right
+== downscale-2b.html?203,52,right downscale-2b.html?203,52,right
+== downscale-2c.html?203,52,right downscale-2c.html?203,52,right
+== downscale-2d.html?203,52,right downscale-2d.html?203,52,right
+== downscale-2e.html?203,52,right downscale-2e.html?203,52,right
+
+== downscale-2a.html?205,53,right downscale-2a.html?205,53,right
+== downscale-2b.html?205,53,right downscale-2b.html?205,53,right
+== downscale-2c.html?205,53,right downscale-2c.html?205,53,right
+== downscale-2d.html?205,53,right downscale-2d.html?205,53,right
+== downscale-2e.html?205,53,right downscale-2e.html?205,53,right
+
+== downscale-2a.html?203,52,top downscale-2a.html?203,52,top
+== downscale-2b.html?203,52,top downscale-2b.html?203,52,top
+== downscale-2c.html?203,52,top downscale-2c.html?203,52,top
+skip == downscale-2d.html?203,52,top downscale-2d.html?203,52,top
+== downscale-2e.html?203,52,top downscale-2e.html?203,52,top
+
+== downscale-2a.html?205,53,top downscale-2a.html?205,53,top
+== downscale-2b.html?205,53,top downscale-2b.html?205,53,top
+== downscale-2c.html?205,53,top downscale-2c.html?205,53,top
+== downscale-2d.html?205,53,top downscale-2d.html?205,53,top
+== downscale-2e.html?205,53,top downscale-2e.html?205,53,top
+
+== downscale-2a.html?203,52,bottom downscale-2a.html?203,52,bottom
+== downscale-2b.html?203,52,bottom downscale-2b.html?203,52,bottom
+== downscale-2c.html?203,52,bottom downscale-2c.html?203,52,bottom
+== downscale-2d.html?203,52,bottom downscale-2d.html?203,52,bottom
+skip == downscale-2e.html?203,52,bottom downscale-2e.html?203,52,bottom
+
+== downscale-2a.html?205,53,bottom downscale-2a.html?205,53,bottom
+== downscale-2b.html?205,53,bottom downscale-2b.html?205,53,bottom
+== downscale-2c.html?205,53,bottom downscale-2c.html?205,53,bottom
+== downscale-2d.html?205,53,bottom downscale-2d.html?205,53,bottom
+fails-if(OSX>=1008&&!skiaContent) == downscale-2e.html?205,53,bottom downscale-2e.html?205,53,bottom
+
+== downscale-moz-icon-1.html downscale-moz-icon-1.html
+
+== downscale-png.html?16,16,interlaced downscale-png.html?16,16,interlaced
+== downscale-png.html?24,24,interlaced downscale-png.html?24,24,interlaced
+
+# Non-transparent and transparent ICO images
+random == downscale-16px.html?ff-0RGB.ico downscale-16px.html?ff-0RGB.ico
+random == downscale-16px.html?ff-ARGB.ico downscale-16px.html?ff-ARGB.ico
+
+# Upside-down (negative height) BMP
+random == downscale-8px.html?top-to-bottom-16x16-24bpp.bmp downscale-8px.html?top-to-bottom-16x16-24bpp.bmp
+
+# Test downscaling from all supported formats from 256 to 32.
+== downscale-32px.html?.bmp downscale-32px.html?.bmp
+== downscale-32px.html?.gif downscale-32px.html?.gif
+== downscale-32px.html?.jpg downscale-32px.html?.jpg
+== downscale-32px.html?.png downscale-32px.html?.png
+== downscale-32px.html?.svg downscale-32px.html?.svg
+== downscale-32px.html?-bmp-in.ico downscale-32px.html?-bmp-in.ico
+== downscale-32px.html?-png-in.ico downscale-32px.html?-png-in.ico
+
+# RUN TESTS WITH DOWNSCALE-DURING-DECODE ENABLED:
+# #
+default-preferences pref(image.downscale-during-decode.enabled,true)
+
+fuzzy-if(d2d,31,147) == downscale-1.html downscale-1.html
+# intermittently 147 pixels on win7 accelerated only (not win8)
+
+== downscale-2a.html?203,52,left downscale-2a.html?203,52,left
+== downscale-2b.html?203,52,left downscale-2b.html?203,52,left
+skip == downscale-2c.html?203,52,left downscale-2c.html?203,52,left
+== downscale-2d.html?203,52,left downscale-2d.html?203,52,left
+== downscale-2e.html?203,52,left downscale-2e.html?203,52,left
+== downscale-2f.html?203,52,left downscale-2f.html?203,52,left
+
+== downscale-2a.html?205,53,left downscale-2a.html?205,53,left
+== downscale-2b.html?205,53,left downscale-2b.html?205,53,left
+== downscale-2c.html?205,53,left downscale-2c.html?205,53,left
+skip == downscale-2d.html?205,53,left downscale-2d.html?205,53,left
+== downscale-2e.html?205,53,left downscale-2e.html?205,53,left
+== downscale-2f.html?205,53,left downscale-2f.html?205,53,left
+
+== downscale-2a.html?203,52,right downscale-2a.html?203,52,right
+== downscale-2b.html?203,52,right downscale-2b.html?203,52,right
+== downscale-2c.html?203,52,right downscale-2c.html?203,52,right
+== downscale-2d.html?203,52,right downscale-2d.html?203,52,right
+== downscale-2e.html?203,52,right downscale-2e.html?203,52,right
+== downscale-2f.html?203,52,right downscale-2f.html?203,52,right
+
+== downscale-2a.html?205,53,right downscale-2a.html?205,53,right
+== downscale-2b.html?205,53,right downscale-2b.html?205,53,right
+== downscale-2c.html?205,53,right downscale-2c.html?205,53,right
+== downscale-2d.html?205,53,right downscale-2d.html?205,53,right
+== downscale-2e.html?205,53,right downscale-2e.html?205,53,right
+== downscale-2f.html?205,53,right downscale-2f.html?205,53,right
+
+== downscale-2a.html?203,52,top downscale-2a.html?203,52,top
+== downscale-2b.html?203,52,top downscale-2b.html?203,52,top
+== downscale-2c.html?203,52,top downscale-2c.html?203,52,top
+skip == downscale-2d.html?203,52,top downscale-2d.html?203,52,top
+== downscale-2e.html?203,52,top downscale-2e.html?203,52,top
+== downscale-2f.html?203,52,top downscale-2f.html?203,52,top
+
+== downscale-2a.html?205,53,top downscale-2a.html?205,53,top
+== downscale-2b.html?205,53,top downscale-2b.html?205,53,top
+== downscale-2c.html?205,53,top downscale-2c.html?205,53,top
+== downscale-2d.html?205,53,top downscale-2d.html?205,53,top
+== downscale-2e.html?205,53,top downscale-2e.html?205,53,top
+== downscale-2f.html?205,53,top downscale-2f.html?205,53,top
+
+== downscale-2a.html?203,52,bottom downscale-2a.html?203,52,bottom
+== downscale-2b.html?203,52,bottom downscale-2b.html?203,52,bottom
+== downscale-2c.html?203,52,bottom downscale-2c.html?203,52,bottom
+== downscale-2d.html?203,52,bottom downscale-2d.html?203,52,bottom
+skip == downscale-2e.html?203,52,bottom downscale-2e.html?203,52,bottom
+== downscale-2f.html?203,52,bottom downscale-2f.html?203,52,bottom
+
+== downscale-2a.html?205,53,bottom downscale-2a.html?205,53,bottom
+== downscale-2b.html?205,53,bottom downscale-2b.html?205,53,bottom
+== downscale-2c.html?205,53,bottom downscale-2c.html?205,53,bottom
+== downscale-2d.html?205,53,bottom downscale-2d.html?205,53,bottom
+== downscale-2e.html?205,53,bottom downscale-2e.html?205,53,bottom
+== downscale-2f.html?205,53,bottom downscale-2f.html?205,53,bottom
+
+== downscale-moz-icon-1.html downscale-moz-icon-1.html
+
+== downscale-png.html?16,16,interlaced downscale-png.html?16,16,interlaced
+== downscale-png.html?24,24,interlaced downscale-png.html?24,24,interlaced
+
+# Non-transparent and transparent ICO images
+random == downscale-16px.html?ff-0RGB.ico downscale-16px.html?ff-0RGB.ico
+random == downscale-16px.html?ff-ARGB.ico downscale-16px.html?ff-ARGB.ico
+
+# Upside-down (negative height) BMP
+random == downscale-8px.html?top-to-bottom-16x16-24bpp.bmp downscale-8px.html?top-to-bottom-16x16-24bpp.bmp
+
+# Test downscaling from all supported formats from 256 to 32.
+== downscale-32px.html?.bmp downscale-32px.html?.bmp
+== downscale-32px.html?.gif downscale-32px.html?.gif
+== downscale-32px.html?.jpg downscale-32px.html?.jpg
+== downscale-32px.html?.png downscale-32px.html?.png
+== downscale-32px.html?.svg downscale-32px.html?.svg
+== downscale-32px.html?-bmp-in.ico downscale-32px.html?-bmp-in.ico
+== downscale-32px.html?-png-in.ico downscale-32px.html?-png-in.ico
diff --git a/image/test/reftest/downscaling/reftest.list b/image/test/reftest/downscaling/reftest.list
new file mode 100644
index 000000000..300edd81b
--- /dev/null
+++ b/image/test/reftest/downscaling/reftest.list
@@ -0,0 +1,193 @@
+# Reftests for downscaling
+#
+# Downscaling can be a lossy process, so a bit of mismatch is acceptable here,
+# as long as it's barely noticable visually. When necessary, this can be
+# explicitly allowed via 'fuzzy'/'fuzzy-if' annotations.
+#
+# Many of these tests check primarily that we don't lose rows or columns of
+# pixels when downscaling by making sure that the result isn't too similar to
+# about:blank. A small amount of fuzziness is used to ensure that the tests
+# don't pass because of very slight deviations; passing tests should be
+# substantially different from about:blank. This fuzziness should *not* be
+# removed as doing so would make the tests pass in situations where they
+# shouldn't.
+#
+# IMPORTANT: For robustness, each test should be listed *twice* in this
+# manifest -- once with the high quality downscaling pref disabled, and once
+# with this pref enabled. The pref is set via "default-preferences", so
+# simply appending a new test to the lists below each of those lines should be
+# sufficient.
+#
+# Also note that Mac OS X has its own system-level downscaling algorithm, so
+# tests here may need Mac-specific "fuzzy-if(cocoaWidget,...)" annotations.
+# Similarly, modern versions of Windows have slightly different downscaling
+# behavior than other platforms, and may require "fuzzy-if(winWidget,...)".
+
+
+# RUN TESTS NOT AFFECTED BY DOWNSCALE-DURING-DECODE:
+# ==================================================
+fuzzy-if(skiaContent,14,416) == downscale-svg-1a.html downscale-svg-1-ref.html?80
+fuzzy(80,468) == downscale-svg-1b.html downscale-svg-1-ref.html?72
+fuzzy-if(skiaContent,8,292) == downscale-svg-1c.html downscale-svg-1-ref.html?64
+fuzzy(17,208) == downscale-svg-1d.html downscale-svg-1-ref.html?53
+fuzzy(78,216) fuzzy-if(skiaContent,110,181) == downscale-svg-1e.html downscale-svg-1-ref.html?40
+fuzzy(51,90) fuzzy-if(skiaContent,142,77) == downscale-svg-1f.html downscale-svg-1-ref.html?24
+
+# RUN TESTS WITH DOWNSCALE-DURING-DECODE DISABLED:
+# ================================================
+default-preferences pref(image.downscale-during-decode.enabled,false)
+
+fuzzy-if(winWidget,16,20) fuzzy-if(cocoaWidget,106,31) == downscale-1.html downscale-1-ref.html
+
+fuzzy(20,999) != downscale-2a.html?203,52,left about:blank
+fuzzy(20,999) != downscale-2b.html?203,52,left about:blank
+fuzzy(20,999) != downscale-2c.html?203,52,left about:blank
+fuzzy(20,999) != downscale-2d.html?203,52,left about:blank
+fuzzy(20,999) != downscale-2e.html?203,52,left about:blank
+
+fuzzy(20,999) != downscale-2a.html?205,53,left about:blank
+fuzzy(20,999) != downscale-2b.html?205,53,left about:blank
+fuzzy(20,999) != downscale-2c.html?205,53,left about:blank
+fuzzy(20,999) != downscale-2d.html?205,53,left about:blank
+fuzzy(20,999) != downscale-2e.html?205,53,left about:blank
+
+fuzzy(20,999) != downscale-2a.html?203,52,right about:blank
+fuzzy(20,999) != downscale-2b.html?203,52,right about:blank
+fuzzy(20,999) != downscale-2c.html?203,52,right about:blank
+fuzzy(20,999) != downscale-2d.html?203,52,right about:blank
+fuzzy(20,999) != downscale-2e.html?203,52,right about:blank
+
+fuzzy(20,999) != downscale-2a.html?205,53,right about:blank
+fuzzy(20,999) != downscale-2b.html?205,53,right about:blank
+fuzzy(20,999) != downscale-2c.html?205,53,right about:blank
+fuzzy(20,999) != downscale-2d.html?205,53,right about:blank
+fuzzy(20,999) != downscale-2e.html?205,53,right about:blank
+
+fuzzy(20,999) != downscale-2a.html?203,52,top about:blank
+fuzzy(20,999) != downscale-2b.html?203,52,top about:blank
+fuzzy(20,999) != downscale-2c.html?203,52,top about:blank
+fuzzy(20,999) != downscale-2d.html?203,52,top about:blank
+fuzzy(20,999) != downscale-2e.html?203,52,top about:blank
+
+fuzzy(20,999) != downscale-2a.html?205,53,top about:blank
+fuzzy(20,999) != downscale-2b.html?205,53,top about:blank
+fuzzy(20,999) != downscale-2c.html?205,53,top about:blank
+fuzzy(20,999) != downscale-2d.html?205,53,top about:blank
+fuzzy(20,999) != downscale-2e.html?205,53,top about:blank
+
+fuzzy(20,999) != downscale-2a.html?203,52,bottom about:blank
+fuzzy(20,999) != downscale-2b.html?203,52,bottom about:blank
+fuzzy(20,999) != downscale-2c.html?203,52,bottom about:blank
+fuzzy(20,999) != downscale-2d.html?203,52,bottom about:blank
+fuzzy(20,999) != downscale-2e.html?203,52,bottom about:blank
+
+fuzzy(20,999) != downscale-2a.html?205,53,bottom about:blank
+fuzzy(20,999) != downscale-2b.html?205,53,bottom about:blank
+fuzzy(20,999) != downscale-2c.html?205,53,bottom about:blank
+fuzzy(20,999) != downscale-2d.html?205,53,bottom about:blank
+fuzzy(20,999) fails-if(OSX>=1008&&!skiaContent) != downscale-2e.html?205,53,bottom about:blank
+
+fuzzy(63,3391) == downscale-moz-icon-1.html downscale-moz-icon-1-ref.html
+
+== downscale-png.html?16,16,interlaced downscale-png.html?16,16,normal
+== downscale-png.html?24,24,interlaced downscale-png.html?24,24,normal
+
+# Non-transparent and transparent ICO images
+== downscale-16px.html?ff-0RGB.ico downscale-16px.html?ff-0RGB.png
+fuzzy(1,1) == downscale-16px.html?ff-ARGB.ico downscale-16px.html?ff-ARGB.png
+
+# Upside-down (negative height) BMP
+== downscale-8px.html?top-to-bottom-16x16-24bpp.bmp downscale-8px.html?bmp-size-16x16-24bpp.png
+
+# Test downscaling from all supported formats from 256 to 32.
+== downscale-32px.html?.bmp downscale-32px-ref.html
+== downscale-32px.html?.gif downscale-32px-ref.html
+fuzzy(1,1024) == downscale-32px.html?.jpg downscale-32px-ref.html
+== downscale-32px.html?.png downscale-32px-ref.html
+== downscale-32px.html?.svg downscale-32px-ref.html
+== downscale-32px.html?-bmp-in.ico downscale-32px-ref.html
+== downscale-32px.html?-png-in.ico downscale-32px-ref.html
+
+# RUN TESTS WITH DOWNSCALE-DURING-DECODE ENABLED:
+# ===============================================
+default-preferences pref(image.downscale-during-decode.enabled,true)
+
+fuzzy(31,127) fuzzy-if(d2d,31,147) == downscale-1.html downscale-1-ref.html # intermittently 147 pixels on win7 accelerated only (not win8)
+
+fuzzy(20,999) != downscale-2a.html?203,52,left about:blank
+fuzzy(20,999) != downscale-2b.html?203,52,left about:blank
+fuzzy(20,999) != downscale-2c.html?203,52,left about:blank
+fuzzy(20,999) != downscale-2d.html?203,52,left about:blank
+fuzzy(20,999) != downscale-2e.html?203,52,left about:blank
+fuzzy(20,999) != downscale-2f.html?203,52,left about:blank
+
+fuzzy(20,999) != downscale-2a.html?205,53,left about:blank
+fuzzy(20,999) != downscale-2b.html?205,53,left about:blank
+fuzzy(20,999) != downscale-2c.html?205,53,left about:blank
+fuzzy(20,999) != downscale-2d.html?205,53,left about:blank
+fuzzy(20,999) != downscale-2e.html?205,53,left about:blank
+fuzzy(20,999) != downscale-2f.html?205,53,left about:blank
+
+fuzzy(20,999) != downscale-2a.html?203,52,right about:blank
+fuzzy(20,999) != downscale-2b.html?203,52,right about:blank
+fuzzy(20,999) != downscale-2c.html?203,52,right about:blank
+fuzzy(20,999) != downscale-2d.html?203,52,right about:blank
+fuzzy(20,999) != downscale-2e.html?203,52,right about:blank
+fuzzy(20,999) != downscale-2f.html?203,52,right about:blank
+
+fuzzy(20,999) != downscale-2a.html?205,53,right about:blank
+fuzzy(20,999) != downscale-2b.html?205,53,right about:blank
+fuzzy(20,999) != downscale-2c.html?205,53,right about:blank
+fuzzy(20,999) != downscale-2d.html?205,53,right about:blank
+fuzzy(20,999) != downscale-2e.html?205,53,right about:blank
+fuzzy(20,999) != downscale-2f.html?205,53,right about:blank
+
+fuzzy(20,999) != downscale-2a.html?203,52,top about:blank
+fuzzy(20,999) != downscale-2b.html?203,52,top about:blank
+fuzzy(20,999) != downscale-2c.html?203,52,top about:blank
+fuzzy(20,999) != downscale-2d.html?203,52,top about:blank
+fuzzy(20,999) != downscale-2e.html?203,52,top about:blank
+fuzzy(20,999) != downscale-2f.html?203,52,top about:blank
+
+fuzzy(20,999) != downscale-2a.html?205,53,top about:blank
+fuzzy(20,999) != downscale-2b.html?205,53,top about:blank
+fuzzy(20,999) != downscale-2c.html?205,53,top about:blank
+fuzzy(20,999) != downscale-2d.html?205,53,top about:blank
+fuzzy(20,999) != downscale-2e.html?205,53,top about:blank
+fuzzy(20,999) != downscale-2f.html?205,53,top about:blank
+
+fuzzy(20,999) != downscale-2a.html?203,52,bottom about:blank
+fuzzy(20,999) != downscale-2b.html?203,52,bottom about:blank
+fuzzy(20,999) != downscale-2c.html?203,52,bottom about:blank
+fuzzy(20,999) != downscale-2d.html?203,52,bottom about:blank
+fuzzy(20,999) != downscale-2e.html?203,52,bottom about:blank
+fuzzy(20,999) != downscale-2f.html?203,52,bottom about:blank
+
+fuzzy(20,999) != downscale-2a.html?205,53,bottom about:blank
+fuzzy(20,999) != downscale-2b.html?205,53,bottom about:blank
+fuzzy(20,999) != downscale-2c.html?205,53,bottom about:blank
+fuzzy(20,999) != downscale-2d.html?205,53,bottom about:blank
+fuzzy(20,999) != downscale-2e.html?205,53,bottom about:blank
+fuzzy(20,999) != downscale-2f.html?205,53,bottom about:blank
+
+# Skip on WinXP with skia content
+fuzzy(71,4439) fails-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == downscale-moz-icon-1.html downscale-moz-icon-1-ref.html
+
+== downscale-png.html?16,16,interlaced downscale-png.html?16,16,normal
+== downscale-png.html?24,24,interlaced downscale-png.html?24,24,normal
+
+# Non-transparent and transparent ICO images
+fuzzy(1,3) == downscale-16px.html?ff-0RGB.ico downscale-16px.html?ff-0RGB.png
+fuzzy(3,32) == downscale-16px.html?ff-ARGB.ico downscale-16px.html?ff-ARGB.png
+
+# Upside-down (negative height) BMP
+== downscale-8px.html?top-to-bottom-16x16-24bpp.bmp downscale-8px.html?bmp-size-16x16-24bpp.png
+
+# Test downscaling from all supported formats from 256 to 32.
+fuzzy(18,128) == downscale-32px.html?.bmp downscale-32px-ref.html
+fuzzy(18,128) == downscale-32px.html?.gif downscale-32px-ref.html
+fuzzy(19,992) == downscale-32px.html?.jpg downscale-32px-ref.html
+fuzzy(18,128) == downscale-32px.html?.png downscale-32px-ref.html
+== downscale-32px.html?.svg downscale-32px-ref.html
+fuzzy(18,128) == downscale-32px.html?-bmp-in.ico downscale-32px-ref.html
+fuzzy(18,128) == downscale-32px.html?-png-in.ico downscale-32px-ref.html
diff --git a/image/test/reftest/downscaling/top-to-bottom-16x16-24bpp.bmp b/image/test/reftest/downscaling/top-to-bottom-16x16-24bpp.bmp
new file mode 100644
index 000000000..bd18f85d4
--- /dev/null
+++ b/image/test/reftest/downscaling/top-to-bottom-16x16-24bpp.bmp
Binary files differ