Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / shapes / shape-outside-floats / shape-outside-rounded-boxes-001.html
blobd7f78c4aef29241fd3e87f72b686b762d65835db
1 <html>
2 <head>
3 <script src="../../../resources/js-test.js"></script>
4 <script src="../resources/subpixel-utils.js"></script>
5 <style>
6 #container {
7 font: 20px/1 Ahem, sans-serif;
8 width: 200px;
9 height: 120px;
10 color: rgba(0,0,200, 0.25);
11 margin: 25px;
12 background-color: grey;
15 #left-border-box {
16 float: left;
17 border-top-right-radius: 100px 30px;
18 border-bottom-right-radius: 100px 30px;
19 shape-outside: border-box;
20 width: 100px;
21 height: 80px;
22 margin-top: 20px;
23 margin-bottom: 20px;
24 background-color: blue;
25 background-clip: border-box;
27 </style>
28 </head>
29 <body>
30 <div id="container">
31 <div id="left-border-box"></div>
32 <span id="a">X</span><br>
33 <span id="b">X</span><br>
34 <span id="c">X</span><br>
35 <span id="d">X</span><br>
36 <span id="e">X</span><br>
37 <span id="f">X</span>
38 </div>
39 <div id="console"></div>
40 </body>
41 <script>
42 function elementRect(elementId)
44 var s = document.getElementById("container").getBoundingClientRect();
45 var r = document.getElementById(elementId).getBoundingClientRect();
46 return {left: r.left - s.left, top: r.top - s.top, width: r.width, height: r.height};
49 // You'll find the equation for the X intercept of an elliptical arc here (among other places):
50 // http://hansmuller-webkit.blogspot.com/2012/07/computing-horizonal-rounded-rectangle.html
52 function cornerEllipseRightXIntercept(y, cx, rx, ry)
54 return SubPixelLayout.snapToLayoutUnit(cx + rx * Math.sqrt(1 - Math.pow((ry - y) / ry, 2)));
57 var quiet = true; // PASS output depends on SubPixelLayout.isEnabled()
59 shouldBe("elementRect('a').top", "0");
60 shouldBe("elementRect('a').left", "0");
62 shouldBe("elementRect('b').top", "20");
63 shouldBeCloseTo("elementRect('b').left", cornerEllipseRightXIntercept(40, 0, 100, 30), SubPixelLayout.resolution(), quiet);
65 shouldBe("elementRect('c').top", "40");
66 shouldBe("elementRect('c').left", "100");
68 shouldBe("elementRect('d').top", "60");
69 shouldBe("elementRect('d').left", "100");
71 shouldBe("elementRect('e').top", "80");
72 shouldBeCloseTo("elementRect('e').left", cornerEllipseRightXIntercept(40, 0, 100, 30), SubPixelLayout.resolution(), quiet);
74 shouldBe("elementRect('f').top", "100");
75 shouldBe("elementRect('f').left", "0");
77 var container = document.getElementById("container");
78 container.parentNode.removeChild(container);
79 </script>
80 </html>