Add invalid bounding box concept to SVG containers
[WebKit-https.git] / LayoutTests / svg / custom / getBBox-empty-container.html
1 <!DOCTYPE html>
2 <html>
3 <!-- Test that svg bounding boxes are not affected by empty containers -->
4     <head>
5         <script type="text/javascript">
6             function checkBoundingBoxesEqual() {
7                 if (window.layoutTestController)
8                     window.layoutTestController.dumpAsText();
9
10                 // Ensure both boxes are the same size, meaning the empty <g> does not affect the bbox size.
11                 var bboxA = document.getElementById('ga').getBBox();
12                 var bboxB = document.getElementById('gb').getBBox();
13                 var results = "FAIL";
14                 if (bboxA.width == bboxB.width && bboxA.height == bboxB.height)
15                     results = "PASS";
16                 document.body.innerHTML = results + ", bounding box sizes are (" + 
17                     bboxA.width + ", " + bboxA.height + ") and (" + 
18                     bboxB.width + ", " + bboxB.height + ")";
19             }
20         </script>
21     </head>
22     <body onload="checkBoundingBoxesEqual()">
23         <svg width="400" height="400" xmlns="http://www.w3.org/2000/svg">    
24             <g id="ga">
25                 <g></g>
26                 <g transform="translate(100, 100)">
27                         <g></g>
28                     <rect x="0" y="0" width="100" height="100" rx="10" ry="10" stroke="#000000" stroke-width="1" fill="#ffffcc" />
29                 </g>
30             </g>
31             <g id="gb">
32                 <g transform="translate(100, 100)">
33                     <rect x="0" y="0" width="100" height="100" rx="10" ry="10" stroke="#000000" stroke-width="1" fill="#ffffcc" />
34                 </g>
35             </g>
36         </svg>
37     </body>
38 </html>