mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
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.
This commit is contained in:
parent
3af6992151
commit
337832fde4
1 changed files with 24 additions and 0 deletions
24
tests/html/get-natural-height.html
Normal file
24
tests/html/get-natural-height.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<!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>
|
Loading…
Add table
Add a link
Reference in a new issue