image-orientation-from-image-computed-style.html (2443B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS Images Module Level 3: image-orientation:none computed style</title> 6 <link rel="author" title="Stephen Chenney" href="mailto:schenney@chromium.org"> 7 <link rel="help" href="https://drafts.csswg.org/css-images-3/#propdef-image-orientation"> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <style> 11 body { 12 overflow: hidden; 13 image-orientation: from-image; 14 } 15 div { 16 display: inline-block; 17 width: 100px; 18 vertical-align: top; 19 } 20 </style> 21 <script> 22 function run_tests() { 23 test(function() { 24 for (var i = 1; i <= 4; i++) { 25 var el = document.getElementById("img" + i); 26 var computedStyle = window.getComputedStyle(el); 27 assert_equals(computedStyle.width, "100px"); 28 assert_equals(computedStyle.height, "50px"); 29 assert_equals(computedStyle.imageOrientation, "from-image"); 30 } 31 for (var i = 5; i <= 8; i++) { 32 var el = document.getElementById("img" + i); 33 var computedStyle = window.getComputedStyle(el); 34 assert_equals(computedStyle.width, "50px"); 35 assert_equals(computedStyle.height, "100px"); 36 assert_equals(computedStyle.imageOrientation, "from-image"); 37 } 38 var el = document.getElementById("img9"); 39 var computedStyle = window.getComputedStyle(el); 40 assert_equals(computedStyle.width, "100px"); 41 assert_equals(computedStyle.height, "50px"); 42 assert_equals(computedStyle.imageOrientation, "from-image"); 43 }, "image-orientation:from-image computed style reports correct values"); 44 } 45 </script> 46 </head> 47 <body onload="run_tests()"> 48 <div><img id="img1" src="support/exif-orientation-1-ul.jpg"/></div> 49 <div><img id="img2" src="support/exif-orientation-2-ur.jpg"/></div> 50 <div><img id="img3" src="support/exif-orientation-3-lr.jpg"/></div> 51 <div><img id="img4" src="support/exif-orientation-4-lol.jpg"/></div> 52 <div><img id="img5" src="support/exif-orientation-5-lu.jpg"/></div> 53 <div><img id="img6" src="support/exif-orientation-6-ru.jpg"/></div> 54 <div><img id="img7" src="support/exif-orientation-7-rl.jpg"/></div> 55 <div><img id="img8" src="support/exif-orientation-8-llo.jpg"/></div> 56 <div><img id="img9" src="support/exif-orientation-9-u.jpg"/></div> 57 </body> 58 </html>