Bug 1616411 - Part 7: Tests. r=tnikkel
authorCameron McCormack <cam@mcc.id.au>
Fri, 17 Apr 2020 02:57:49 +0000
changeset 524542 325e655b6024492c976ba22bf2335ad5d2229036
parent 524541 c30a54ef15b5212e9c6abd12b1f200d837cf6346
child 524543 d6a4c108cd4038f7b5516c1b3ff916f5c0d98b17
push id37321
push userdluca@mozilla.com
push dateFri, 17 Apr 2020 09:38:52 +0000
treeherdermozilla-central@24537fed53e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs1616411
milestone77.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1616411 - Part 7: Tests. r=tnikkel Differential Revision: https://phabricator.services.mozilla.com/D70277
dom/html/reftests/reftest.list
image/test/reftest/downscaling/downscale-orient-ref.html
image/test/reftest/downscaling/downscale-orient-ref.png
image/test/reftest/downscaling/downscale-orient.html
image/test/reftest/downscaling/image-pre-rotated-90-deg.jpg
image/test/reftest/downscaling/reftest.list
layout/reftests/image-element/orientation-1-ref.html
layout/reftests/image-element/orientation-1.html
layout/reftests/image-element/reftest.list
layout/reftests/image/image-orientation-border-image.html
layout/reftests/image/image-orientation-list-style-image.html
layout/reftests/image/reftest.list
testing/web-platform/meta/2dcontext/drawing-images-to-the-canvas/image-orientation/__dir__.ini
testing/web-platform/meta/2dcontext/drawing-images-to-the-canvas/image-orientation/drawImage-from-bitmap-orientation-none.tentative.html.ini
testing/web-platform/meta/2dcontext/drawing-images-to-the-canvas/image-orientation/drawImage-from-bitmap-swap-width-height-orientation-none.tentative.html.ini
testing/web-platform/meta/2dcontext/drawing-images-to-the-canvas/image-orientation/drawImage-from-bitmap-swap-width-height.tentative.html.ini
testing/web-platform/meta/2dcontext/drawing-images-to-the-canvas/image-orientation/drawImage-from-bitmap.tentative.html.ini
testing/web-platform/meta/2dcontext/drawing-images-to-the-canvas/image-orientation/drawImage-from-element-orientation-none.tentative.html.ini
testing/web-platform/meta/2dcontext/drawing-images-to-the-canvas/image-orientation/drawImage-from-element-swap-width-height-orientation-none.tentative.html.ini
testing/web-platform/meta/2dcontext/drawing-images-to-the-canvas/image-orientation/drawImage-from-element-swap-width-height.tentative.html.ini
testing/web-platform/meta/2dcontext/drawing-images-to-the-canvas/image-orientation/drawImage-from-element.tentative.html.ini
testing/web-platform/meta/css/css-images/image-orientation/__dir__.ini
testing/web-platform/meta/css/css-images/image-orientation/image-orientation-background-image.html.ini
testing/web-platform/meta/css/css-images/image-orientation/image-orientation-border-image.html.ini
testing/web-platform/meta/css/css-images/image-orientation/image-orientation-list-style-image.html.ini
testing/web-platform/meta/css/css-images/image-orientation/image-orientation-mask-image.html.ini
testing/web-platform/tests/css/css-images/image-orientation/image-orientation-background-image.html
testing/web-platform/tests/css/css-images/image-orientation/image-orientation-border-image.html
testing/web-platform/tests/css/css-images/image-orientation/image-orientation-list-style-image.html
testing/web-platform/tests/css/css-images/image-orientation/image-orientation-mask-image.html
testing/web-platform/tests/css/css-images/image-orientation/reference/image-orientation-background-image-ref.html
testing/web-platform/tests/css/css-images/image-orientation/reference/image-orientation-border-image-ref.html
testing/web-platform/tests/css/css-images/image-orientation/reference/image-orientation-list-style-image-ref.html
testing/web-platform/tests/css/css-images/image-orientation/reference/image-orientation-mask-image-ref.html
--- a/dom/html/reftests/reftest.list
+++ b/dom/html/reftests/reftest.list
@@ -39,17 +39,17 @@ skip-if(Android) == 649134-2.html 649134
 == image-load-shortcircuit-1.html image-load-shortcircuit-ref.html
 == image-load-shortcircuit-2.html image-load-shortcircuit-ref.html
 
 # Test that image documents taken into account CSS properties like
 # image-orientation when determining the size of the image.
 # (Fuzzy necessary due to pixel-wise comparison of different JPEGs.
 # The vast majority of the fuzziness comes from Linux and WinXP.)
 pref(layout.css.image-orientation.initial-from-image,true) fuzzy(0-2,0-830) == bug917595-iframe-1.html    bug917595-1-ref.html
