2 <script src=
"../../resources/run-after-layout-and-paint.js"></script>
4 if (window
.testRunner
) {
5 testRunner
.dumpAsText();
6 testRunner
.setCanOpenWindows();
7 testRunner
.waitUntilDone();
11 var newWindow
= window
.open('resources/5000x5000.png', 'image', 'width=100,height=150');
12 if (newWindow
.internals
)
13 newWindow
.internals
.settings
.setViewportEnabled(true);
14 newWindow
.onload = function() {
15 runAfterLayoutAndPaint(function() {
16 document
.getElementById('output').textContent
=
17 '\nviewport meta: ' + newWindow
.document
.querySelector('meta').outerHTML
18 + '\nimage style: ' + newWindow
.document
.querySelector('img').getAttribute('style')
19 + '\nimage actual width: ' + newWindow
.document
.querySelector('img').offsetWidth
;
20 if (window
.testRunner
)
21 testRunner
.notifyDone();
26 Tests huge image scaling when viewport is enabled. Requires DumpRenderTree.
<br>
27 To manual test, open resources/
5000x5000.png in a viewport-capable browser (e.g. on Android or enable viewport emulation in DevTools).
<br>
28 Passes if the image shinks to fit the width.
<br>
29 <pre id=
"output"></pre>