2 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
3 <link rel=
"stylesheet" href=
"/tests/SimpleTest/test.css">
5 <p>Test intrinsic sizing of embed elements referencing SVG documents, both same
6 origin and cross origin.
</p>
8 <div id=
"container" style=
"width: 500px;"></div>
12 { outer
: "none", inner
: "none", expected
: "300x150" },
13 { outer
: "none", inner
: "size", expected
: "200x900" },
14 { outer
: "none", inner
: "ratio", expected
: "500x2500" },
15 { outer
: "none", inner
: "both", expected
: "200x400" },
16 { outer
: "size", inner
: "none", expected
: "100x150" },
17 { outer
: "size", inner
: "size", expected
: "100x450" },
18 { outer
: "size", inner
: "ratio", expected
: "100x500" },
19 { outer
: "size", inner
: "both", expected
: "100x200" },
20 { outer
: "ratio", inner
: "none", expected
: "500x1500" },
21 { outer
: "ratio", inner
: "size", expected
: "200x900" },
22 { outer
: "ratio", inner
: "ratio", expected
: "500x1500" },
23 { outer
: "ratio", inner
: "both", expected
: "200x400" },
24 { outer
: "both", inner
: "none", expected
: "100x300" },
25 { outer
: "both", inner
: "size", expected
: "100x300" },
26 { outer
: "both", inner
: "ratio", expected
: "100x300" },
27 { outer
: "both", inner
: "both", expected
: "100x300" },
30 add_task(async
function() {
31 for (let test
of TESTS
) {
32 for (let crossorigin
of [false, true]) {
33 let host
= crossorigin
? "http://example.org" : "http://mochi.test:8888";
34 let e
= document
.createElement("embed");
40 e
.style
.width
= "100px";
43 e
.style
.aspectRatio
= "1 / 3";
46 e
.style
.width
= "100px";
47 e
.style
.aspectRatio
= "1 / 3";
50 throw new Error("unexpected subtest");
53 await
new Promise(function(resolve
) {
54 e
.src
= host
+ location
.pathname
.replace("test_embed_sizing.html", `file_embed_sizing_${test.inner}.svg`);
59 let desc
= `Subtest (${test.outer}/${test.inner}/${crossorigin ? 'cross' : 'same'} origin)`;
60 is(`${e.offsetWidth}x${e.offsetHeight}`, test
.expected
, desc
);