blob: 662dc0804fa32bff539467166fab134ce8ab22ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
<!DOCTYPE html>
<meta charset=utf-8>
<title>naturalWidth and naturalHeight on HTMLImageElement reflect orientation metadata</title>
<link rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
.ignore-orientation { image-orientation: none; }
</style>
<body>
<script>
async_test(function(t) {
let img = document.createElement("img");
img.src = "/images/green-100x50.png";
img.onload = t.step_func_done(function() {
assert_equals(img.naturalWidth, 100);
assert_equals(img.naturalHeight, 50);
img.remove();
});
document.body.append(img);
}, "naturalWidth and naturalHeight return correct values for an image without orientation metadata");
async_test(function(t) {
let img = document.createElement("img");
img.src = "/images/arrow-oriented-upright.jpg";
img.onload = t.step_func_done(function() {
assert_equals(img.naturalWidth, 144);
assert_equals(img.naturalHeight, 240);
img.remove();
});
document.body.append(img);
}, "naturalWidth and naturalHeight return re-oriented values for an image with orientation metadata");
async_test(function(t) {
let img = document.createElement("img");
img.src = "/images/arrow-oriented-upright.jpg";
img.className = "ignore-orientation";
img.onload = t.step_func_done(function() {
assert_equals(img.naturalWidth, 144);
assert_equals(img.naturalHeight, 240);
img.remove();
});
document.body.append(img);
}, "naturalWidth and naturalHeight return re-oriented values for an image with orientation metadata even with image-orientation:none");
</script>
|