Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css / round-trip-values.html
blobaf21f2a40729ccdf966335d8d8fa5942ace5369e
1 <!DOCTYPE HTML>
3 <html>
4 <head>
5 <style>
6 body {
7 font-family: sans-serif;
8 font-size: 0.8em;
11 code {
12 font-family: workaround, monospace;
15 .heading {
16 background: #eee;
17 font-weight: bold;
19 </style>
20 </head>
21 <body>
22 <p>For each input on the left, this table lists what happens when you
23 pass it into a CSS property and retrieve its value back. The third column
24 indicates whether the value was round-tripped faithfully.</p>
26 <div id='test'></div>
27 <table id='table'>
28 </table>
30 <script>
31 if (window.testRunner)
32 testRunner.dumpAsText();
34 var table = document.getElementById('table');
35 var div = document.getElementById('test');
37 function heading(text) {
38 var tr = document.createElement('tr');
39 tr.className = 'heading';
40 var td = document.createElement('td');
41 td.colSpan = 3;
42 td.align = 'center'
43 td.appendChild(document.createTextNode(text));
44 tr.appendChild(td);
46 table.appendChild(tr);
49 function evaluate(code) {
50 var result = eval(code);
51 var tr = document.createElement('tr');
53 var td = document.createElement('td');
54 var text = document.createElement('code');
55 text.appendChild(document.createTextNode(code));
56 td.appendChild(text);
57 tr.appendChild(td);
59 div.style.opacity = eval(code);
61 var td = document.createElement('td');
62 var text = document.createElement('code');
63 text.appendChild(document.createTextNode(div.style.opacity));
64 td.appendChild(text);
65 tr.appendChild(td);
67 var outValue = div.style.opacity;
68 // Test round-tripping
69 div.style.opacity = 0;
70 div.style.opacity = outValue;
72 var td = document.createElement('td');
73 var text = document.createElement('span');
74 text.appendChild(document.createTextNode(outValue == div.style.opacity ? "pass" : "fail"));
75 td.appendChild(text);
76 tr.appendChild(td);
78 table.appendChild(tr);
81 heading("Basic floats");
82 evaluate("'0.0001'");
83 evaluate("0.0001");
84 evaluate("'123456.123456'");
85 evaluate("'1234567.1234567'");
86 evaluate("'12345678.12345678'");
88 heading("Trailing zeros");
89 evaluate("'0.00100000'");
90 evaluate("'0.001000001'");
91 evaluate("'0.12345000001'");
92 evaluate("'0.12304567'");
93 evaluate("'0.12340567'");
94 evaluate("'0.12345067'");
95 evaluate("'0.12345607'");
96 evaluate("'0.12345670'");
98 heading("Repeating decimals");
99 evaluate("1/3");
100 evaluate("123 + 1/3");
101 evaluate("13/99");
102 evaluate("123 + 13/99");
103 evaluate("100/999");
104 evaluate("123 + 100/999");
106 heading("Large numbers");
107 evaluate("12345678");
108 evaluate("123456789");
109 evaluate("1234567890");
110 evaluate("12345678901");
111 evaluate("123456789012");
112 evaluate("1234567890123");
113 evaluate("12345678901234");
114 evaluate("123456789012345");
115 evaluate("1234567890123456");
116 evaluate("12345678901234567");
118 heading("Weird numbers");
119 evaluate("Number.NaN");
120 evaluate("1/0");
121 evaluate("Math.sqrt(-1)");
122 evaluate("1/0.9999");
123 evaluate("1/0.99999");
124 evaluate("1/0.999999");
125 evaluate("1/0.9999999");
126 evaluate("1/0.99999999");
128 </script>
129 </body>
130 </html>