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

Side by Side Diff: LayoutTests/fast/svg/getbbox.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: fix nit 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 <title>getBBox tests</title>
3 <script src=../../resources/testharness.js></script>
4 <script src=../../resources/testharnessreport.js></script>
5 <div id="testcontainer">
6 <svg width="1" height="1" visibility="hidden">
7 <g id="g1">
8 <polygon id="p1" fill="none" stroke="red" />
9 <rect id="r1" x="50" y="50" width="50" height="50" fill="green" />
10 </g>
11 <g id="g2">
12 <rect id="r2" x="50" y="50" width="50" height="50" fill="green" />
13 <rect id="r3" x="20" y="20" width="20" height="0" fill="red" />
14 <rect id="r4" x="120" y="20" width="20" height="20" fill="blue" style="displ ay:none" />
15 <ellipse id="c1" cx="20" cy="120" rx="0" ry="20" fill="black" />
16 <g>
17 <rect id="r5" x="120" y="120" width="-1" height="100" fill="cyan" />
18 </g>
19 </g>
20 <g id="g3">
21 <path id="p2" fill="none" stroke="red" />
22 <rect id="r6" x="50" y="50" width="50" height="50" fill="green" />
23 <!-- The following path should be included in the bbox. -->
24 <path d=""
25 </g>
26 <g id="g4">
27 <polyline id="p3" fill="none" stroke="red" />
28 <rect id="r7" x="50" y="50" width="50" height="50" fill="green" />
29 </g>
30 <g id="g5">
31 <path id="p4" d="M3"/>
32 <rect id="r8" x="50" y="50" width="50" height="50" fill="green" />
33 </g>
34 <g id="g6">
35 <polygon id="p5" points="47" fill="none" stroke="red" />
36 <rect id="r9" x="50" y="50" width="50" height="50" fill="green" />
37 </g>
38 <g id="g7">
39 <polyline id="p6" points="47" fill="none" stroke="red" />
40 <rect id="r10" x="50" y="50" width="50" height="50" fill="green" />
41 </g>
42 </svg>
43 </div>
44 <div id=log></div>
45 <script>
46 var EPSILON = Math.pow(2, -24); // float epsilon
47
48 function assert_rect_approx_equals(rect, expected, epsilon) {
49 assert_approx_equals(rect.x, expected.x, epsilon, "x");
50 assert_approx_equals(rect.y, expected.y, epsilon, "y");
51 assert_approx_equals(rect.width, expected.width, epsilon, "width");
52 assert_approx_equals(rect.height, expected.height, epsilon, "height");
53 }
54
55 test(function() {
56 assert_rect_approx_equals(document.getElementById("p1").getBBox(), {"x": 0, "y":0, "width":0, "height":0 }, EPSILON);
57 }, "getBBox on polygon with no points attribute");
58 test(function() {
59 assert_rect_approx_equals(document.getElementById("p3").getBBox(), {"x": 0, "y":0, "width":0, "height":0}, EPSILON);
60 }, "getBBox on polyline with no points attribute");
61 test(function() {
62 assert_rect_approx_equals(document.getElementById("p2").getBBox(), {"x": 0, "y":0, "width":0, "height":0 }, EPSILON);
63 }, "getBBox on path with no d attribute");
64 test(function() {
65 assert_rect_approx_equals(document.getElementById("p4").getBBox(), {"x": 0, "y":0, "width":0, "height":0 }, EPSILON);
66 }, "getBBox on path with no valid path segments in d attribute");
67 test(function() {
68 assert_rect_approx_equals(document.getElementById("p5").getBBox(), {"x": 0, "y":0, "width":0, "height":0 }, EPSILON);
69 }, "getBBox on polygon with no valid point in the points attribute");
70 test(function() {
71 assert_rect_approx_equals(document.getElementById("p6").getBBox(), {"x": 0, "y":0, "width":0, "height":0 }, EPSILON);
72 }, "getBBox on polyline with no valid point in the points attribute");
73 test(function() {
74 assert_rect_approx_equals(document.getElementById("g1").getBBox(), docum ent.getElementById("r1").getBBox(), EPSILON);
75 }, "polygon doesn't contribute to parent bbox");
76 test(function() {
77 assert_rect_approx_equals(document.getElementById("g1").getBBox(), docum ent.getElementById("r2").getBBox(), EPSILON);
78 }, "group with hidden child");
79 test(function() {
80 assert_rect_approx_equals(document.getElementById("g3").getBBox(), docum ent.getElementById("r6").getBBox(), EPSILON);
81 }, "path doesn't contribute to parent bbox");
82 test(function() {
83 assert_rect_approx_equals(document.getElementById("g5").getBBox(), docum ent.getElementById("r8").getBBox(), EPSILON);
84 }, "path with only invalid segments doesn't contribute to parent bbox");
85 test(function() {
86 assert_rect_approx_equals(document.getElementById("g4").getBBox(), docum ent.getElementById("r7").getBBox(), EPSILON);
87 }, "polyline doesn't contribute to parent bbox");
88 test(function() {
89 assert_rect_approx_equals(document.getElementById("g6").getBBox(), docum ent.getElementById("r9").getBBox(), EPSILON);
90 }, "polygon with no valid points doesn't contribute to parent bbox");
91 test(function() {
92 assert_rect_approx_equals(document.getElementById("g7").getBBox(), docum ent.getElementById("r10").getBBox(), EPSILON);
93 }, "polyline with no valid points doesn't contribute to parent bbox");
94
95 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698