Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Unified Diff: LayoutTests/svg/custom/getBBox-path-nodata.html

Issue 355813004: [SVG2] Elements that don't render shouldn't contribute to ancestor bboxes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/svg/custom/getBBox-path-nodata.html
diff --git a/LayoutTests/svg/custom/getBBox-path-nodata.html b/LayoutTests/svg/custom/getBBox-path-nodata.html
new file mode 100644
index 0000000000000000000000000000000000000000..b916a7bbf4104514ca10e7d2f95c83047f6b7d02
--- /dev/null
+++ b/LayoutTests/svg/custom/getBBox-path-nodata.html
@@ -0,0 +1,55 @@
+<!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" />
+ <!-- The following path should be included in the bbox. -->
+ <path d="
+</g>
+</svg>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698