zalan@apple.com | 16a7f5c | 2014-05-24 14:50:42 +0000 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>This tests if negative coordinate values round to the same position as if they were positive.</title> |
| 5 | <style> |
| 6 | .inner { |
| 7 | position: relative; |
| 8 | top: 0px; |
| 9 | left: 0px; |
| 10 | width: 2px; |
| 11 | height: 2px; |
| 12 | border: solid black 0.5px; |
| 13 | } |
| 14 | |
| 15 | .outer { |
| 16 | position: absolute; |
| 17 | top: 0px; |
| 18 | left: 0px; |
| 19 | } |
| 20 | </style> |
| 21 | </head> |
| 22 | <body> |
| 23 | <p id="container"></p> |
| 24 | <script> |
| 25 | var container = document.getElementById("container"); |
| 26 | for (i = 0; i < 40; ++i) { |
| 27 | adjustment = 0; |
| 28 | for (j = 0; j < 40; ++j) { |
| 29 | var outer = document.createElement("div"); |
| 30 | outer.style.top = 7 * (i + j * adjustment) + "px"; |
| 31 | outer.style.left = 7 * (j + i * adjustment) + "px"; |
| 32 | outer.className = "outer"; |
| 33 | |
| 34 | var inner = document.createElement("div"); |
| 35 | inner.style.top = (-adjustment) + "px"; |
| 36 | inner.style.left = (-adjustment) + "px"; |
| 37 | inner.className = "inner"; |
| 38 | adjustment += 0.01; |
| 39 | |
| 40 | outer.appendChild(inner); |
| 41 | container.appendChild(outer); |
| 42 | } |
| 43 | } |
| 44 | </script> |
| 45 | </body> |
| 46 | </html> |