summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/dom/inner-width-height.html
blob: 144aac88716ac24284702eaa84fde32aa2f6ad02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<html>
<head>
    <script>
        function debug(str) {
            pre = document.getElementById('console');
            pre.appendChild(document.createTextNode(str + '\n'));
        }
    
        function runTests() {
            if (window.testRunner)
                testRunner.dumpAsText();

            var width = window.innerWidth;
            var height = window.innerHeight;
            
            // Now force scroll bars. innerWidth and innerHeight should not take the scroll bar into account
            document.body.style.overflow = 'scroll';
            document.body.offsetTop;
            
            if (width != window.innerWidth || height != window.innerHeight) {
                debug("FAILURE!")
                return;
            }
                
            debug("SUCCESS!");
        }
    </script>
</head>
<body onload="runTests()">
    This tests that window.innerWidth/innerHeight does not include the size of the scrollbars.
    <pre id="console"></pre>
</body>
</html>