| <!DOCTYPE HTML> |
| <div id="dummy"></div> |
| <div id="results">This tests parse time simplification in calc()<br><br></div> |
| <script> |
| if (window.testRunner) |
| window.testRunner.dumpAsText(); |
| |
| var tests = [ |
| "100px * (25 + 5)", |
| "100em * (25 - 5)", |
| "100ex * (2 * 5 - 5)", |
| "100cm * (5 - 4 / 5)", |
| "100mm * (2.4 * 5 - 8 / 5)", |
| "100in * (6 * (5 - 4) / 8)", |
| "1px * (3 + 1/(7 + 1/(15 + 1/(1 + 1/(292 + 1/(1 + 1/(1 + 1/(1 + 1))))))))", |
| "100pc * 20 + 100rem * 10 - 100ch * 5 + 100pc", |
| "((100px + 20 * 5px) * 10 - 5 * (10em * 5 + 10em)) * 2", |
| "100px + 1in", |
| "10 * 10px + 0.5 * 2in", |
| "100px + 1in + 10%", |
| "100px - 1in", |
| "50cm + 50cm", |
| "50cm + 10in + 100mm", |
| "100px + 1em", |
| "100px + 1em + 100px", |
| "1em + 1rem", |
| ]; |
| |
| var results = document.getElementById("results"); |
| var dummy = document.getElementById("dummy"); |
| for (var i = 0; i < tests.length; ++i) { |
| var expression = tests[i]; |
| dummy.style.width = 'calc(' + expression + ')'; |
| results.innerHTML += expression + " => " + dummy.style.width + "<br>"; |
| } |
| </script> |