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/100x100.gifbin0 -> 956 bytes
-rw-r--r--image/test/reftest/downscaling/100x100.jpgbin0 -> 917 bytes
-rw-r--r--image/test/reftest/downscaling/100x100.pngbin0 -> 338 bytes
-rw-r--r--image/test/reftest/downscaling/100x32768.gifbin0 -> 4299 bytes
-rw-r--r--image/test/reftest/downscaling/100x32768.jpgbin0 -> 22041 bytes
-rw-r--r--image/test/reftest/downscaling/100x32768.pngbin0 -> 70926 bytes
-rw-r--r--image/test/reftest/downscaling/1404366-1.html14
-rw-r--r--image/test/reftest/downscaling/1404366-1.icobin0 -> 4287 bytes
-rw-r--r--image/test/reftest/downscaling/1421191-1.html20
-rw-r--r--image/test/reftest/downscaling/1421191-1.pngbin0 -> 92182 bytes
-rw-r--r--image/test/reftest/downscaling/32768x100.gifbin0 -> 4299 bytes
-rw-r--r--image/test/reftest/downscaling/32768x100.jpgbin0 -> 58065 bytes
-rw-r--r--image/test/reftest/downscaling/32768x100.pngbin0 -> 13172 bytes
-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.html41
-rw-r--r--image/test/reftest/downscaling/downscale-moz-icon-1.html19
-rw-r--r--image/test/reftest/downscaling/downscale-orient-ref.html24
-rw-r--r--image/test/reftest/downscaling/downscale-orient-ref.pngbin0 -> 146 bytes
-rw-r--r--image/test/reftest/downscaling/downscale-orient.html24
-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/huge-1.html9
-rw-r--r--image/test/reftest/downscaling/image-pre-rotated-90-deg.jpgbin0 -> 6914 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.list217
-rw-r--r--image/test/reftest/downscaling/top-to-bottom-16x16-24bpp.bmpbin0 -> 822 bytes
64 files changed, 780 insertions, 0 deletions
diff --git a/image/test/reftest/downscaling/100x100.gif b/image/test/reftest/downscaling/100x100.gif
new file mode 100644
index 0000000000..4ff770d368
--- /dev/null
+++ b/image/test/reftest/downscaling/100x100.gif
Binary files differ
diff --git a/image/test/reftest/downscaling/100x100.jpg b/image/test/reftest/downscaling/100x100.jpg
new file mode 100644
index 0000000000..cea2c240d8
--- /dev/null
+++ b/image/test/reftest/downscaling/100x100.jpg
Binary files differ
diff --git a/image/test/reftest/downscaling/100x100.png b/image/test/reftest/downscaling/100x100.png
new file mode 100644
index 0000000000..eb3cb08e1e
--- /dev/null
+++ b/image/test/reftest/downscaling/100x100.png
Binary files differ
diff --git a/image/test/reftest/downscaling/100x32768.gif b/image/test/reftest/downscaling/100x32768.gif
new file mode 100644
index 0000000000..f55a2f482f
--- /dev/null
+++ b/image/test/reftest/downscaling/100x32768.gif
Binary files differ
diff --git a/image/test/reftest/downscaling/100x32768.jpg b/image/test/reftest/downscaling/100x32768.jpg
new file mode 100644
index 0000000000..e89acc0334
--- /dev/null
+++ b/image/test/reftest/downscaling/100x32768.jpg
Binary files differ
diff --git a/image/test/reftest/downscaling/100x32768.png b/image/test/reftest/downscaling/100x32768.png
new file mode 100644
index 0000000000..7cd5509cf2
--- /dev/null
+++ b/image/test/reftest/downscaling/100x32768.png
Binary files differ
diff --git a/image/test/reftest/downscaling/1404366-1.html b/image/test/reftest/downscaling/1404366-1.html
new file mode 100644
index 0000000000..165cc7f934
--- /dev/null
+++ b/image/test/reftest/downscaling/1404366-1.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<body>
+<!--
+ 1404366-1.ico is an ico file that contains a 32x32 0RGB (0 for all alpha values) bmp
+ where the color values are all white. It also contains a mask. The mask alternates
+ one pixel fully transparent, one pixel fully opaque. The result of drawing this on
+ a white background should be white. This is testing that we premultiply the color
+ values by the alpha derived from the mark when downscaling. If we do not skia will
+ get confused and likely draw non white pixels.
+-->
+<img src="1404366-1.ico" style="width: 12px; height: 12px;">
+</body>
+</html> \ No newline at end of file
diff --git a/image/test/reftest/downscaling/1404366-1.ico b/image/test/reftest/downscaling/1404366-1.ico
new file mode 100644
index 0000000000..51c020b069
--- /dev/null
+++ b/image/test/reftest/downscaling/1404366-1.ico
Binary files differ
diff --git a/image/test/reftest/downscaling/1421191-1.html b/image/test/reftest/downscaling/1421191-1.html
new file mode 100644
index 0000000000..b8146a2371
--- /dev/null
+++ b/image/test/reftest/downscaling/1421191-1.html
@@ -0,0 +1,20 @@
+<html reftest-zoom="1.6">
+<head>
+<style>
+#xx {
+background-image: url("1421191-1.png");
+background-position: -61px -797px;
+background-position-x: -61px;
+background-position-y: -797px;
+background-repeat: no-repeat;
+background-size: 82px auto;
+display: block;
+height: 24px;
+width: 22px;
+}
+</style>
+</head>
+<body>
+<span id="xx"></span>
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/1421191-1.png b/image/test/reftest/downscaling/1421191-1.png
new file mode 100644
index 0000000000..e9b756a79e
--- /dev/null
+++ b/image/test/reftest/downscaling/1421191-1.png
Binary files differ
diff --git a/image/test/reftest/downscaling/32768x100.gif b/image/test/reftest/downscaling/32768x100.gif
new file mode 100644
index 0000000000..2194d13efc
--- /dev/null
+++ b/image/test/reftest/downscaling/32768x100.gif
Binary files differ
diff --git a/image/test/reftest/downscaling/32768x100.jpg b/image/test/reftest/downscaling/32768x100.jpg
new file mode 100644
index 0000000000..807b9adb27
--- /dev/null
+++ b/image/test/reftest/downscaling/32768x100.jpg
Binary files differ
diff --git a/image/test/reftest/downscaling/32768x100.png b/image/test/reftest/downscaling/32768x100.png
new file mode 100644
index 0000000000..3fe4fe1ce5
--- /dev/null
+++ b/image/test/reftest/downscaling/32768x100.png
Binary files differ
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 0000000000..efa7ce2dce
--- /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 0000000000..11bc67e983
--- /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 0000000000..0fa01a0a63
--- /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 0000000000..081c52d5bc
--- /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 0000000000..fc6e69e02a
--- /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 0000000000..c04869e728
--- /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 0000000000..5e018590c3
--- /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 0000000000..63ec56ef7c
--- /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 0000000000..588e6b78df
--- /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 0000000000..a9629ef855
--- /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 0000000000..06d6db2bf6
--- /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>
+<!-- non-empty alt to avoid the broken image icon -->
+<img width="16px" height="16px" id="image1" alt=" ">
+<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].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 0000000000..fac11ccee5
--- /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 0000000000..af7ecbff33
--- /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 0000000000..18f70456b1
--- /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 0000000000..8d9547b73e
--- /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 0000000000..c3d0d771f3
--- /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 0000000000..42cfad1f57
--- /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 0000000000..1caf3c73bf
--- /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 0000000000..f5fce324d9
--- /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 0000000000..c0586a3657
--- /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>
+<!-- non-empty alt to avoid the broken image icon -->
+<img width="8px" id="image1" alt=" ">
+<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].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 0000000000..a7dd5ab8aa
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-moz-icon-1-ref.html
@@ -0,0 +1,41 @@
+<!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 image = new Image();
+
+ image.onload = function() {
+ // When image loads: draw it to canvas, scale down the canvas, and
+ // then let the reftest snapshot happen.
+ // The image can be larger than the requested size, so we resize the
+ // canvas to match it.
+ canvas.width = image.width;
+ canvas.height = image.height;
+ var ctx = canvas.getContext("2d");
+ 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"></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 0000000000..ba37951274
--- /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-orient-ref.html b/image/test/reftest/downscaling/downscale-orient-ref.html
new file mode 100644
index 0000000000..e32141868f
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-orient-ref.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="image-pre-rotated-90-deg.jpg" style="width: 50px; height: 25px;">
+</body>
+</html>
diff --git a/image/test/reftest/downscaling/downscale-orient-ref.png b/image/test/reftest/downscaling/downscale-orient-ref.png
new file mode 100644
index 0000000000..0db684e0d7
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-orient-ref.png
Binary files differ
diff --git a/image/test/reftest/downscaling/downscale-orient.html b/image/test/reftest/downscaling/downscale-orient.html
new file mode 100644
index 0000000000..11b849b27e
--- /dev/null
+++ b/image/test/reftest/downscaling/downscale-orient.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="../../../../layout/reftests/image/image-exif-90-deg.jpg" style="width: 50px; height: 25px;">
+</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 0000000000..4752b2155a
--- /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 0000000000..8935619ebd
--- /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 0000000000..2263cc9982
--- /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 0000000000..9db239c7cd
--- /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 0000000000..f8babf0267
--- /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 0000000000..9a56a51de0
--- /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 0000000000..732ac22c96
--- /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 0000000000..0124682c70
--- /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 0000000000..56116b9f6a
--- /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 0000000000..749ffcdfb3
--- /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 0000000000..4681dc6495
--- /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 0000000000..74ea0e2f39
--- /dev/null
+++ b/image/test/reftest/downscaling/ff-ARGB.png
Binary files differ
diff --git a/image/test/reftest/downscaling/huge-1.html b/image/test/reftest/downscaling/huge-1.html
new file mode 100644
index 0000000000..6685600086
--- /dev/null
+++ b/image/test/reftest/downscaling/huge-1.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html><meta charset=utf-8>
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<body style="margin: 0px">
+ <script>
+ let args = location.search.substring(1).split(',');
+ document.write(`<img src="${args[0]}" width="${args[1]}" height="${args[2]}">`);
+ </script>
+</body>
diff --git a/image/test/reftest/downscaling/image-pre-rotated-90-deg.jpg b/image/test/reftest/downscaling/image-pre-rotated-90-deg.jpg
new file mode 100644
index 0000000000..b8817f9bf5
--- /dev/null
+++ b/image/test/reftest/downscaling/image-pre-rotated-90-deg.jpg
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 0000000000..b372cba4a2
--- /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 0000000000..e8578d2934
--- /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 0000000000..3dc808970f
--- /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 0000000000..f9f669aa4d
--- /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 0000000000..ac8efdf360
--- /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 0000000000..2be2e05a59
--- /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 0000000000..530ae6d6d5
--- /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 0000000000..bfa2e7b737
--- /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 0000000000..a938d0bd6a
--- /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 0000000000..c2780fdd93
--- /dev/null
+++ b/image/test/reftest/downscaling/png-normal.png
Binary files differ
diff --git a/image/test/reftest/downscaling/reftest.list b/image/test/reftest/downscaling/reftest.list
new file mode 100644
index 0000000000..f01780ffaa
--- /dev/null
+++ b/image/test/reftest/downscaling/reftest.list
@@ -0,0 +1,217 @@
+# Reftests for downscaling
+#
+# Downscaling can be a lossy process, so a bit of mismatch is acceptable here,
+# as long as it's barely noticeable 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 "defaults", 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(0-14,0-416) == downscale-svg-1a.html downscale-svg-1-ref.html?80
+fuzzy(65-65,468-480) == downscale-svg-1b.html downscale-svg-1-ref.html?72
+fuzzy(0-8,0-292) == downscale-svg-1c.html downscale-svg-1-ref.html?64
+fuzzy(7-7,208-208) == downscale-svg-1d.html downscale-svg-1-ref.html?53
+fuzzy(54-55,178-178) == downscale-svg-1e.html downscale-svg-1-ref.html?40
+fuzzy(64-64,31-31) == downscale-svg-1f.html downscale-svg-1-ref.html?24
+
+# RUN TESTS WITH DOWNSCALE-DURING-DECODE DISABLED:
+# ================================================
+defaults pref(image.downscale-during-decode.enabled,false)
+
+fuzzy-if(winWidget,0-16,0-20) fuzzy-if(cocoaWidget,0-106,0-31) == downscale-1.html downscale-1-ref.html
+
+fuzzy(0-20,0-999) != downscale-2a.html?203,52,left about:blank
+fuzzy(0-20,0-999) != downscale-2b.html?203,52,left about:blank
+fuzzy(0-20,0-999) != downscale-2c.html?203,52,left about:blank
+fuzzy(0-20,0-999) != downscale-2d.html?203,52,left about:blank
+fuzzy(0-20,0-999) != downscale-2e.html?203,52,left about:blank
+
+fuzzy(0-20,0-999) != downscale-2a.html?205,53,left about:blank
+fuzzy(0-20,0-999) != downscale-2b.html?205,53,left about:blank
+fuzzy(0-20,0-999) != downscale-2c.html?205,53,left about:blank
+fuzzy(0-20,0-999) != downscale-2d.html?205,53,left about:blank
+fuzzy(0-20,0-999) != downscale-2e.html?205,53,left about:blank
+
+fuzzy(0-20,0-999) != downscale-2a.html?203,52,right about:blank
+fuzzy(0-20,0-999) != downscale-2b.html?203,52,right about:blank
+fuzzy(0-20,0-999) != downscale-2c.html?203,52,right about:blank
+fuzzy(0-20,0-999) != downscale-2d.html?203,52,right about:blank
+fuzzy(0-20,0-999) != downscale-2e.html?203,52,right about:blank
+
+fuzzy(0-20,0-999) != downscale-2a.html?205,53,right about:blank
+fuzzy(0-20,0-999) != downscale-2b.html?205,53,right about:blank
+fuzzy(0-20,0-999) != downscale-2c.html?205,53,right about:blank
+fuzzy(0-20,0-999) != downscale-2d.html?205,53,right about:blank
+fuzzy(0-20,0-999) != downscale-2e.html?205,53,right about:blank
+
+fuzzy(0-20,0-999) != downscale-2a.html?203,52,top about:blank
+fuzzy(0-20,0-999) != downscale-2b.html?203,52,top about:blank
+fuzzy(0-20,0-999) != downscale-2c.html?203,52,top about:blank
+fuzzy(0-20,0-999) != downscale-2d.html?203,52,top about:blank
+fuzzy(0-20,0-999) != downscale-2e.html?203,52,top about:blank
+
+fuzzy(0-20,0-999) != downscale-2a.html?205,53,top about:blank
+fuzzy(0-20,0-999) != downscale-2b.html?205,53,top about:blank
+fuzzy(0-20,0-999) != downscale-2c.html?205,53,top about:blank
+fuzzy(0-20,0-999) != downscale-2d.html?205,53,top about:blank
+fuzzy(0-20,0-999) != downscale-2e.html?205,53,top about:blank
+
+fuzzy(0-20,0-999) != downscale-2a.html?203,52,bottom about:blank
+fuzzy(0-20,0-999) != downscale-2b.html?203,52,bottom about:blank
+fuzzy(0-20,0-999) != downscale-2c.html?203,52,bottom about:blank
+fuzzy(0-20,0-999) != downscale-2d.html?203,52,bottom about:blank
+fuzzy(0-20,0-999) != downscale-2e.html?203,52,bottom about:blank
+
+fuzzy(0-20,0-999) != downscale-2a.html?205,53,bottom about:blank
+fuzzy(0-20,0-999) != downscale-2b.html?205,53,bottom about:blank
+fuzzy(0-20,0-999) != downscale-2c.html?205,53,bottom about:blank
+fuzzy(0-20,0-999) != downscale-2d.html?205,53,bottom about:blank
+fuzzy(0-20,0-999) != downscale-2e.html?205,53,bottom about:blank
+
+# Skip on Android because it runs reftests via http, and moz-icon isn't
+# accessible from http/https origins anymore.
+fuzzy(0-27,0-3940) fuzzy-if(gtkWidget,0-0,0-0) skip-if(Android) fuzzy-if(appleSilicon,0-20,0-10123) == downscale-moz-icon-1.html downscale-moz-icon-1-ref.html # gtkWidget Bug 1592059: regular is 2616, no-accel is 0, qr passes with 0
+
+== 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(0-1,0-1) fuzzy-if(gtkWidget&&swgl,1-1,1-1) == downscale-16px.html?ff-ARGB.ico downscale-16px.html?ff-ARGB.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(0-1,0-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
+
+# Test downscaling a JPEG with orientation metadata.
+fuzzy(0-1,0-50) == downscale-orient.html downscale-orient-ref.html
+
+# RUN TESTS WITH DOWNSCALE-DURING-DECODE ENABLED:
+# ===============================================
+defaults pref(image.downscale-during-decode.enabled,true)
+
+fuzzy(0-31,0-127) fuzzy-if(d2d,0-31,0-147) == downscale-1.html downscale-1-ref.html # intermittently 147 pixels on win7 accelerated only (not win8)
+
+fuzzy(0-20,0-999) != downscale-2a.html?203,52,left about:blank
+fuzzy(0-20,0-999) != downscale-2b.html?203,52,left about:blank
+fuzzy(0-20,0-999) != downscale-2c.html?203,52,left about:blank
+fuzzy(0-20,0-999) != downscale-2d.html?203,52,left about:blank
+fuzzy(0-20,0-999) != downscale-2e.html?203,52,left about:blank
+fuzzy(0-20,0-999) != downscale-2f.html?203,52,left about:blank
+
+fuzzy(0-20,0-999) != downscale-2a.html?205,53,left about:blank
+fuzzy(0-20,0-999) != downscale-2b.html?205,53,left about:blank
+fuzzy(0-20,0-999) != downscale-2c.html?205,53,left about:blank
+fuzzy(0-20,0-999) != downscale-2d.html?205,53,left about:blank
+fuzzy(0-20,0-999) != downscale-2e.html?205,53,left about:blank
+fuzzy(0-20,0-999) != downscale-2f.html?205,53,left about:blank
+
+fuzzy(0-20,0-999) != downscale-2a.html?203,52,right about:blank
+fuzzy(0-20,0-999) != downscale-2b.html?203,52,right about:blank
+fuzzy(0-20,0-999) != downscale-2c.html?203,52,right about:blank
+fuzzy(0-20,0-999) != downscale-2d.html?203,52,right about:blank
+fuzzy(0-20,0-999) != downscale-2e.html?203,52,right about:blank
+fuzzy(0-20,0-999) != downscale-2f.html?203,52,right about:blank
+
+fuzzy(0-20,0-999) != downscale-2a.html?205,53,right about:blank
+fuzzy(0-20,0-999) != downscale-2b.html?205,53,right about:blank
+fuzzy(0-20,0-999) != downscale-2c.html?205,53,right about:blank
+fuzzy(0-20,0-999) != downscale-2d.html?205,53,right about:blank
+fuzzy(0-20,0-999) != downscale-2e.html?205,53,right about:blank
+fuzzy(0-20,0-999) != downscale-2f.html?205,53,right about:blank
+
+fuzzy(0-20,0-999) != downscale-2a.html?203,52,top about:blank
+fuzzy(0-20,0-999) != downscale-2b.html?203,52,top about:blank
+fuzzy(0-20,0-999) != downscale-2c.html?203,52,top about:blank
+fuzzy(0-20,0-999) != downscale-2d.html?203,52,top about:blank
+fuzzy(0-20,0-999) != downscale-2e.html?203,52,top about:blank
+fuzzy(0-20,0-999) != downscale-2f.html?203,52,top about:blank
+
+fuzzy(0-20,0-999) != downscale-2a.html?205,53,top about:blank
+fuzzy(0-20,0-999) != downscale-2b.html?205,53,top about:blank
+fuzzy(0-20,0-999) != downscale-2c.html?205,53,top about:blank
+fuzzy(0-20,0-999) != downscale-2d.html?205,53,top about:blank
+fuzzy(0-20,0-999) != downscale-2e.html?205,53,top about:blank
+fuzzy(0-20,0-999) != downscale-2f.html?205,53,top about:blank
+
+fuzzy(0-20,0-999) != downscale-2a.html?203,52,bottom about:blank
+fuzzy(0-20,0-999) != downscale-2b.html?203,52,bottom about:blank
+fuzzy(0-20,0-999) != downscale-2c.html?203,52,bottom about:blank
+fuzzy(0-20,0-999) != downscale-2d.html?203,52,bottom about:blank
+fuzzy(0-20,0-999) != downscale-2e.html?203,52,bottom about:blank
+fuzzy(0-20,0-999) != downscale-2f.html?203,52,bottom about:blank
+
+fuzzy(0-20,0-999) != downscale-2a.html?205,53,bottom about:blank
+fuzzy(0-20,0-999) != downscale-2b.html?205,53,bottom about:blank
+fuzzy(0-20,0-999) != downscale-2c.html?205,53,bottom about:blank
+fuzzy(0-20,0-999) != downscale-2d.html?205,53,bottom about:blank
+fuzzy(0-20,0-999) != downscale-2e.html?205,53,bottom about:blank
+fuzzy(0-20,0-999) != downscale-2f.html?205,53,bottom about:blank
+
+# Skip on Android because it runs reftests via http, and moz-icon isn't
+# accessible from http/https origins anymore.
+fuzzy(0-53,0-6391) fuzzy-if(appleSilicon,0-20,0-11605) fuzzy-if(gtkWidget,18-19,5502-5568) skip-if(Android) == downscale-moz-icon-1.html downscale-moz-icon-1-ref.html # gtkWidget Bug 1592059
+
+== 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(0-1,0-3) == downscale-16px.html?ff-0RGB.ico downscale-16px.html?ff-0RGB.png
+fuzzy(0-3,0-32) fuzzy-if(swgl,3-3,33-33) == 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(0-18,0-128) == downscale-32px.html?.bmp downscale-32px-ref.html
+fuzzy(0-18,0-128) == downscale-32px.html?.gif downscale-32px-ref.html
+fuzzy(0-19,0-992) == downscale-32px.html?.jpg downscale-32px-ref.html
+fuzzy(0-18,0-128) == downscale-32px.html?.png downscale-32px-ref.html
+== downscale-32px.html?.svg downscale-32px-ref.html
+fuzzy(0-18,0-128) == downscale-32px.html?-bmp-in.ico downscale-32px-ref.html
+fuzzy(0-18,0-128) == downscale-32px.html?-png-in.ico downscale-32px-ref.html
+
+# Test downscaling a JPEG with orientation metadata.
+fuzzy(0-4,0-18) == downscale-orient.html downscale-orient-ref.html
+
+# Test images taller or wider than 32767 pixels.
+== huge-1.html?100x32768.png,100,100 huge-1.html?100x100.png,100,100
+== huge-1.html?100x32768.png,100,32768 huge-1.html?100x100.png,100,32768
+== huge-1.html?32768x100.png,100,100 huge-1.html?100x100.png,100,100
+== huge-1.html?32768x100.png,32768,100 huge-1.html?100x100.png,32768,100
+== huge-1.html?100x32768.gif,100,100 huge-1.html?100x100.gif,100,100
+== huge-1.html?100x32768.gif,100,32768 huge-1.html?100x100.gif,100,32768
+== huge-1.html?32768x100.gif,100,100 huge-1.html?100x100.gif,100,100
+== huge-1.html?32768x100.gif,32768,100 huge-1.html?100x100.gif,32768,100
+== huge-1.html?100x32768.jpg,100,100 huge-1.html?100x100.jpg,100,100
+== huge-1.html?100x32768.jpg,100,32768 huge-1.html?100x100.jpg,100,32768
+== huge-1.html?32768x100.jpg,100,100 huge-1.html?100x100.jpg,100,100
+== huge-1.html?32768x100.jpg,32768,100 huge-1.html?100x100.jpg,32768,100
+
+# Only need to run these with downscaling on
+!= 1421191-1.html about:blank
+== 1404366-1.html about:blank
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 0000000000..bd18f85d48
--- /dev/null
+++ b/image/test/reftest/downscaling/top-to-bottom-16x16-24bpp.bmp
Binary files differ