blob: 413e86cf5c288cdcd18d39203a67121e926f3e6d [file] [log] [blame]
<!DOCTYPE html>
<html>
<script>
function check_rect_bbox(bbox, expected_bbox, test_name)
{
var result = true;
var result_str = "";
if (bbox.x == expected_bbox.x && bbox.y == expected_bbox.y && bbox.width == expected_bbox.width && bbox.height == expected_bbox.height) {
result_str = "Passed";
} else {
result_str += test_name + ": Failed";
result_str += "("+bbox.x+","+bbox.y+":"+bbox.width + "," + bbox.height+")";
result = false;
}
var p_result = document.querySelector("#result");
p_result.appendChild(document.createTextNode(result_str + "; "));
return result;
}
function run()
{
if (window.testRunner)
testRunner.dumpAsText();
var p_bbox = document.querySelector("#p1").getBBox();
var g_bbox = document.querySelector("g").getBBox();
var result = true;
result &= check_rect_bbox(p_bbox, {"x":0, "y":0, "width":0, "height":0}, "getBBox on path with no d attribute")
result &= check_rect_bbox(g_bbox, document.querySelector("#r1").getBBox(),"path doesn't contribute to parent bbox")
if (!result) {
var visible_rect = document.querySelector("#r1");
visible_rect.setAttribute("fill", "red");
}
}
</script>
<body onload="run()">
<p>Bug <a href="https://bugs.webkit.org/show_bug.cgi?id=134184">134184</a>: getBBox on path with no d attribute should return (0,0,0,0) and should not contribute to parent bbox</p>
<p>For this test to pass, you should see 'Passed' twice below.</a>
<p id="result"></p>
<svg xmlns="http://www.w3.org/2000/svg">
<g>
<path id="p1" fill="none" stroke="red" />
<rect id="r1" x="50" y="50" width="50" height="50" fill="green" />
</g>
</svg>
</body>
</html>