2 <title>getScreenCTM tests
</title>
3 <script src=../../resources/testharness.js
></script>
4 <script src=../../resources/testharnessreport.js
></script>
5 <div id=
"testcontainer">
13 #a, #c, #d, #e { width:
50px; height:
100px }
15 <svg id=
"a" width=
"100" height=
"200"/>
16 <svg id=
"b" width=
"100" height=
"200"/>
17 <svg id=
"c" width=
"100" height=
"200" viewBox=
"0 0 100 200"/>
18 <svg id=
"d" viewBox=
"0 0 100 200"/>
19 <svg id=
"e" viewBox=
"0 0 200 400">
20 <svg id=
"f" viewBox=
"0 0 100 200">
27 function ctmToString(ctm
) {
28 return [ ctm
.a
, ctm
.b
, ctm
.c
, ctm
.d
, ctm
.e
, ctm
.f
].join(' ');
32 var ctm
= ctmToString(document
.getElementById("a").getScreenCTM());
33 assert_equals(ctm
, "1 0 0 1 0 0", "");
34 }, "css defined viewport");
37 var ctm
= ctmToString(document
.getElementById("b").getScreenCTM());
38 assert_equals(ctm
, "1 0 0 1 0 0", "");
39 }, "svg defined viewport");
42 var ctm
= ctmToString(document
.getElementById("c").getScreenCTM());
43 assert_equals(ctm
, "0.5 0 0 0.5 0 0", "");
44 }, "css defined viewport + svg has w, h, viewBox");
47 var ctm
= ctmToString(document
.getElementById("d").getScreenCTM());
48 assert_equals(ctm
, "0.5 0 0 0.5 0 0", "");
49 }, "css defined viewport + svg has viewBox");
52 var ctm
= ctmToString(document
.getElementById("f").getScreenCTM());
53 assert_equals(ctm
, "0.5 0 0 0.5 0 0", "");
57 var ctm
= ctmToString(document
.getElementById("g").getScreenCTM());
58 assert_equals(ctm
, "0.5 0 0 0.5 0 0", "");
59 }, "g child of nested svg");