OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <script> |
| 4 function check_rect_bbox(bbox, expected_bbox, test_name) |
| 5 { |
| 6 var result = true; |
| 7 var result_str = ""; |
| 8 |
| 9 if (bbox.x == expected_bbox.x && bbox.y == expected_bbox.y && bbox.width
== expected_bbox.width && bbox.height == expected_bbox.height) { |
| 10 result_str = "Passed"; |
| 11 } else { |
| 12 result_str += test_name + ": Failed"; |
| 13 result_str += "("+bbox.x+","+bbox.y+":"+bbox.width + "," + bbox.heig
ht+")"; |
| 14 result = false; |
| 15 } |
| 16 |
| 17 var p_result = document.querySelector("#result"); |
| 18 p_result.appendChild(document.createTextNode(result_str + "; ")); |
| 19 return result; |
| 20 } |
| 21 |
| 22 function run() |
| 23 { |
| 24 if (window.testRunner) |
| 25 testRunner.dumpAsText(); |
| 26 |
| 27 var p_bbox = document.querySelector("#p1").getBBox(); |
| 28 var g_bbox = document.querySelector("g").getBBox(); |
| 29 |
| 30 var result = true; |
| 31 |
| 32 result &= check_rect_bbox(p_bbox, {"x":0, "y":0, "width":0, "height":0},
"getBBox on path with no d attribute") |
| 33 result &= check_rect_bbox(g_bbox, document.querySelector("#r1").getBBox(
),"path doesn't contribute to parent bbox") |
| 34 |
| 35 if (!result) { |
| 36 var visible_rect = document.querySelector("#r1"); |
| 37 visible_rect.setAttribute("fill", "red"); |
| 38 } |
| 39 } |
| 40 </script> |
| 41 |
| 42 <body onload="run()"> |
| 43 <p>Bug <a href="https://bugs.webkit.org/show_bug.cgi?id=134184">134184</a>: getB
Box on path with no d attribute should return (0,0,0,0) and should not contribut
e to parent bbox</p> |
| 44 <p>For this test to pass, you should see 'Passed' twice below.</a> |
| 45 <p id="result"></p> |
| 46 <svg xmlns="http://www.w3.org/2000/svg"> |
| 47 <g> |
| 48 <path id="p1" fill="none" stroke="red" /> |
| 49 <rect id="r1" x="50" y="50" width="50" height="50" fill="green" /> |
| 50 <!-- The following path should be included in the bbox. --> |
| 51 <path d=" |
| 52 </g> |
| 53 </svg> |
| 54 </body> |
| 55 </html> |
OLD | NEW |