-fuzzy(0-3,0-640) fuzzy-if(skiaContent,0-3,0-7544) fuzzy-if(webrender&&!geckoview,2-3,3092-7544) == bug917595-exif-rotated.jpg bug917595-pixel-rotated.jpg # bug 1060869
+fuzzy(0-3,0-640) fuzzy-if(skiaContent,0-3,0-7544) fuzzy-if(webrender&&!geckoview,2-3,52-7544) == bug917595-exif-rotated.jpg bug917595-pixel-rotated.jpg # bug 1060869
 
 # Test support for SVG-as-image in <picture> elements.
 == bug1106522-1.html bug1106522-ref.html
 == bug1106522-2.html bug1106522-ref.html
 
 == href-attr-change-restyles.html href-attr-change-restyles-ref.html
 == figure.html figure-ref.html
 == pre-1.html pre-1-ref.html
new file mode 100644
--- /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>
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0db684e0d746e50a2f73cbb20f611202d1bed544
GIT binary patch
literal 146
zc%17D@N?(olHy`uVBq!ia0vp^MnEjd!3HFYLuy@sRHUbiV@O16@(o3a@AI$S$XKs(
z*6{EOcQ;$3R}%yKd#X~dC@+?i{CYy+%Zbv9cm8iVcJ2F<j6TVIo?-u&o0k1s?ow=n
fst~M~!<LD`X`a*)pMIxipd}2Ru6{1-oD!M<R#G>u
new file mode 100644
--- /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>
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..b8817f9bf5de44a0e0737026f9e6af87767268df
GIT binary patch
literal 6914
zc%1E52UJr_x1N&<0SvtfCUgWL6sZaU=>meFB3>0k2oQmQAv9YQ5f!~+#ez!Ft75})
z1>~YpKoLQ(V;AHiAeIQyL(V?|_4+ICz5D)uy|vzY>rGb9`OeIqncZgZJ?LY!8OYD{
z^zj4;f&g#$1L$kn`95xLVSzybo<4paZ~y>VZ$CCC9wQGx9EZmZ@|r=NAG&}_YycP_
z4G6#z00uKL!9Un@4uH+a!;P8<iNHU#zDEF&yziTN2U4lvzt<F)30xikNFc=45v)We
z#2FCBrtlIZ{X&S9!(${EgOgw`WDsI?362`WQ$}gVu!{so#Bm}ZmhhYq5f>rB)evt?
zPGUif^@BJwnaxUp_yNTFu}N`khzBHd<5-MD0C2LBejbY%4Y38pvfMdAZV*ogKuR|1
zI~@KU=CM+F5~1AU6VkZssAwM5m^qnh>EK{b^=75SvUohRKn630!HuB0#m6NuIB5Wk
z$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0BSB^Ps+O=;$Sb+U1rP5Ffyj3+
zWPl#lw}k)U$9~C+lDfKD&=XAm;0M#f8Nm(y(>9m};2}(dEU$$wPlov?hu=^p_!uu3
z2nnb#6-CioMC0W+Vwbp{JaTos9QTp@c#n8#)JSdK@WrNq#^Hs6b_)L^Ol?9NI*fxO
zFb6cLjl74kht%1>p1-ACL|^|ix5VZV{u8LhvY*AkgH<iVFtXi-VqCI@nFneXDn4e9
zsP*GW8(&N~CZfYM4|AX6YZP3*0&~kEXJPTD11Q)qZYHG^4_nat!FY+Of*u|=Sd`aq
z$p6q3)=GcRMZp1Rf(n>JuReh5q2O~Jy?tR=f9Wfc>9Ln8V(UDics$jw>qS8%QQZ8q
zFv>{(hIcTW+E|PKY#e#oC5jq36V{V0=--Wk0nI!ZxyAdUL|vQ3eb7?tdBc^08;N4d
Jc*z=l@(;3^GnN1V
--- a/image/test/reftest/downscaling/reftest.list
+++ b/image/test/reftest/downscaling/reftest.list
@@ -105,16 +105,19 @@ fuzzy(0-1,0-1) == downscale-16px.html?ff
 == 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.
+pref(layout.css.image-orientation.initial-from-image,true) 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
@@ -191,16 +194,19 @@ fuzzy(0-3,0-32) == downscale-16px.html?f
 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.
+pref(layout.css.image-orientation.initial-from-image,true) fuzzy(0-4,0-15) == 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
new file mode 100644
--- /dev/null
+++ b/layout/reftests/image-element/orientation-1-ref.html
@@ -0,0 +1,3 @@
+<!DOCTYPE html>
+<div style="width: 200px; height: 100px;"><img src="../image/image-exif-90-deg.jpg"></div>
+<img src="../image/image-exif-90-deg.jpg">
new file mode 100644
--- /dev/null
+++ b/layout/reftests/image-element/orientation-1.html
@@ -0,0 +1,4 @@
+<!DOCTYPE html>
+<!-- Test that -moz-element() honors a target image's orientation metadata. -->
+<div style="width: 200px; height: 100px; background-image: -moz-element(#e);"></div>
+<img id="e" src="../image/image-exif-90-deg.jpg">
--- a/layout/reftests/image-element/reftest.list
+++ b/layout/reftests/image-element/reftest.list
@@ -44,10 +44,10 @@ fuzzy(0-1,0-16900) == gradient-html-07c.
 HTTP == invalidate-1.html invalidate-1-ref.html
 == pattern-html-01.html pattern-html-01-ref.svg
 == pattern-html-02.html pattern-html-02-ref.svg
 != broken-icon.html no-src.html
 != broken-icon.html empty-src.html
 == empty-src.html no-src.html
 == broken-icon.html invalid-src.html
 fails == invalid-src.html invalid-src-2.html # bug 1506804
-
 fuzzy-if(skiaContent,0-1,0-30000) == mask-image-element.html mask-image-element-ref.html
+pref(image.honor-orientation-metadata,true) pref(layout.css.image-orientation.initial-from-image,true) == orientation-1.html orientation-1-ref.html
deleted file mode 100644
--- a/layout/reftests/image/image-orientation-border-image.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE>
-<head>
-  <style>
-    body {
-      border:  0px;
-      margin:  0px;
-      padding: 0px;
-    }
-    div {
-      width:   100px;
-      height:  100px;
-      margin:  50px;
-
-      /* This is deliberately an image with a non-neutral inherent orientation to */
-      /* ensure that the inherent orientation is irrelevant. */
-      border-style: solid;
-      border-width: 20px;
-      border-image: url(image-exif-90-deg-flip.jpg) 27 repeat;
-    }
-  </style>
-</head>
-<body>
-  <div></div>
-
-  <script>
-    var fromImage = location.search == "from-image";
-
-    // Construct a style.
-    var style;
-    if (fromImage) {
-      style = "div { image-orientation: from-image; }\n";
-    } else {
-      style = "div { image-orientation: none; }\n";
-    }
-
-    // Apply the style to the document.
-    var sheet = document.createElement('style');
-    sheet.innerHTML = style;
-    document.body.appendChild(sheet);
-  </script>
-</body>
deleted file mode 100644
--- a/layout/reftests/image/image-orientation-list-style-image.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE>
-<head>
-  <style>
-    body {
-      border:  0px;
-      margin:  0px;
-      padding: 0px;
-    }
-    ul {
-      list-style-position: inside;
-      list-style-image:    url(image-exif-270-deg-flip.jpg);
-    }
-  </style>
-</head>
-<body>
-  <ul><li></li></ul>
-
-  <script>
-    var orientation = location.search.substring(1).split("&");
-    var angle = orientation[0];
-    var flip = orientation[1] == "flip" ? true : false;
-
-    // Construct a style. "from-image" is special-cased.
-    var style;
-    if (angle == "from-image") {
-      style = "ul { image-orientation: from-image; }\n";
-    } else {
-      style = "ul { image-orientation: "
-            + angle + "deg"
-            + (flip ? " flip" : "")
-            + "; }\n";
-    }
-
-    // Apply the style to the document.
-    var sheet = document.createElement('style');
-    sheet.innerHTML = style;
-    document.body.appendChild(sheet);
-  </script>
-</body>
--- a/layout/reftests/image/reftest.list
+++ b/layout/reftests/image/reftest.list
@@ -33,21 +33,16 @@ fuzzy(0-1,0-1) == image-orientation-from
 fuzzy(0-1,0-1) == image-orientation-from-image.html?270&flip image-orientation-ref.html?270&flip
 
 # Tests for image-orientation used with an explicit 'none' orientation:
 fuzzy(0-1,0-1) == image-orientation-explicit-none.html image-orientation-ref.html?0
 
 # Tests for image-orientation:from-image used on generated content:
 fuzzy(0-1,0-1) == image-orientation-generated-content.html image-orientation-generated-content-ref.html
 
-# Tests that image-orientation does not apply to decorative images:
-fuzzy(0-1,0-1) == image-orientation-background.html?from-image   image-orientation-ref.html?none
-== image-orientation-border-image.html?from-image            image-orientation-border-image.html?none
-== image-orientation-list-style-image.html?from-image        image-orientation-list-style-image.html?none
-
 fuzzy(0-1,0-1) == image-orientation-dynamic.html image-orientation-dynamic-ref.html
 
 # <img srcset> tests
 == image-srcset-basic-selection-0.1x.html image-srcset-basic-selection-0.1x-ref.html
 == image-srcset-basic-selection-2x.html image-srcset-basic-selection-2x-ref.html
 == image-srcset-basic-selection-0.5x.html image-srcset-basic-selection-0.5x-ref.html
 == image-srcset-basic-selection-0.6x.html image-srcset-basic-selection-0.6x-ref.html
 random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == image-srcset-basic-selection-1.5x.html image-srcset-basic-selection-1.5x-ref.html # Bug 1392106
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/2dcontext/drawing-images-to-the-canvas/image-orientation/__dir__.ini
@@ -0,0 +1,1 @@
+prefs: [layout.css.image-orientation.initial-from-image:true, image.honor-orientation-metadata:true]
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/2dcontext/drawing-images-to-the-canvas/image-orientation/drawImage-from-bitmap-orientation-none.tentative.html.ini
@@ -0,0 +1,2 @@
+[drawImage-from-bitmap-orientation-none.tentative.html]
+  expected: FAIL
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/2dcontext/drawing-images-to-the-canvas/image-orientation/drawImage-from-bitmap-swap-width-height-orientation-none.tentative.html.ini
@@ -0,0 +1,2 @@
+[drawImage-from-bitmap-swap-width-height-orientation-none.tentative.html]
+  expected: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/2dcontext/drawing-images-to-the-canvas/image-orientation/drawImage-from-bitmap-swap-width-height.tentative.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[drawImage-from-bitmap-swap-width-height.tentative.html]
-  expected: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/2dcontext/drawing-images-to-the-canvas/image-orientation/drawImage-from-bitmap.tentative.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[drawImage-from-bitmap.tentative.html]
-  expected: FAIL
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/2dcontext/drawing-images-to-the-canvas/image-orientation/drawImage-from-element-orientation-none.tentative.html.ini
@@ -0,0 +1,2 @@
+[drawImage-from-element-orientation-none.tentative.html]
+  expected: FAIL
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/2dcontext/drawing-images-to-the-canvas/image-orientation/drawImage-from-element-swap-width-height-orientation-none.tentative.html.ini
@@ -0,0 +1,2 @@
+[drawImage-from-element-swap-width-height-orientation-none.tentative.html]
+  expected: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/2dcontext/drawing-images-to-the-canvas/image-orientation/drawImage-from-element-swap-width-height.tentative.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[drawImage-from-element-swap-width-height.tentative.html]
-  expected: FAIL
deleted file mode 100644
--- a/testing/web-platform/meta/2dcontext/drawing-images-to-the-canvas/image-orientation/drawImage-from-element.tentative.html.ini
+++ /dev/null
@@ -1,2 +0,0 @@
-[drawImage-from-element.tentative.html]
-  expected: FAIL
--- a/testing/web-platform/meta/css/css-images/image-orientation/__dir__.ini
+++ b/testing/web-platform/meta/css/css-images/image-orientation/__dir__.ini
@@ -1,1 +1,2 @@
 leak-threshold: [default:51200]
+prefs: [image.honor-orientation-metadata:true, layout.css.image-orientation.initial-from-image:true]
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/css/css-images/image-orientation/image-orientation-background-image.html.ini
@@ -0,0 +1,2 @@
+[image-orientation-background-image.html]
+  fuzzy: 2;40
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/css/css-images/image-orientation/image-orientation-border-image.html.ini
@@ -0,0 +1,2 @@
+[image-orientation-border-image.html]
+  fuzzy: 0-16;80-160
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/css/css-images/image-orientation/image-orientation-list-style-image.html.ini
@@ -0,0 +1,2 @@
+[image-orientation-list-style-image.html]
+  fuzzy: 0-4;0-41
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/css/css-images/image-orientation/image-orientation-mask-image.html.ini
@@ -0,0 +1,2 @@
+[image-orientation-mask-image.html]
+  fuzzy: 1;22
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-images/image-orientation/image-orientation-background-image.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Images Module Level 3: image-orientation does not apply to background-image</title>
+<link rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au">
+<link rel="help" href="https://drafts.csswg.org/css-images-3/#propdef-image-orientation">
+<link rel="match" href="reference/image-orientation-background-image-ref.html">
+<meta name=fuzzy content="2;40">
+<style>
+div { width: 100px; height: 50px; background-image: url(support/exif-orientation-2-ur.jpg); }
+.no-orient { image-orientation: none; }
+</style>
+<div></div>
+<div class="no-orient"></div>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-images/image-orientation/image-orientation-border-image.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Images Module Level 3: image-orientation does not apply to border images</title>
+<link rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au">
+<link rel="help" href="https://drafts.csswg.org/css-images-3/#propdef-image-orientation">
+<link rel="match" href="reference/image-orientation-border-image-ref.html">
+<style>
+div {
+  width: 100px;
+  height: 50px;
+  border: 10px solid black;
+  border-image: url(support/exif-orientation-2-ur.jpg) 10;
+}
+.no-orient { image-orientation: none; }
+</style>
+<div></div>
+<div class="no-orient"></div>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-images/image-orientation/image-orientation-list-style-image.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Images Module Level 3: image-orientation does not apply to list-style-image</title>
+<link rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au">
+<link rel="help" href="https://drafts.csswg.org/css-images-3/#propdef-image-orientation">
+<link rel="match" href="reference/image-orientation-list-style-image-ref.html">
+<meta name=fuzzy content="2;40">
+<style>
+ul { margin-left: 100px; list-style-image: url(support/exif-orientation-2-ur.jpg); }
+.no-orient { image-orientation: none; }
+</style>
+<ul><li>&nbsp;</li></ul>
+<ul class="no-orient"><li>&nbsp;</li></ul>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-images/image-orientation/image-orientation-mask-image.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Images Module Level 3: image-orientation does not apply to mask-image</title>
+<link rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au">
+<link rel="help" href="https://drafts.csswg.org/css-images-3/#propdef-image-orientation">
+<link rel="match" href="reference/image-orientation-mask-image-ref.html">
+<meta name=fuzzy content="1;22">
+<style>
+div {
+  width: 100px;
+  height: 50px;
+  background: blue;
+  mask-image: url(support/exif-orientation-2-ur.jpg);
+  mask-mode: luminance;
+}
+.no-orient { image-orientation: none; }
+</style>
+<div></div>
+<div class="no-orient"></div>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-images/image-orientation/reference/image-orientation-background-image-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Reference</title>
+<style>
+div { width: 100px; height: 50px; background-image: url(../support/exif-orientation-2-ur-pre-rotated.jpg); }
+</style>
+<div></div>
+<div></div>
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-images/image-orientation/reference/image-orientation-border-image-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Reference</title>
+<style>
+div {
+  width: 100px;
+  height: 50px;
+  border: 10px solid black;
+  border-image: url(../support/exif-orientation-2-ur-pre-rotated.jpg) 10;
+}
+</style>
+<div></div>
+<div></div>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-images/image-orientation/reference/image-orientation-list-style-image-ref.html
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Reference</title>
+<style>
+ul { margin-left: 100px; list-style-image: url(../support/exif-orientation-2-ur-pre-rotated.jpg); }
+</style>
+<ul><li>&nbsp;</li></ul>
+<ul><li>&nbsp;</li></ul>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-images/image-orientation/reference/image-orientation-mask-image-ref.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Reference</title>
+<style>
+div {
+  width: 100px;
+  height: 50px;
+  background: blue;
+  mask-image: url(../support/exif-orientation-2-ur-pre-rotated.jpg);
+  mask-mode: luminance;
+}
+</style>
+<div></div>
+<div></div>