1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/reftests/css-valuesandunits/unit-vh-vw-overflow-auto-ref-iframe.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,37 @@ 1.4 +<style> 1.5 + body { overflow: hidden } 1.6 + div { 1.7 + width: 10px; 1.8 + height: 10px; 1.9 + background-color: #d64203; 1.10 + } 1.11 +</style> 1.12 + 1.13 +<body> 1.14 + <div id="a"></div> 1.15 + <div id="b"></div> 1.16 + <div id="c"></div> 1.17 + <div id="d"></div> 1.18 + 1.19 + <!-- 1.20 + Deliberately make the scrollbars appear to ensure that with 'overflow: auto' 1.21 + viewport units are calculated as if the scrollbars are _not_ there. 1.22 + --> 1.23 + <div style="width: 500px; height: 500px; background-color: black"> 1.24 +</body> 1.25 + 1.26 +<script> 1.27 + // client{Width, Height} consist of the area _inside_ the scrollbars, so we need 1.28 + // to calculate these units with 'overflow: hidden' set to ensure that there are 1.29 + // no scrollbars. This reflects the fact that with 'overflow: auto' set, viewport 1.30 + // units are sized without taking the scrollbars into account. 1.31 + var vw = 0.01 * document.body.clientWidth; 1.32 + var vh = 0.01 * document.body.clientHeight; 1.33 + var vmin = Math.min(vw, vh); 1.34 + var vmax = Math.max(vw, vh); 1.35 + document.body.style.overflow = "auto"; 1.36 + document.getElementById('a').style.width = (50 * vw) + "px"; 1.37 + document.getElementById('b').style.height = (25 * vh) + "px"; 1.38 + document.getElementById('c').style.width = (35 * vmin) + "px"; 1.39 + document.getElementById('d').style.height = (25 * vmax) + "px"; 1.40 +</script>