<!DOCTYPE html>
<script src="../resources/run-after-layout-and-paint.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.setPopupBlockingEnabled(false);
testRunner.waitUntilDone();
}
onload = function() {
var newWindow = window.open('resources/5000x5000.png', 'image', 'width=100,height=150');
newWindow.onload = function() {
if (newWindow.internals)
newWindow.internals.settings.setViewportEnabled(true);
runAfterLayoutAndPaint(function() {
document.getElementById('output').textContent =
'\nviewport meta: ' + newWindow.document.querySelector('meta').outerHTML
+ '\nimage style: ' + newWindow.document.querySelector('img').getAttribute('style')
+ '\nimage actual width: ' + newWindow.document.querySelector('img').offsetWidth;
if (window.testRunner)
testRunner.notifyDone();
});
};
}
</script>
Tests huge image scaling when viewport is enabled. Requires DumpRenderTree.<br>
To manual test, open resources/5000x5000.png in a viewport-capable browser (e.g. on Android or enable viewport emulation in DevTools).<br>
Passes if the image shinks to fit the width.<br>
<pre id="output"></pre>