summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/css/line-height-zoom-get-computed-style.html
blob: 871189409266fd0fdcbfbc8c1e975b811fa10556 (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
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html>
<script>	
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.setCanOpenWindows();
    testRunner.waitUntilDone();
}

function log(message)
{
    var console = document.getElementById("console");
    console.appendChild(document.createTextNode(message + "\n"));
}
function zoomPage()
{
    var el = document.getElementById('test');

    if (window.eventSender) {
	var count=0;
	while(count <10) {
	    eventSender.zoomPageIn();
	    var num = parseFloat(document.defaultView.getComputedStyle(el, null).getPropertyValue('line-height'));
	    log("Line height at zoom level" + (count) + " : " + num.toFixed(2));
	    ++count;
            if (count == 10)
                testRunner.notifyDone();
        }
    } else {
        var num = parseFloat(document.defaultView.getComputedStyle(el, null).getPropertyValue('line-height'));
	log("Line height is" + " : " + num.toFixed(2));
    }
}

</script>	
<head>
<style type="text/css">
p {
display: inline-block;
background-color: #000;
color: #fff;
line-height: 120%;
}
p:hover {
background-color: #fff;
color: #000;
}
</style>
</head>
<body onload="zoomPage()">
<p id="test">This tests that page zoom and getComputedStyle of line-height works well together.  This test requires testRunner to run.  To test manually, open this page in a browser window, and zoom in & reload for about 10 times. This text should get bigger at each step proportionately and the line-height should be constant.</p>
<pre id="console"></pre>
</body>
</html>