iframes seem to occasionally doubly scale or scale incorrectly when pageScaleFactor...
[WebKit-https.git] / LayoutTests / fast / frames / iframe-double-scale-contents.html
1 <html>
2 <head>
3     <style>
4         ::-webkit-scrollbar {
5             width: 0px;
6             height: 0px;
7         }
8     </style>
9     <script src="../js/resources/js-test-pre.js"></script>
10     <script>
11       window.enablePixelTesting = true;
12
13       if (window.layoutTestController)
14         layoutTestController.waitUntilDone();
15
16       // Layout for the iframe will be scaled down to a quarter.
17       // It appears this bug will only manifest itself if layout for the
18       // iframe has not yet been computed. If we've already laid out
19       // the iframe, then CSSStyleSelector::styleForDocument does not appear
20       // to get called for the iframe.
21       scalePage(0.5);
22
23       function scalePage(scaleFactor) {
24           var scaleOffset = 0;
25           if (window.eventSender) {
26             eventSender.scalePageBy(scaleFactor, scaleOffset, scaleOffset);
27           }
28       }
29
30       function test() {
31           // Curiously, the document style for the iframe does not
32           // appear to be recalculated after this
33           scalePage(1.0);
34           document.body.offsetWidth;
35           if (window.layoutTestController)
36             layoutTestController.notifyDone();
37       }
38     </script>
39     <script src="../js/resources/js-test-pre.js"></script>
40 </head>
41 <body onload="test();">
42   <iframe id="frame" src="resources/iframe-content-scaling-bug-iframe.html" style="position: absolute; left: 0px; top: 0px; border: none; width: 300px; height: 300px;"></iframe>
43   <div id="rightbox" style="position: absolute; left: 300px; top: 0px; width: 300px; height: 300px; background-color: green;"></div>
44   <script src="../js/resources/js-test-post.js"></script>
45 </body>
46 </html>