servo/tests/html/get-natural-height.html
Michael Howell 337832fde4 Check if naturalWidth / naturalHeight works w/ DPR
$ ./mach run --device-pixel-ratio=1 tests/html/get-natural-height.html
    ALERT: width: 600, height: 254
    $ ./mach run --device-pixel-ratio=2 tests/html/get-natural-height.html
    ALERT: width: 600, height: 254
    $ ./mach run --device-pixel-ratio=.5 tests/html/get-natural-height.html
    ALERT: width: 600, height: 254

It doesn't. Answers #6769.
2015-07-25 15:41:38 -07:00

24 lines
504 B
HTML

<!DOCTYPE html>
<html>
<head>
<style>
div {
font-size: 4em;
}
</style>
</head>
<body>
<img id="test-image" src="longcattop.png">
<div id="test-output"></div>
<script>
var testImage = document.getElementById('test-image');
var testOutput = document.getElementById('test-output');
testImage.onload = function() {
testOutput.innerHTML =
"width: " + testImage.naturalWidth + ", " +
"height: " + testImage.naturalHeight;
alert(testOutput.innerHTML);
};
</script>
</body>
</html>