eaed67ac6f220055366b9ef4b28114b9498dad7b
[WebKit-https.git] / LayoutTests / fast / sub-pixel / boundingclientrect-subpixel-margin.html
1 <!DOCTYPE html>
2 <html>
3     <head>
4         <script src="../js/resources/js-test-pre.js"></script>
5     </head>
6     <body style="margin: 0; padding: 0;">
7         <div style="margin: 0; width: 700px; margin: 10px; background: black; overflow: hidden;">
8             <div id="test" style="width: 697px; height: 200px; background-color: red; margin: 0 auto"></div>
9         </div>
10         <script>
11             var testEl = document.getElementById('test');
12             var testRect = testEl.getBoundingClientRect();
13             var parentRect = testEl.parentElement.getBoundingClientRect();
14
15             var expectedMarginWidth = String((parentRect.width - testRect.width) / 2);
16             shouldBe('testRect.left - parentRect.left', expectedMarginWidth);
17             shouldBe('parentRect.right - testRect.right', expectedMarginWidth);
18         </script>
19     </body>
20 </html>