3 <script src=
"../../../resources/js-test.js"></script>
4 <script src=
"../resources/subpixel-utils.js"></script>
7 font:
20px/
1 Ahem, sans-serif;
10 color: rgba(
0,
0,
200,
0.25);
12 background-color: grey;
17 border-top-right-radius:
100px
30px;
18 border-bottom-right-radius:
100px
30px;
19 shape-outside: border-box;
24 background-color: blue;
25 background-clip: border-box;
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>
39 <div id=
"console"></div>
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
);