Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / custom / getscreenctm-in-mixed-content.xhtml
blobce64200dd818cab1546bcb9f1ed29bb328f1ab8b
1 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <title>Scalable Search Box</title>
6 <script>
7 <![CDATA[
9 var testMatrix;
10 var expectedMatrix = {
11 a: 2,
12 b: 0,
13 c: 0,
14 d: 2,
15 e: 30,
16 f: 100
20 function runTest () {
21 var rect = document.getElementById('rect');
22 try {
23 testMatrix = rect.getScreenCTM();
25 // end script here
26 catch (error) {
27 logError('.getScreenCTM() seems to be unimplemented');
28 return;
30 // check equality of matrices
31 if (areMatricesEqual(testMatrix, expectedMatrix)) {
32 rect.setAttributeNS(null, 'fill', 'green');
34 // explain error
35 else {
36 logError('Expected matrix ' + printMatrix(expectedMatrix));
37 logError('Got matrix ' + printMatrix(testMatrix));
41 function areMatricesEqual (m1, m2) {
42 return (
43 m1.a == m2.a &&
44 m1.b == m2.b &&
45 m1.c == m2.c &&
46 m1.d == m2.d &&
47 m1.e == m2.e &&
48 m1.f == m2.f
52 function printMatrix (m) {
53 return '[' + [m.a, m.b, m.c, m.d, m.e, m.f].join(', ') + ']';
56 function logError (msg) {
57 var output = document.getElementById('error')
58 var text = document.createTextNode(msg);
59 var br = document.createElementNS('http://www.w3.org/1999/xhtml', 'br');
60 output.appendChild(text);
61 output.appendChild(br);
64 ]]>
65 </script>
66 </head>
68 <body onload="runTest()">
69 <div style="position: absolute; left: 30px; top: 100px; width: 400px; height: 200px;">
70 <svg id="svgRoot" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 100" preserveAspectRatio="xMinYMin meet">
71 <rect id="rect" width="100%" height="100%" fill="red" />
72 </svg>
73 </div>
74 <div id="error" style="position: absolute; left: 30px; top: 330px; color: red" />
75 This tests the behaviour of <code>SVGLocatable::getScreenCTM()</code> in mixed content <br />
76 If the test passes you should see a green rectangle.
77 </body>
79 </html>