Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / shapes / shape-outside-floats / shape-outside-big-box-border-radius-001.html
1 <!DOCTYPE html>
2 <script src="../../../resources/js-test.js"></script>
3 <script src="../resources/subpixel-utils.js"></script>
4 <style>
5 #container {
6     width: 300px;
7     font: 20px/1 Ahem;
8     color: green;
9 }
10
11 #float {
12     float: left;
13     width: 100px;
14     height: 100px;
15     border-radius: 100px 0px;
16     background-color: blue;
17     background-clip: border-box;
18     shape-outside: border-box;
19 }
20 </style>
21 <body>
22     <p>The green squares should follow the right side of the blue shape. They should not overlap the shape.</p>
23     <div id="container">
24         <div id="float"></div>
25         <span id="a">X</span><br>
26         <span id="b">X</span><br>
27         <span id="c">X</span><br>
28         <span id="d">X</span><br>
29         <span id="e">X</span><br>
30         <span id="f">X</span>
31     </div>
32     <div id="console"></div>
33 </body>
34 <script>
35 function elementRect(elementId) 
36 {
37     var s = document.getElementById("container").getBoundingClientRect();
38     var r = document.getElementById(elementId).getBoundingClientRect();
39     return {right: (r.left - s.left) + r.width, top: r.top - s.top, width: r.width, height: r.height};
40 }
41
42 function borderXIntercept(y) 
43 {
44     var radiusSquared = 100 * 100;
45     var f = SubPixelLayout.snapToLayoutUnit(Math.sqrt(radiusSquared - y * y));
46     return f + 20;  // will be compared with the right edge of a 20x20 Ahem char cell
47 }
48
49 var quiet = true; // PASS output depends on SubPixelLayout.isEnabled()
50
51 shouldBe("elementRect('a').top", "0");
52 shouldBe("elementRect('a').right", "120");
53
54 shouldBe("elementRect('b').top", "20");
55 shouldBeCloseTo("elementRect('b').right", borderXIntercept(20), 1, quiet);
56
57 shouldBe("elementRect('c').top", "40");
58 shouldBeCloseTo("elementRect('c').right", borderXIntercept(40), 1, quiet);
59
60 shouldBe("elementRect('d').top", "60");
61 shouldBeCloseTo("elementRect('d').right", borderXIntercept(60), 1, quiet);
62
63 shouldBe("elementRect('e').top", "80");
64 shouldBeCloseTo("elementRect('e').right", borderXIntercept(80), 1, quiet);
65
66 shouldBe("elementRect('f').top", "100");
67 shouldBe("elementRect('f').right", "20");
68 </script>