summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/css3/device-adapt/viewport-width-extend-to-zoom.html
blob: cfdbef543bac4cf7cf942633ec09de4630e3cffc (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
34
35
36
37
38
39
40
41
42
43
<!DOCTYPE html>
<html>
<head>
    <title>Viewport 'width' descriptor has 'extend-to-zoom' value</title>
    <script src="../../resources/testharness.js"></script>
    <script src="../../resources/testharnessreport.js"></script>
    <style>
        html, body { width: 100%; height: 100%; margin: 0 }
        @viewport { width: -internal-extend-to-zoom; zoom: 0.5; }
    </style>
    <script>
        test(function(){
            assert_own_property(window, "testRunner");
        }, "Check that window.testRunner is present. Required to add a user stylesheet.");

        if (window.testRunner) {
            testRunner.injectStyleSheet("@viewport { width: -internal-extend-to-zoom 980px; min-zoom: 0.25; max-zoom: 5; height: auto; zoom: auto; user-zoom: zoom; orientation: auto }", true);
        }
    </script>
</head>
<body>
    <div id="log"></div>
    <script>
        test(function(){
            assert_own_property(window, "internals");
        }, "Check that window.internals is present. Required to call viewportAsText.");

        var actualWidth;
        var actualHeight;

        var vpString = internals.viewportAsText(document, 1, 320, 352);
        var match = /viewport size (.+)x(.+) scale (.+ )/.exec(vpString);

        if (match) {
            actualWidth = parseFloat(match[1]);
        }

        test(function(){
            assert_equals(actualWidth, 640);
        }, "Check viewport width.");
    </script>
</body>
</html>