Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <style> | |
| 4 * { font-size: 16px; } | |
| 5 svg, rect { font-family: 'Ahem'; } | |
| 6 div { font-size: 8px; } | |
| 7 </style> | |
| 8 <html> | |
| 9 <svg id="svg" width="0" height="0"></svg> | |
| 10 <script src="../../resources/js-test.js"></script> | |
| 11 <script> | |
| 12 description("Test that 'length' presentation attribute values are parsed with CS S presentation rules."); | |
| 13 | |
| 14 function computedStyle(property, value) { | |
| 15 var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect'); | |
| 16 document.getElementById('svg').appendChild(rect); | |
| 17 rect.setAttribute(property, value); | |
| 18 var computedValue = getComputedStyle(rect).getPropertyValue(property); | |
| 19 document.getElementById('svg').removeChild(rect); | |
| 20 return computedValue; | |
| 21 } | |
| 22 | |
| 23 function testComputed(property, value, expected) { | |
| 24 shouldBeEqualToString('computedStyle("' + property + '", "' + value + '")', expected); | |
| 25 } | |
| 26 | |
| 27 function negativeTest(property, value) { | |
| 28 testComputed(property, value, "auto"); | |
| 29 } | |
| 30 | |
| 31 function negativeTestZero(property, value) { | |
| 32 testComputed(property, value, "0px"); | |
| 33 } | |
| 34 | |
| 35 // Test 'width'. | |
| 36 //testComputed("width", "auto", "auto"); | |
| 37 //testComputed("width", " 100", "100px"); | |
|
fs
2015/02/06 11:54:00
Remove or uncomment (i.e. either add when adding '
Erik Dahlström (inactive)
2015/02/06 13:19:53
Done.
| |
| 38 //testComputed("width", "100 ", "100px"); | |
| 39 //testComputed("width", "100px", "100px"); | |
| 40 //testComputed("width", "1em", "16px"); | |
| 41 //testComputed("width", "1ex", "12.8000001907349px"); | |
| 42 //testComputed("width", "20%", "20%"); | |
| 43 // FIXME: Vieport units not implemented for SVG at the moment. | |
| 44 // testComputed("width", "1vh", "7.869999885559082px"); | |
| 45 // testComputed("width", "1vw", "14.029999732971191px"); | |
| 46 | |
| 47 // Test 'x'. | |
| 48 testComputed("x", " 100", "100px"); | |
| 49 testComputed("x", "100 ", "100px"); | |
| 50 testComputed("x", "100px", "100px"); | |
| 51 testComputed("x", "1em", "16px"); | |
| 52 // testComputed("x", "1ex", "12.8000001907349px"); // enable this again once htt p://crbug.com/441840 is fixed | |
|
fs
2015/02/06 11:54:00
Maybe let this run, and have it be "XFAIL" (with a
Erik Dahlström (inactive)
2015/02/06 13:19:53
Not possible since it only fails on mac.
fs
2015/02/06 13:31:56
Acknowledged.
| |
| 53 testComputed("x", "20%", "20%"); | |
| 54 testComputed("x", "-200px", "-200px"); | |
| 55 | |
| 56 // Test 'y'. | |
| 57 testComputed("y", " 100", "100px"); | |
| 58 testComputed("y", "100 ", "100px"); | |
| 59 testComputed("y", "100px", "100px"); | |
| 60 testComputed("y", "1em", "16px"); | |
| 61 // testComputed("y", "1ex", "12.8000001907349px"); // enable this again once htt p://crbug.com/441840 is fixed | |
| 62 testComputed("y", "20%", "20%"); | |
| 63 testComputed("y", "-200px", "-200px"); | |
| 64 | |
| 65 // Negative tests for 'width'. | |
| 66 //negativeTest("width", "100 px"); | |
| 67 //negativeTest("width", "100px;"); | |
| 68 //negativeTest("width", "100px !important"); | |
| 69 //negativeTest("width", "{ 100px }"); | |
| 70 //negativeTest("width", "-100px"); | |
| 71 | |
| 72 // Negative tests for 'x'. | |
| 73 negativeTestZero("x", "auto", "auto"); | |
| 74 negativeTestZero("x", "100 px"); | |
| 75 negativeTestZero("x", "100px;"); | |
| 76 negativeTestZero("x", "100px !important"); | |
| 77 negativeTestZero("x", "{ 100px }"); | |
| 78 | |
| 79 // Negative tests for 'y'. | |
| 80 negativeTestZero("y", "auto"); | |
| 81 negativeTestZero("y", "100 px"); | |
| 82 negativeTestZero("y", "100px;"); | |
| 83 negativeTestZero("y", "100px !important"); | |
| 84 negativeTestZero("y", "{ 100px }"); | |
| 85 </script> | |
| 86 </body> | |
| 87 </html> | |
| OLD | NEW |