| <!DOCTYPE html> |
| <html> |
| <script> |
| function check_rect_bbox(bbox, test_name) |
| { |
| var result_str = ""; |
| |
| if (bbox.x == 50 && bbox.y == 50 && bbox.width == 50 && bbox.height == 0) { |
| result_str = "Passed"; |
| } else { |
| result_str += test_name + ": Failed"; |
| result_str += "("+bbox.x+","+bbox.y+":"+bbox.width + "," + bbox.height+")"; |
| } |
| |
| var p_result = document.querySelector("#result"); |
| p_result.appendChild(document.createTextNode(result_str + "; ")); |
| } |
| |
| function run() |
| { |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| var svg = document.querySelector("svg"); |
| var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); |
| rect.setAttribute("x", "50"); |
| rect.setAttribute("y", "50"); |
| rect.setAttribute("width", "50"); |
| rect.setAttribute("height", "0"); |
| svg.appendChild(rect); |
| check_rect_bbox(rect.getBBox(), "Rectangle with zero height"); |
| |
| rect.setAttribute("stroke-width", "10"); |
| rect.setAttribute("stroke", "red"); |
| check_rect_bbox(rect.getBBox(), "With stroke"); |
| |
| var vector_effect_orig = rect.getAttribute("vector-effect"); |
| rect.setAttribute("vector-effect", "non-scaling-stroke"); |
| check_rect_bbox(rect.getBBox(), "With non-scaling-stroke"); |
| |
| rect.setAttribute("vector-effect", vector_effect_orig); |
| rect.setAttribute("rx", "10"); |
| check_rect_bbox(rect.getBBox(), "Rounded"); |
| } |
| </script> |
| |
| <body onload="run()"> |
| <p>Bug <a href="https://bugs.webkit.org/show_bug.cgi?id=93290">93290</a>: getBBox() returns (0,0) incorrectly when width or height is zero.</p> |
| <p>For this test to pass, you should see 'Passed' four times below.</a> |
| <p id="result"></p> |
| <svg xmlns="http://www.w3.org/2000/svg"> |
| </svg> |
| </body> |
| </html> |