REGRESSION(SUBPIXEL_LAYOUT) Composited layers can cause one pixel shifts
[WebKit-https.git] / LayoutTests / fast / sub-pixel / tiled-canvas-elements.html
1 <!DOCTYPE html>
2 <html>
3     <head>
4         <style>
5             #console { margin-top: 40px; }
6         </style>
7         <script src="../js/resources/js-test-pre.js"></script>
8     </head>
9
10     <body style="zoom: 1.1">
11         <div>
12             <canvas style="position: absolute; top: 0px; left: 0px; background-color: black;" width="32" height="32"></canvas>
13             <canvas style="position: absolute; top: 0px; left: 32px; background-color: black;" width="32" height="32"></canvas>
14             <canvas style="position: absolute; top: 0px; left: 64px; background-color: black;" width="32" height="32"></canvas>
15             <canvas style="position: absolute; top: 0px; left: 96px; background-color: black;" width="32" height="32"></canvas>
16         </div>
17
18         <script>
19             function r(n) {
20                 return Math.round(n * 1000) / 1000;
21             }
22             
23             var expected = 0;
24             var elements = document.getElementsByTagName('canvas');
25             for (var el, i = 0; el = elements[i]; i++) {
26                 var rect = el.getBoundingClientRect();
27                 if (Math.round(expected) == Math.round(rect.left))
28                     testPassed('Left edge of block lines up with right edge of previous block.');
29                 else
30                     shouldBe('Math.round(rect.left)', String(Math.round(expected)));
31                 expected += rect.width;
32             }
33         </script>
34     </body>
35 </html>