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

Unified Diff: LayoutTests/svg/custom/getBBox-container-hiddenchild.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-container-hiddenchild.html
diff --git a/LayoutTests/svg/custom/getBBox-container-hiddenchild.html b/LayoutTests/svg/custom/getBBox-container-hiddenchild.html
new file mode 100644
index 0000000000000000000000000000000000000000..f3b8e54a554072a2ef86d3a5acb62b8de4f6ecce
--- /dev/null
+++ b/LayoutTests/svg/custom/getBBox-container-hiddenchild.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+ <script>
+ function check_rect_bbox(bbox, test_name)
+ {
+ var result_str = "";
+ var visible_rect = document.querySelector("#r1");
+ var expected_bbox = visible_rect.getBBox();
+
+ 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+")";
+ visible_rect.setAttribute("fill", "red");
+
+ var bbox_rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
+ bbox_rect.setAttribute("x", bbox.x);
+ bbox_rect.setAttribute("y", bbox.y);
+ bbox_rect.setAttribute("width", bbox.width);
+ bbox_rect.setAttribute("height", bbox.height);
+ bbox_rect.setAttribute("fill", "none");
+ bbox_rect.setAttribute("stroke", "red");
+ bbox_rect.setAttribute("stroke-dasharray", "5 5");
+ document.querySelector("svg").appendChild(bbox_rect);
+ }
+
+ var p_result = document.querySelector("#result");
+ p_result.appendChild(document.createTextNode(result_str + "; "));
+ }
+
+ function run()
+ {
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ var g_bbox = document.querySelector("#g1").getBBox();
+ check_rect_bbox(g_bbox, "Group with hidden child");
+ }
+ </script>
+
+<body onload="run()">
+<p>Bug <a href="https://bugs.webkit.org/show_bug.cgi?id=134184">134184</a>: Bounding box of hidden child is unioned with other elements of group</p>
+<p>For this test to pass, you should see 'Passed' below.</a>
+<p id="result"></p>
+<svg xmlns="http://www.w3.org/2000/svg">
+<g id="g1">
+ <rect id="r1" x="50" y="50" width="50" height="50" fill="green" />
+ <rect id="r2" x="20" y="20" width="20" height="0" fill="red" />
+ <rect id="r3" x="120" y="20" width="20" height="20" fill="blue" style="display:none" />
+ <ellipse id="c1" cx="20" cy="120" rx="0" ry="20" fill="black" />
+ <g>
+ <rect id="r4" x="120" y="120" width="-1" height="100" fill="cyan" />
+ </g>
+</g>
+</svg>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698