<html>
<head>
    <style>
        ::-webkit-scrollbar {
            width: 0px;
            height: 0px;
        }
    </style>
    <script src="../../resources/js-test-pre.js"></script>
    <script>
      window.enablePixelTesting = true;

      if (window.testRunner)
        testRunner.waitUntilDone();

      // Layout for the iframe will be scaled down to a quarter.
      // It appears this bug will only manifest itself if layout for the
      // iframe has not yet been computed. If we've already laid out
      // the iframe, then CSSStyleSelector::styleForDocument does not appear
      // to get called for the iframe.
      scalePage(0.5);

      function scalePage(scaleFactor) {
          var scaleOffset = 0;
          if (window.internals) {
            window.internals.setPageScaleFactor(scaleFactor, scaleOffset, scaleOffset);
          }
      }

      function test() {
          // Curiously, the document style for the iframe does not
          // appear to be recalculated after this
          scalePage(1.0);
          document.body.offsetWidth;
          if (window.testRunner)
            testRunner.notifyDone();
      }
    </script>
    <script src="../../resources/js-test-pre.js"></script>
</head>
<body onload="test();">
  <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>
  <div id="rightbox" style="position: absolute; left: 300px; top: 0px; width: 300px; height: 300px; background-color: green;"></div>
  <script src="../../resources/js-test-post.js"></script>
</body>
</html>
