Regression(r188105): Seems to have caused crashes during PLT on some iPads
[WebKit-https.git] / LayoutTests / fast / css / line-height-text-autosizing.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test-pre.js"></script>
5 <style>
6 #testDivAdjust {
7   -webkit-text-size-adjust: 150%;
8   font-size: 20px;
9 }
10 #testDivNoAdjust {
11   font-size: 20px;
12 }
13 </style>
14 </head>
15 <boby>
16 <div id="testDivNoAdjust">Test</div>
17 <div id="testDivAdjust">Test</div>
18 <script>
19 description("Test the 'line-height' property interaction with '-webkit-text-size-adjust'.");
20
21 debug("Case without text size adjust.");
22 var testDivNoAdjust = document.getElementById("testDivNoAdjust");
23 shouldBeEqualToString("window.getComputedStyle(testDivNoAdjust).getPropertyValue('line-height')", "23px");
24 shouldBeEqualToString("window.getComputedStyle(testDivNoAdjust).getPropertyValue('font-size')", "20px");
25 evalAndLog("testDivNoAdjust.style['line-height'] = '1.6'");
26 // font-size * line-height == 20px * 1.6 == 32px
27 shouldBeEqualToString("window.getComputedStyle(testDivNoAdjust).getPropertyValue('line-height')", "32px");
28 evalAndLog("testDivNoAdjust.style['line-height'] = '80%'");
29 // font-size * line-height == 20px * 80% == 16px
30 shouldBeEqualToString("window.getComputedStyle(testDivNoAdjust).getPropertyValue('line-height')", "16px");
31 evalAndLog("testDivNoAdjust.style['line-height'] = '12px'");
32 shouldBeEqualToString("window.getComputedStyle(testDivNoAdjust).getPropertyValue('line-height')", "12px");
33
34 debug("Case with text size adjust.");
35 var testDivAdjust = document.getElementById("testDivAdjust");
36 if (window.getComputedStyle(testDivAdjust).getPropertyValue('-webkit-text-size-adjust') === "") {
37   debug("Platform does not support  -webkit-text-size-adjust");
38 } else {
39   debug("Platform supports -webkit-text-size-adjust");
40   shouldBeEqualToString("window.getComputedStyle(testDivAdjust).getPropertyValue('line-height')", "normal");
41   // font-size * -webkit-text-size-adjust == 20px * 150% == 30px
42   shouldBeEqualToString("window.getComputedStyle(testDivAdjust).getPropertyValue('font-size')", "30px");
43   evalAndLog("testDivAdjust.style['line-height'] = '1.6'");
44   // font-size * line-height == 30px * 1.6 == 48px
45   shouldBeEqualToString("window.getComputedStyle(testDivAdjust).getPropertyValue('line-height')", "48px");
46
47   evalAndLog("testDivAdjust.style['line-height'] = '80%'");
48   // font-size * line-height == 30px * 80% == 24px
49   shouldBeEqualToString("window.getComputedStyle(testDivAdjust).getPropertyValue('line-height')", "24px");
50
51   evalAndLog("testDivAdjust.style['line-height'] = '12px'");
52   // line-height * -webkit-text-size-adjust == 12px * 150% == 18px
53   shouldBeEqualToString("window.getComputedStyle(testDivAdjust).getPropertyValue('line-height')", "18px");
54 }
55 </script>
56 <script src="../../resources/js-test-post.js"></script>
57 </body>
58 </html>