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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <script>
4 function check_rect_bbox(bbox, test_name)
5 {
6 var result_str = "";
7 var visible_rect = document.querySelector("#r1");
8 var expected_bbox = visible_rect.getBBox();
9
10 if (bbox.x == expected_bbox.x && bbox.y == expected_bbox.y && bbox.width == expected_bbox.width && bbox.height == expected_bbox.height) {
11 result_str = "Passed";
12 } else {
13 result_str += test_name + ": Failed";
14 result_str += "("+bbox.x+","+bbox.y+":"+bbox.width + "," + bbox.heig ht+")";
15 visible_rect.setAttribute("fill", "red");
16
17 var bbox_rect = document.createElementNS("http://www.w3.org/2000/svg ", "rect");
18 bbox_rect.setAttribute("x", bbox.x);
19 bbox_rect.setAttribute("y", bbox.y);
20 bbox_rect.setAttribute("width", bbox.width);
21 bbox_rect.setAttribute("height", bbox.height);
22 bbox_rect.setAttribute("fill", "none");
23 bbox_rect.setAttribute("stroke", "red");
24 bbox_rect.setAttribute("stroke-dasharray", "5 5");
25 document.querySelector("svg").appendChild(bbox_rect);
26 }
27
28 var p_result = document.querySelector("#result");
29 p_result.appendChild(document.createTextNode(result_str + "; "));
30 }
31
32 function run()
33 {
34 if (window.testRunner)
35 testRunner.dumpAsText();
36
37 var g_bbox = document.querySelector("#g1").getBBox();
38 check_rect_bbox(g_bbox, "Group with hidden child");
39 }
40 </script>
41
42 <body onload="run()">
43 <p>Bug <a href="https://bugs.webkit.org/show_bug.cgi?id=134184">134184</a>: Boun ding box of hidden child is unioned with other elements of group</p>
44 <p>For this test to pass, you should see 'Passed' below.</a>
45 <p id="result"></p>
46 <svg xmlns="http://www.w3.org/2000/svg">
47 <g id="g1">
48 <rect id="r1" x="50" y="50" width="50" height="50" fill="green" />
49 <rect id="r2" x="20" y="20" width="20" height="0" fill="red" />
50 <rect id="r3" x="120" y="20" width="20" height="20" fill="blue" style="displ ay:none" />
51 <ellipse id="c1" cx="20" cy="120" rx="0" ry="20" fill="black" />
52 <g>
53 <rect id="r4" x="120" y="120" width="-1" height="100" fill="cyan" />
54 </g>
55 </g>
56 </svg>
57 </body>
58 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698