2 <script src="../../../resources/js-test.js"></script>
3 <script src="../resources/subpixel-utils.js"></script>
15 border-radius: 100px 0px;
16 background-color: blue;
17 background-clip: border-box;
18 shape-outside: border-box;
22 <p>The green squares should follow the right side of the blue shape. They should not overlap the shape.</p>
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>
32 <div id="console"></div>
35 function elementRect(elementId)
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};
42 function borderXIntercept(y)
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
49 var quiet = true; // PASS output depends on SubPixelLayout.isEnabled()
51 shouldBe("elementRect('a').top", "0");
52 shouldBe("elementRect('a').right", "120");
54 shouldBe("elementRect('b').top", "20");
55 shouldBeCloseTo("elementRect('b').right", borderXIntercept(20), 1, quiet);
57 shouldBe("elementRect('c').top", "40");
58 shouldBeCloseTo("elementRect('c').right", borderXIntercept(40), 1, quiet);
60 shouldBe("elementRect('d').top", "60");
61 shouldBeCloseTo("elementRect('d').right", borderXIntercept(60), 1, quiet);
63 shouldBe("elementRect('e').top", "80");
64 shouldBeCloseTo("elementRect('e').right", borderXIntercept(80), 1, quiet);
66 shouldBe("elementRect('f').top", "100");
67 shouldBe("elementRect('f').right", "20");