Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / sub-pixel / boundingclientrect-subpixel-margin.html
blobb4abc2d52005ee775c0c002c07051ad4ebc3cad7
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.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();
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>